Function test method and device, electronic equipment and storage medium

By receiving client requests in a cloud computing environment, obtaining server-side test scripts, and executing system commands, the problem of difficult remote login in a cloud computing environment is solved, enabling functional testing to be completed without remote login.

CN115408211BActive Publication Date: 2026-03-27BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-28
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

In a cloud computing environment, functional testing cannot be performed when the client cannot remotely log in to the target server, especially when isolated via VLAN or VXLAN, where traditional SSH login authentication methods cannot meet testing requirements.

Method used

Functional testing is achieved by receiving access requests from clients on the server side, obtaining test scripts from a preset directory, calling system operation functions to execute system commands, and returning the command execution results to the client through an access response.

Benefits of technology

This technology enables the execution of server-side system commands without requiring remote login to the server, and returns the command execution results to the client via an access response, thus completing the testing function and solving the problem of difficult remote login.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115408211B_ABST
    Figure CN115408211B_ABST
Patent Text Reader

Abstract

The application provides a function test method and device, electronic equipment and a storage medium, and relates to the technical field of computers. The method is applied to a server, and the specific implementation scheme is as follows: an access request sent by a client is received, a test script under a preset directory in the server is acquired according to the access request, then a system operation function is called according to the test script to execute a system command in the access request, and the execution result of the acquired command is returned to the client through an access response, so that the function test is realized. Thus, the server system command can be executed without remotely logging in the server, the execution result of the command is returned to the client through the access response, and the test function is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of computer, and particularly relates to a function testing method and device, electronic equipment and storage medium. BACKGROUND

[0002] With the development of cloud technology, cloud computing products are increasingly concerned. In order to ensure the quality of cloud computing products, it is necessary to perform function testing on cloud computing products in time.

[0003] In the related art, function testing is mainly performed by remotely logging into a target server through a client server Secure Shell (SSH). However, when the client server cannot remotely log into the target server, function testing cannot be performed. SUMMARY

[0004] The present disclosure provides a function testing method and device, electronic equipment and storage medium.

[0005] According to a first aspect of the present disclosure, a function testing method is provided, applied to a server, comprising: receiving an access request sent by a client, wherein the access request contains a system command; obtaining a test script under a preset directory in the server according to the access request; calling a system operation function to execute the system command in the access request according to the test script to obtain a command execution result; and returning the command execution result to the client in an access response to realize function testing.

[0006] In the technical solution, the access request sent by the client is received, the test script under the preset directory in the server is obtained according to the access request, then the system command in the access request is executed according to the test script by calling the system operation function, and the obtained command execution result is returned to the client in the access response, thereby realizing function testing. Thus, the server system command can be executed without remotely logging into the server, and the command execution result is returned to the client in the access response, thereby realizing function testing.

[0007] According to a second aspect of the present disclosure, another function testing method is provided, applied to a client, comprising: sending an access request to a server, wherein the access request contains a system command; receiving an access response returned by the server, wherein the access response includes a command execution result obtained by the server by calling a system operation function to execute the system command according to a test script under a preset directory; and comparing the command execution result with an expected command execution result corresponding to the system command to obtain a function testing result corresponding to the system command.

[0008] According to a third aspect of the embodiments of the present application, a functional test device is provided, applied to a server, comprising: a receiving module, configured to receive an access request sent by a client, wherein the access request comprises a system command; an obtaining module, configured to obtain a test script under a preset directory in the server according to the access request; an executing module, configured to execute the system command in the access request according to the test script to obtain a command execution result; and a responding module, configured to return the command execution result to the client in an access response, so as to realize functional test.

[0009] According to a fourth aspect of the embodiments of the present application, another functional test device is provided, applied to a client, comprising: a sending module, configured to send an access request to a server, wherein the access request comprises a system command; a receiving module, configured to receive an access response returned by the server, wherein the access response comprises a command execution result obtained by the server according to a test script under a preset directory; and a comparing module, configured to compare the command execution result with an expected command execution result corresponding to the system command, to obtain a functional test result corresponding to the system command.

[0010] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0011] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the specification, serve to explain the principles of the present disclosure, and do not constitute an undue limitation on the present disclosure.

[0012] Figure 1 is a flowchart of a functional test method according to an exemplary embodiment;

[0013] Figure 2 is a flowchart of a functional test method according to an exemplary embodiment;

[0014] Figure 3 is a flowchart of a functional test method according to an exemplary embodiment;

[0015] Figure 4 is a flowchart of a functional test method according to an exemplary embodiment;

[0016] Figure 5 is a flowchart of a functional test method according to an exemplary embodiment;

[0017] Figure 6 is a flowchart of a functional test method according to an exemplary embodiment;

[0018] Figure 7 is a flowchart of another functional test method provided by an embodiment of the present application;

[0019] Figure 8 is a schematic diagram of a command execution result according to an embodiment of the present application;

[0020] Figure 9 is a schematic diagram of an expected command execution result corresponding to a system command according to an embodiment of the present application;

[0021] Figure 10 is a structural schematic diagram of a functional test device provided by an embodiment of the present application;

[0022] Figure 11 is a structural schematic diagram of another functional test device provided by an embodiment of the present application;

[0023] Figure 12 is a block diagram of an electronic device for implementing the functional test method of an embodiment of the present application. DETAILED DESCRIPTION

[0024] In order to make the ordinary person in the art better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below in conjunction with the drawings.

[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The implementation described in the following exemplary embodiments does not represent all implementations consistent with the present disclosure. Rather, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0026] Currently, functional testing of cloud computing primarily involves remotely logging into the target server via SSH from the client server and executing system commands. SSH login requires password or key authentication, uses a single port, and is cumbersome. Especially in automated testing, programming languages ​​need to use modules to implement SSH login, such as Python's paramiko, Java's Ganymed SSH-2, and shell expect. If the network is isolated via VLAN (Virtual Local Area Network) or VXLAN (Virtual Extended Local Area Network), connection to the target server becomes impossible. Currently, servers in public cloud environments are isolated via VXLAN, making traditional SSH login authentication methods insufficient for testing needs.

[0027] To address the aforementioned issues, this application provides a functional testing method, apparatus, electronic device, and storage medium.

[0028] Figure 1 This is a flowchart illustrating a functional testing method according to an exemplary embodiment. This functional testing method is applied to the server side; that is, the functional testing method of this application embodiment is described from the server side.

[0029] like Figure 1 As shown, this functional testing method includes the following steps:

[0030] Step 101: Receive the access request sent by the client. The access request contains system commands.

[0031] In this embodiment of the application, the access request sent by the client can be an HTTP (Hypertext Transfer Protocol) request. For example, the client can use the curl (CommandLine UniformResource Locator) command to send an HTTP request to the server. The server receives the HTTP request sent by the client. It should be noted that the access request may contain system commands, which can be used to test the function to be tested on the server.

[0032] Step 102: Obtain the test script from the preset directory on the server according to the HTTP request.

[0033] Then, after receiving the access request sent by the client, the server can obtain the test script under the preset directory in the server according to the access request. The test script can include, but is not limited to, a php script and a Python script. For example, after receiving the http request sent by the client, the server can obtain the php script or the Python script under the preset directory in the server according to the http request. It should be noted that the http request can include a field of the php script or the Python script to be executed. In order to facilitate the php script or the Python script file to be accessed directly through the access http, the php script or the Python script can be placed in the preset directory in the server, for example, the php script or the Python script can be placed in the “ / var / www / html / ” directory, which is the default root directory of the Apache website. In addition, the placement directory of the php script or the Python script can be customized by modifying the configuration file “ / etc / httpd / conf / httpd.conf” of the Apache service.

[0034] In step 103, a system operation function is called according to the test script to execute the system command in the access request, so as to obtain the command execution result.

[0035] As an example, the php script calls a system operation function to execute the system command in the http request, so as to obtain the command execution result. For example, the system command in the http request is “sudodf–h”, and the server can execute the “sudodf–h” system command according to the php script calling the system operation function (such as the function system()), so as to obtain the command execution result. It should be noted that the system command can be used to test the function to be tested on the server.

[0036] In step 104, the command execution result is returned to the client in the access response, so as to realize the function test.

[0037] Further, the server can return the command execution result to the client through the access (such as http), and the client can compare the command execution result with the expected command result, so as to obtain the test result corresponding to the system command.

[0038] In summary, by receiving an access request sent by a client, a test script under a preset directory in a server is acquired according to the access request, then a system operation function is called according to the test script to execute a system command in the access request, and the execution result of the acquired command is returned to the client through an access response, so as to realize function testing. Thus, the server system command can be executed without remote login of the server, and the execution result of the command is returned to the client through the access response, and the testing function is realized.

[0039] In order to enable the server to receive an access request sent by a client and execute a system command in the access request according to a test script to call a system operation function for function testing, as shown in Figure 2 Figure 2 is a flowchart of a function testing method provided by an embodiment of the present application. The method can be applied to a server. Before receiving an access request sent by a client, access service configuration can be performed, and the access request can be received through the configured access service. As shown in Figure 2

[0040] Step 201: Access service configuration is performed according to access service configuration information, so as to receive an access request through the configured access service.

[0041] In order to enable the server to receive an access request sent by a client, optionally, the server can perform access service configuration according to preset access service configuration information, so as to receive the access request sent by the client through the configured access service. For example, the server can perform httpd (http server main program) service configuration according to preset httpd service configuration information, so as to receive an http request sent by the client through the configured httpd service.

[0042] Step 202: An access request sent by a client is received, and the access request contains a system command.

[0043] Step 203: A test script under a preset directory in a server is acquired according to the access request.

[0044] Step 204: A system operation function is called according to the test script to execute a system command in the access request, so as to acquire a command execution result.

[0045] Step 205: The command execution result is returned to the client in an access response, so as to realize function testing.

[0046] Steps 202 to 205 can be implemented by any one of the embodiments of the present application, and the embodiments of the present application do not limit this, and will not be described again.

[0047] ​​In summary, by receiving an access request sent by a client, a test script under a preset directory in a server is acquired according to the access request, then a system operation function is called according to the test script to execute a system command in the access request, and an execution result of the acquired command is returned to the client through an access response, so as to realize function testing. Thus, the server system command can be executed without remote login of the server, and the execution result of the command is returned to the client through the access response, so as to realize the test function.

[0048] In order to enable ordinary users to have the permission to execute all system commands and make the function testing more automatic, as shown in Figure 3 Figure 3 is a flowchart of another function testing method provided by the embodiment of the application. The method can be applied to a server. Before a system operation function is called to execute a system command in the access request, system permissions can be configured, and the system command is executed according to the configured system permissions. As shown in Figure 3

[0049] Step 301, receiving an access request sent by a client, the access request containing a system command.

[0050] Step 302, acquiring a test script under a preset directory in a server according to the access request.

[0051] Step 303, performing system permission configuration according to system command permission configuration information, so as to execute the system command according to the configured system permissions.

[0052] It can be understood that the user with ordinary permissions can execute ordinary system commands, and the user with the highest permission (for example, root permission) can execute special system commands. For example, the apache user has ordinary permissions and cannot execute the “sudo” command by default. In order to enable the user with ordinary permissions to execute special system commands, system permission configuration can be performed according to system command permission configuration information, and the server can execute the system command according to the configured system permissions.

[0053] For example, in order to enable the user with ordinary permissions to execute the “visudo” command, the following code can be found:

[0054] “root ALL=(ALL) ALL”;

[0055] A line of configuration is added after the code, and the configuration is as follows. The configuration allows the apache user to execute the root permission command through “sudo”,

[0056] “apache ALL=(ALL) NOPASSWD: ALL”; ​​

[0057] By the above operation, the apache user can execute the "sudo" permission without password.

[0058] In step 304, a system operation function is called according to the test script to execute a system command in the access request, so as to obtain a command execution result.

[0059] In step 305, the command execution result is returned to the client in an access response, so as to implement the function test.

[0060] Steps 301-302 and 304-305 can be implemented by any of the embodiments of the present disclosure, and the present disclosure does not limit the same.

[0061] In summary, by receiving an access request sent by a client, a test script in a preset directory in a server is obtained according to the access request, then a system operation function is called according to the test script to execute a system command in the access request, and a command execution result is returned to the client through an access response, so as to implement the function test. Thus, the server system command can be executed without remote login, and the command execution result is returned to the client through the access response, so as to implement the test function.

[0062] In order to enable the server to better identify the system command in the access request, the server can be configured to Figure 4 As shown in Figure 4 is a flowchart of another function test method provided by an embodiment of the present application. The method can be applied to a server. The system command in the access request can be format-converted, a system command in a format corresponding to a test script is obtained, and the system command in the format corresponding to the test script is executed. As shown in Figure 4 The function test method can include the following steps:

[0063] In step 401, an access request sent by a client is received, and the access request includes a system command. The access request is an http request, and the format of the system command is an http format.

[0064] In step 402, a test script in a preset directory in a server is obtained according to the access request.

[0065] In step 403, the system command is format-converted to obtain a system command in a format corresponding to the test script.

[0066] It can be understood that when the format of the system command is the http format, the server cannot identify the system command in the http request if the special characters such as spaces, "#" and the like are not converted because the http format can be accompanied by the special characters. Therefore, in the embodiment of the application, when the format of the system command is the http format, the url encoding can be used to convert the format of the system command to obtain the system command in the format corresponding to the test script. For example, the url encoding can be performed on the system command through some websites or tools, such as online url encoding by accessing "http: / / tool.oschina.net / encode?type=4", or url encoding by using the urllib module.

[0067] At step 404, the system operation function is called according to the test script to execute the system command in the format corresponding to the test script to obtain the command execution result.

[0068] Then, the server can execute the system command in the format corresponding to the test script according to the system operation function called by the test script to obtain the command execution result. For example, the php script can execute the php format system command "sudo %20 df %20-h" by calling the system operation function (such as the function system()) to obtain the command execution result.

[0069] At step 405, the command execution result is returned to the client in the access response to implement the function test.

[0070] Steps 401-402 and 405 can be implemented by any of the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be repeated.

[0071] In summary, by receiving the access request sent by the client, the test script in the preset directory in the server is obtained according to the access request, then the system operation function is called according to the test script to execute the system command in the access request, and the obtained command execution result is returned to the client through the access response, thereby implementing the function test. Thus, the server system command can be executed without remote login to the server, and the command execution result is returned to the client through the access response to implement the test function.

[0072] In the case where the server is isolated from the client by vlan or vxlan, in order for the server to obtain the access request sent by the client, as shown in Figure 5 Figure 5 is a flowchart of another function test method provided by the embodiment of the application. The method can be applied to the server. The access request sent by the client can be obtained by penetrating the vlan or vxlan through a third-party module. As shown in Figure 5 ​As shown, the function test method can include the following steps:

[0073] Step 501, receiving an access request sent by a client, the access request containing a system command, wherein the client is isolated from the server, and the access request is an access request obtained by encapsulating through a third-party module on the client.

[0074] In the case of isolation of the server from the client through vlan or vxlan, in order to enable the server to obtain an access (such as http) request sent by the client, the access request obtained by encapsulating through a third-party module (such as slb_vsock module, a kernel module of linux) on the client can be sent to the server by the client. It should be noted that the third-party module can penetrate vlan or vxlan.

[0075] Step 502, encapsulating the access request by using a third-party module on the server.

[0076] Then, the server can perform encapsulation processing on the encapsulated access request according to the third-party module on the server after receiving the access request encapsulated by the third-party module sent by the client.

[0077] Step 503, obtaining a test script in a preset directory in the server according to the access request.

[0078] Step 504, calling a system operation function to execute the system command in the access request according to the test script to obtain a command execution result.

[0079] Step 505, returning the command execution result to the client in an access response to implement function test.

[0080] Steps 503-505 can be implemented by any of the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this, and will not be repeated.

[0081] In summary, by receiving an access request sent by a client, obtaining a test script in a preset directory in the server according to the access request, and then calling a system operation function to execute a system command in the access request according to the test script, and returning the obtained command execution result to the client through an access response, function test is implemented. Thus, the server system command can be executed without remote login to the server, and the command execution result is returned to the client through the access response, and the test function is implemented.

[0082] The function test method of the embodiment of the present application receives an access request sent by a client, acquires a test script under a preset directory in a server according to the access request, then calls a system operation function to execute a system command in the access request according to the test script, and returns the acquired command execution result to the client through an access response, so as to realize function test. Thus, the server system command can be executed without remote login to the server, and the command execution result is returned to the client through the access response, and the test function is realized.

[0083] The embodiment of the present application provides another function test method, Figure 6 is a flowchart of another function test method provided by the embodiment of the present application. The function test method can be executed by a client.

[0084] As Figure 6 shown, the function test method can include the following steps:

[0085] Step 601, an access request is sent to a server, wherein the access request contains a system command.

[0086] In the embodiment of the present application, the access request can be an http request. For example, the client sends an http request to the server, wherein the http request can include but is not limited to the system command, and the system command can be a system command on the server to be tested.

[0087] Step 602, an access response returned by the server is received, wherein the access response includes a command execution result obtained by the server calling a system operation function to execute the system command according to a test script under a preset directory.

[0088] Further, after receiving the access request sent by the client, the server can call a system operation function to execute the system command according to the test script under the preset directory to obtain a command execution result, and return the execution result to the client through an access.

[0089] Step 603, the command execution result is compared with an expected command execution result corresponding to the system command to obtain a function test result corresponding to the system command.

[0090] In order to verify the correctness of the command execution result corresponding to the system command, the client can compare the command execution result returned by the server with the corresponding expected command execution result after receiving the command execution result returned by the server. If the comparison result is consistent, it indicates that the function test result corresponding to the system command is correct. If the comparison result is inconsistent, it indicates that the function test result corresponding to the system command is incorrect.

[0091] In the case that the service end is isolated from the client through a vlan or a vxlan, in order to enable the client to send an access request to the service end, the access request is encapsulated by a third-party module on the client. Figure 7 Figure 7 is a flowchart of another functional test method provided by the embodiment of the application. The method can be applied to a client. An access request is sent to a service end through a third-party module for penetrating a vlan or a vxlan. As shown in Figure 7 , the functional test method can include the following steps:

[0092] In step 701, a third-party module on the client is used to encapsulate an access request.

[0093] In the embodiment of the application, in the case that the service end is isolated from the client through a vlan or a vxlan, in order to enable the client to send an access (such as an http) request to the service end, an encapsulated access request is obtained by encapsulating the access request through a third-party module (such as an slb_vsock module, a kernel module of linux) on the client. It should be noted that the third-party module on the client can penetrate the vlan or the vxlan.

[0094] In step 702, an access request is sent to the service end, wherein the access request contains a system command.

[0095] Next, the client sends the encapsulated access request to the service end.

[0096] In step 703, an access response returned by the service end is received, wherein the access response includes a command execution result obtained by the service end from executing the system command according to a system operation function of a test script in a preset directory.

[0097] In step 704, the command execution result is compared with an expected command execution result corresponding to the system command, to obtain a functional test result corresponding to the system command.

[0098] The functional test method of the embodiment of the application sends an access request to a service end, wherein the access request contains a system command; receives an access response returned by the service end, wherein the access response includes a command execution result obtained by the service end from executing the system command according to a system operation function of a test script in a preset directory; and compares the command execution result with an expected command execution result corresponding to the system command, to obtain a functional test result corresponding to the system command. Thus, the service end system command can be executed without remotely logging in the service end, the execution result of the command is returned to the client through the access response, and the test function is realized.

[0099] In order to enable those skilled in the art to more clearly understand the application, examples are provided.

[0100] ​For example, such as 1, set two virtual machines (centos7.x), respectively, virtual machine A and virtual machine B, virtual machine A as a client, virtual machine B as a server;

[0101] 2, virtual machine B installs php by "yum-y install httpdphp" and installs httpd service by "systemctl start httpd";

[0102] 3, create a php script exec_cmd.php, as follows:

[0103] "<? Php

[0104] # get query statement, get the value after php url request? Assign variable cmd

[0105] # such as curl http: / / 10.101.104.237:80 / exec_cmd.php?sudo%20df%20-h

[0106] # sudo % 20df % 20-h is the query statement obtained

[0107] $cmd = $_SERVER["QUERY_STRING"];

[0108] # get php format system command

[0109] $cmd = urldecode($cmd);

[0110] # use php system function to execute linux command

[0111] system("{$cmd}");

[0112] ?>";

[0113] 4, put the script in " / var / www / html / " directory, which is the default root directory of Apache website. The php script file placed in this directory can be accessed directly by accessing http. If you want to customize the directory, you can modify the configuration file " / etc / httpd / conf / httpd.conf" of apache service;

[0114] 5, set apache user passwordless sudo permission, allow apache user to execute root permission command through sudo (apache user is a normal user, by default, cannot execute sudo permission, if you don't need to execute root related permission command, you can not do this setting);

[0115] Execute the visudo command, find the following line:

[0116] "root ALL=(ALL) ALL";

[0117] Add a line of configuration after this line, the configuration is as follows, which allows the apache user to execute the root permission command through sudo:

[0118] "apache ALL=(ALL) NOPASSWD: ALL";

[0119] The above operation can set the apache user to execute the sudo permission without password

[0120] 6, start the httpd server by the code "systemctl start httpd", if you need to start automatically, you can set the start automatically by the code "systemctl enable httpd";

[0121] 7, url encode the command that needs to be executed remotely, for example, use some web site or tool to url encode the required command. You can do online url decoding by accessing "http: / / tool.oschina.net / encode?type=4", if you use python, you can use the urllib module to url encode. For example, the encoded string of "sudodf-h" is "sudo%20df%20-h".

[0122] 8, execute "sudodf-h" on the server virtual machine B by using the curl command on the client virtual machine A, the url request is "curl http: / / 10.101.104.237:80 / exec_cmd.php?sudo%20df%20-h". The command execution result is as shown in Figure 8 The result of executing directly on virtual machine B is as shown in Figure 9 Compare the command execution result in Figure 8 with the expected command execution result in Figure 9 , the command execution result in Figure 8 is consistent with the expected command execution result in Figure 9 , which indicates that the system command corresponding to the command execution result is correct.

[0123] Corresponding to the function test method provided by the above-mentioned Figures 1 to 5 embodiments, the present application also provides a function test device, since the function test device provided by the embodiments of the present disclosure corresponds to the above-mentioned Figures 1 to 5The function test method provided by the embodiments corresponds, and therefore the implementation of the function test method is also applicable to the function test device provided by the embodiments of the present disclosure, which will not be described in detail in the embodiments of the present application.

[0124] Figure 10 FIG. 1 is a structural schematic diagram of a function test device provided by the embodiments of the present disclosure.

[0125] As shown in Figure 10 The function test device 1000 is executed by a server, and the function test device 1000 includes a receiving module 1010, an obtaining module 1020, an executing module 1030, and a responding module 1040.

[0126] The receiving module is configured to receive an access request sent by a client, the access request containing a system command; the obtaining module is configured to obtain a test script under a preset directory in the server according to the access request; the executing module is configured to call a system operation function to execute the system command in the access request according to the test script, so as to obtain a command execution result; and the responding module is configured to return the command execution result to the client in an access response, so as to implement function test.

[0127] As a possible implementation manner of the embodiments of the present application, the function test device 1000 further includes a first configuration module.

[0128] The first configuration module is configured to perform access service configuration according to access service configuration information, so as to receive the access request through the configured access service.

[0129] As a possible implementation manner of the embodiments of the present application, the function test device 1000 further includes a second configuration module.

[0130] The second configuration module is configured to perform system authority configuration according to system command authority configuration information, so as to execute the system command according to the configured system authority.

[0131] As a possible implementation manner of the embodiments of the present application, the access request is an http request, and the system command is in an http format; the executing module is specifically configured to: perform format conversion on the system command, to obtain a system command in a format corresponding to the test script; and call a system operation function to execute the system command in the format corresponding to the test script according to the test script, so as to obtain the command execution result.

[0132] As a possible implementation manner of the embodiments of the present application, the system command is a system command to be tested on the server.

[0133] As one possible implementation of this application, the client and the server are isolated, and the access request is an access request obtained by encapsulation by a third-party module on the client. The functional testing device 1000 also includes a decapsulation module.

[0134] The decapsulation module is used to decapsulate access requests using a third-party module on the server.

[0135] As one possible implementation of this application, the server is isolated from the client through a virtual local area network (VLAN) or an extended VLAN.

[0136] The functional testing device of this application embodiment receives an access request sent by a client, obtains a test script in a preset directory on the server according to the access request, then calls a system operation function to execute the system command in the access request according to the test script, and returns the obtained command execution result to the client through an access response, thereby realizing functional testing. Thus, it realizes the execution of server system commands without remote login to the server and returns the command execution result to the client through an access response, thereby realizing the testing function.

[0137] With the above Figures 6 to 9 Corresponding to the functional testing method provided in the embodiments, this application also provides a functional testing apparatus. Since the functional testing apparatus provided in the embodiments of this disclosure is similar to the one described above... Figures 6 to 9 The functional testing method provided in the embodiments corresponds to the functional testing device provided in the embodiments of this disclosure, and will not be described in detail in the embodiments of this application.

[0138] Figure 11 This is a schematic diagram of another functional testing device provided in an embodiment of this disclosure.

[0139] like Figure 11 As shown, the functional testing device 1100 is executed by the server and includes: a sending module 1110, a receiving module 1120, and a comparison module 1130.

[0140] The sending module 1110 is used to send an access request to the server, wherein the access request contains a system command; the receiving module 1120 is used to receive the access response returned by the server, wherein the access response includes: the command execution result obtained by the server calling the system operation function to execute the system command according to the test script in the preset directory; and the comparison module 1130 is used to compare the command execution result with the expected command execution result corresponding to the system command to obtain the functional test result corresponding to the system command.

[0141] As one possible implementation of this application, system commands are used to test the function to be tested on the server.

[0142] As one possible implementation of this application embodiment, the client is isolated from the server, and the functional testing device 1100 further includes an encapsulation module.

[0143] The encapsulation module is used to encapsulate and process access requests using a third-party module on the client side.

[0144] The functional testing apparatus of this application embodiment sends an access request to a server, wherein the access request contains a system command; receives an access response returned by the server, wherein the access response includes: the command execution result obtained by the server calling a system operation function to execute the system command according to a test script in a preset directory; and compares the command execution result with the expected command execution result corresponding to the system command to obtain the functional test result corresponding to the system command. Thus, it realizes the execution of server-side system commands without remote login to the server and returns the command execution result to the client through the access response, thereby achieving the testing function.

[0145] To implement the above embodiments, this application also provides an electronic device, a readable storage medium, and a computer program product.

[0146] Figure 12 A schematic block diagram of an example electronic device 1200 that can be used to implement embodiments of this application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein.

[0147] like Figure 12 As shown, device 1200 includes a computing unit 1201, which can perform various appropriate actions and processes according to a computer program stored in read-only memory (ROM) 1202 or a computer program loaded from storage unit 1208 into random access memory (RAM) 1203. The RAM 1203 may also store various programs and data required for the operation of device 1200. The computing unit 1201, ROM 1202, and RAM 1203 are interconnected via bus 1204. Input / output (I / O) interface 1205 is also connected to bus 1204.

[0148] A number of components in the device 1200 are connected to the I / O interface 1205, including: an input unit 1206, such as a keyboard, a mouse, etc.; an output unit 1207, such as various types of displays, speakers, etc.; a storage unit 1208, such as a magnetic disk, an optical disk, etc.; and a communication unit 1209, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1209 allows the device 1200 to exchange information / data with other devices over a computer network, such as the Internet, and / or various telecommunication networks.

[0149] The computing unit 1201 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 1201 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 1201 performs various methods and processes described above, such as the functional test method. For example, in some embodiments, the functional test method can be implemented as a computer software program, which is tangibly embodied in a machine-readable medium, such as the storage unit 1208. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 1200 via the ROM 1202 and / or the communication unit 1209. When the computer program is loaded onto the RAM 1203 and executed by the computing unit 1201, one or more steps of the functional test method described above can be performed. Alternatively, in other embodiments, the computing unit 1201 can be configured to perform the functional test method by any other appropriate means, such as by means of firmware.

[0150] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0151] Program code for carrying out methods of the present application can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces a means for implementing the functions / acts specified in the flowcharts and / or block diagrams. The program code can be retrieved from a machine-readable medium or device and executed by a processor to produce a machine for implementing the functions / acts specified in the flowcharts and / or block diagrams. The program code can be executed as a stand-alone program, or in combination with other program codes, on the machine to produce a machine that implements the functions / acts specified in the flowcharts and / or block diagrams.

[0152] In the context of the present application, a machine-readable medium can be a tangible medium that can contain or store program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable storage media can include, without limitation, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media can include, but are not limited to, an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0153] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0154] The systems and techniques described herein can be implemented in a computing system that includes a back end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front end component, e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described herein, or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.

[0155] The computer system can include clients and servers. The clients and servers are generally remote from each other and typically interact through a communication network. The relationship of client and server is one of communication and distribution, with the server receiving requests from the client and transmitting responses via the communication network. The server can be a distributed system, or a blockchain-enabled server.

[0156] It should be noted that artificial intelligence is a discipline that studies enabling computers to simulate some thinking processes and intelligent behaviors of people (such as learning, reasoning, thinking, planning, etc.), both hardware and software technologies. Artificial intelligence hardware technology generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing, etc.; artificial intelligence software technology mainly includes computer vision technology, speech recognition technology, natural language processing technology, and machine learning / deep learning, big data processing technology, knowledge graph technology, etc. several major directions.

[0157] It should be understood that various forms of flow shown above can be used to reorder, add or delete steps. For example, each step described in the present application can be executed in parallel, sequentially or in a different order, as long as the desired results of the technical solutions disclosed in the present application can be achieved, which is not limited herein.

[0158] The above detailed description does not constitute a limitation on the scope of protection of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A functional testing method, characterized in that, Applied to the server side, including: Receive an access request sent by a client, wherein the access request contains system commands, and the system commands are used to test the functions to be tested on the server. Based on the access request, obtain the test script in the preset directory of the server; The system command in the access request is executed by calling the system operation function according to the test script, so as to obtain the command execution result; The result of the command execution is returned to the client in the access response to perform functional testing; The client is isolated from the server, and the access request is an access request encapsulated by a third-party module on the client. After receiving the access request sent by the client, the method further includes: The access request is decapsulated using the third-party module on the server.

2. The method according to claim 1, characterized in that, Before receiving access requests from clients, it also includes: Configure the access service according to the access service configuration information to receive the access request through the configured access service.

3. The method according to claim 1, characterized in that, Before executing the system command in the access request by calling the system operation function according to the test script, the method further includes: Configure system permissions according to the system command permission configuration information, so as to execute the system commands according to the configured system permissions.

4. The method according to claim 1, characterized in that, The access request is an HTTP request, and the system command is in HTTP format. The step of executing the system command in the access request by calling the system operation function according to the test script to obtain the command execution result includes: The system commands are converted to obtain system commands in the format corresponding to the test script; The system operation function is called according to the test script to execute the system command in the format corresponding to the test script, so as to obtain the command execution result.

5. The method according to claim 1, wherein the server is isolated from the client via a virtual local area network or an extended virtual local area network.

6. A functional testing method, characterized in that, Applied to the client side, including: Send an access request to the server, wherein the access request contains system commands, wherein the system commands are used to test the function to be tested on the server; The server receives an access response, which includes the command execution result obtained by the server calling the system operation function to execute the system command according to the test script in the preset directory. By comparing the execution result of the command with the expected execution result of the corresponding system command, the functional test result of the system command is obtained. The client is isolated from the server. Before sending the access request to the server, the method further includes: The access request is encapsulated and processed using a third-party module on the client.

7. A functional testing device, characterized in that, Applied to the server side, including: The receiving module is used to receive access requests sent by clients. The access requests contain system commands, which are used to test the functions to be tested on the server. The acquisition module is used to acquire test scripts in a preset directory on the server according to the access request; The execution module is used to call system operation functions according to the test script to execute the system commands in the access request, so as to obtain the command execution results; The response module is used to return the command execution result to the client in the access response to achieve functional testing; The client is isolated from the server, and the access request is an access request encapsulated by a third-party module on the client; it also includes: The decapsulation module is used to decapsulate the access request using the third-party module on the server.

8. The apparatus according to claim 7, characterized in that, Also includes: The first configuration module is used to configure the access service according to the access service configuration information, so as to receive the access request through the configured access service.

9. The apparatus according to claim 7, characterized in that, Also includes: The second configuration module is used to configure system permissions according to system command permission configuration information, so as to execute the system commands according to the configured system permissions.

10. The apparatus according to claim 7, characterized in that, The access request is an HTTP request, and the system command is in HTTP format. The execution module is specifically used for: The system commands are converted to obtain system commands in the format corresponding to the test script; The system operation function is called according to the test script to execute the system command in the format corresponding to the test script, so as to obtain the command execution result.

11. The apparatus according to claim 7, characterized in that, The server is isolated from the client via a virtual local area network (VLAN) or an extended VLAN.

12. A functional testing device, characterized in that, Applied to the client side, including: The sending module is used to send an access request to the server, wherein the access request contains system commands, and the system commands are used to test the function to be tested on the server. The receiving module is used to receive the access response returned by the server, wherein the access response includes: the command execution result obtained by the server calling the system operation function to execute the system command according to the test script in the preset directory; The comparison module is used to compare the command execution result with the expected command execution result corresponding to the system command to obtain the functional test result corresponding to the system command. The client is isolated from the server; it also includes: The encapsulation module is used to encapsulate the access request using a third-party module on the client.

13. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method of any one of claims 1-5, or to perform the method of claim 6.

14. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method as described in any one of claims 1-5, or to perform the method as described in claim 6.

15. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the method as described in any one of claims 1-5, or implements the method as described in claim 6.

Citation Information

Patent Citations

  • Vxlan (Virtual Extensible LAN) message processing method and apparatus

    CN107770031A

  • Integrated test method, apparatus, computer device and storage medium

    CN109144799A