Automated testing method and system

Through automated testing methods and systems, the problem of low consistency efficiency of manual testing of HTTP protocol headers is solved, fast and accurate test results are achieved, and the testing efficiency and standard quality are improved.

CN117640475BActive Publication Date: 2025-04-18ICLOUDSHIELD SECURITY TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311640265.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-01
Publication Date
2025-04-18
Estimated Expiration
2043-12-01

AI Technical Summary

Technical Problem

In the prior art, when manually testing the consistency between the HTTP protocol headers before and after the proxy, the test time is long and the efficiency is low. Due to the large number of HTTP protocol headers, the workload is large.

Method used

An automated testing method and system is proposed to generate test cases, determine the test type, read the request or response header data, issue execution requests, obtain the data to be checked, and analyze whether the header data is lost or tampered, and generate test results.

Benefits of technology

It realizes automated testing, saves testing time, improves testing efficiency, simplifies the testing process, reduces the requirements for testers, and unifies the quality of testing standards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117640475B_ABST
    Figure CN117640475B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of automated testing technology, and provides an automated testing method and system. The method comprises: generating a test case based on HTTP protocol header data configured by a tester; determining the test type of the test case; if the test type is a flow request type, reading the request header data of the test case, and sending an execution request to the client so that the client executes the test case, the execution request carries the request header data; obtaining the data to be verified received by the client, the data to be verified includes the response data of the server and the header data in the flow received by the server; analyzing whether the tested system loses or tampers with the header data according to the header data in the data to be verified and the header data in the request flow, and generating a first test result. The present invention can save testing time and improve testing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of automated testing, and in particular relates to an automated testing method and system. Background Art

[0002] In the actual product development process, a Web proxy forwarding product is crucial for the correct forwarding processing of the proxied Web service traffic. The current main method is to ensure the consistency of the HTTP protocol Header before and after the proxy. Only when the forwarding processing is consistent can the availability of user services after the product proxy be guaranteed, thereby achieving the expected effect of product development.

[0003] In the prior art, the consistency of HTTP protocol headers before and after the proxy is generally tested manually, based on artificial simulation and triggering of real client / browser behavior, specifically by manually executing both ends (client / server) to capture packets at the same time to compare data consistency. However, this manual test process is implemented by capturing packets at both ends at the same time, which takes a long time and has low test efficiency. Summary of the invention

[0004] In order to solve at least one technical problem in the background technology, the present invention proposes an automated testing method and system, which can improve testing efficiency.

[0005] According to a first aspect of the present invention, the present invention first provides an automated testing method, comprising:

[0006] Generate test cases based on the HTTP protocol header data configured by the tester;

[0007] Determining a test type for the test case;

[0008] If the test type is a traffic request type, the request header data of the test case is read, and an execution request is sent to the client so that the client executes the test case, and the execution request carries the request header data, wherein the client sends the request traffic which is forwarded to the server via the system under test, and receives the data to be verified which is returned by the server in the form of a payload;

[0009] Acquire the data to be verified, where the data to be verified includes the response data of the server and the header data in the traffic received by the server;

[0010] Based on the header data in the data to be verified and the header data in the request flow, it is analyzed whether the header data is lost or tampered with before and after the proxy of the system under test in the request direction, and a first test result is generated.

[0011] Furthermore, the generating of test cases based on the HTTP protocol header information configured by the tester includes:

[0012] Receive known HTTP protocol header data configured by the tester, and generate a test case according to the known HTTP protocol header data; or,

[0013] Receiving custom header data configured by a tester, and generating a test case according to the custom header data; or,

[0014] Receive multiple header data configured by a tester, and generate test cases according to the multiple header data.

[0015] Further, determining the test type of the test case includes:

[0016] Determine the label type in the test case;

[0017] When the tag type is a request tag, determining that the test type of the test case is a traffic request type; or,

[0018] When the tag type is a response tag, it is determined that the test type of the test case is a flow response type.

[0019] Furthermore, the client sends a request flow which is forwarded to the server via the system under test. After the server generates the data to be verified, the server further includes:

[0020] The data to be verified is encrypted to generate encrypted data, and the encrypted data is sent to the system under test.

[0021] Furthermore, the automated testing method further comprises:

[0022] Based on the access logs of the tested system after it is actually online, analyzing the unknown header data customized by real users;

[0023] The automated testing method is re-executed based on the unknown header data.

[0024] Furthermore, the analysis of unknown header data defined by real users based on the access log after the tested system is actually online includes:

[0025] Obtaining access logs after the system under test is actually online;

[0026] Determine whether the header data appearing in the access log is in the list of known header names; if the header data appearing in the access log does not exist in the list of known header names, it is deemed that an unknown header appears, and the name of the unknown header is added to the list of known header names, and the value corresponding to the unknown header is recorded.

[0027] Furthermore, the automated testing method further comprises:

[0028] If the test type is a flow response type, reading the response header data in the test case;

[0029] pre-configuring the server based on the response header data;

[0030] Sending an execution request to the client, the execution request carrying the response header data, wherein the request traffic sent by the client is forwarded to the server via the system under test, and receiving the data to be verified returned by the server in the original path;

[0031] Acquire the data to be verified, wherein the data to be verified includes the header data of the response header data pre-configured by the server after being forwarded by the system under test;

[0032] According to the header data in the data to be verified and the pre-configured response header data, it is analyzed whether the header data is lost or tampered before and after the proxy of the system under test in the response direction to generate a second test result.

[0033] Furthermore, the automated testing method further comprises:

[0034] Before testing the current test case, configuring the system under test; and,

[0035] After the current test case is tested, the current configuration of the system under test is deleted.

[0036] According to a second aspect of the present invention, the present invention further provides an automated testing system, the automated testing system comprising:

[0037] Test case generation module, used to generate test cases based on HTTP protocol header data configured by testers;

[0038] A test type determination module, used to determine the test type of the test case;

[0039] The first processing module is used for reading the request header data of the test case if the test type is a traffic request type, and sending an execution request to the client so that the client executes the test case, wherein the execution request carries the request header data, wherein the client sends the request traffic which is forwarded to the server via the system under test, and receives the data to be verified which is returned by the server in the form of a payload;

[0040] A first acquisition module is used to acquire the data to be verified, wherein the data to be verified includes response data of the server and header data in traffic received by the server;

[0041] The first analysis module is used to analyze whether the system under test loses or tampers with header data in the request direction according to the header data in the data to be verified and the header data in the request traffic, and generate a first test result.

[0042] Furthermore, the automated testing system further comprises:

[0043] A second processing module, configured to read the response header data in the test case if the test type is a flow response type;

[0044] A data configuration module, used for pre-configuring the server based on the response header data;

[0045] The second processing module is further used to send an execution request to the client, the execution request carries the response header data, wherein the request traffic sent by the client is forwarded to the server via the system under test, and receives the data to be verified returned by the server in the original path;

[0046] A second acquisition module is used to acquire the data to be verified, wherein the data to be verified includes the header data of the response header data pre-configured by the server after being forwarded by the system under test;

[0047] The second analysis module is used to analyze whether the header data is lost or tampered before and after the tested system proxy in the response direction according to the header data in the data to be verified and the pre-configured response header data, and generate a second test result.

[0048] Through the technical solution of the present invention, the following technical effects can be obtained:

[0049] The automated testing method and system provided by the present invention capture the header data in the received traffic through the server and save it in the payload data of the response, and then return the payload carrying the request header data to the client through the tested system, so as to obtain the data to be verified and achieve the purpose of automated testing in the request direction; secondly, the automated testing process of the present invention does not require manual execution of the client and the server, saving testing time; thirdly, since the number of HTTP protocol headers in the test process is as high as 120+, which leads to a large workload, the present invention can solve the problem of a large workload caused by the number of HTTP protocol headers in the test process being as high as 120+, and the test speed is faster, thereby improving the test efficiency; fourthly, the test standard quality of the present invention is unified, the requirements for testers are low, and the operation is convenient. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0051] Figure 1 A flow chart of an automated testing method provided by an embodiment of the present invention;

[0052] Figure 2 A flow chart of a method for determining the test type of the test case provided by an embodiment of the present invention;

[0053] Figure 3 A flow chart for verifying all known HTTP protocol header fields provided by an embodiment of the present invention;

[0054] Figure 4 A flowchart for checking multiple headers provided by an embodiment of the present invention;

[0055] Figure 5 A flowchart of a method for generating a second test result by testing whether the system under test loses or tampers with header data in the response direction if the test type is a flow response type provided in an embodiment of the present invention;

[0056] Figure 6 A flow chart of a method for analyzing real user-defined unknown header data based on the access log of the tested system after it is actually online, provided in an embodiment of the present invention;

[0057] Figure 7 A schematic structural diagram of an automated testing system provided in accordance with another embodiment of the present invention. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0059] It should be noted that the terms "first", "second", "third" and "fourth" in the specification and claims of this application are used to distinguish different objects rather than to describe a specific order. The terms "including" and "having" in the embodiments of this application and any variations thereof are intended to cover non-exclusive inclusions.

[0060] In the related art, the traditional manual testing method mainly includes the following steps when testing the consistency of HTTP protocol headers before and after the proxy:

[0061] (1) In the request direction: Step 1: Capture packets on the client / browser to record the detailed content of the HTTP protocol header in the traffic before sending the packet; Step 2: After forwarding successfully, capture packets on the server to record the detailed content of the HTTP protocol header in the received message; Step 3: Compare the consistency of the header data recorded by the client / browser with the data recorded by the server. Only when the data on both ends is consistent, the test is judged to be passed.

[0062] (2) Response direction: The first step is to initiate a request for server resources on the client / browser and capture the details of the HTTP protocol header of the received traffic. The second step is to capture the details of the HTTP protocol header in the sent message on the server. The third step is to compare the consistency of the header data received by the client / browser with the header data sent by the server. Only when the data on both ends is consistent, the test is judged to be passed.

[0063] In summary, the related technologies have the following problems when manually executing the packet capture and consistency comparison at both ends (client / server): the packet capture and comparison at both ends is implemented at the same time, and the execution efficiency is low; the HTTP protocol has more than 120 headers, including standard headers and custom headers, which is a large workload; the quality of the test standards cannot be unified, and the requirements for testers are high, and they need to fully understand the technical details of the headers supported by the HTTP protocol; the iterative update costs of project personnel need to be increased, mainly because they are familiar with the technical details, test standards, execution, and report summary workload.

[0064] Therefore, according to the deficiencies of the related art, the embodiments of the present invention propose an automated testing method and system to meet the testing requirements in the product development process.

[0065] The optional embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0066] According to one embodiment of the present invention, Figure 1 A flow chart of an automated testing method provided by the present invention, such as Figure 1 As shown, the present invention provides an automated testing method, which is applied to an automated testing system, wherein the automated testing system establishes communication links with the system under test (DUT) and the client, respectively; the system under test simultaneously establishes communication links with the client and the server, wherein the system under test supports a web proxy forwarding function. It should be noted that the automated testing system can be deployed on the system under test, or on the client, or on a third-party device. The automated testing method includes:

[0067] S10, generating test cases based on the HTTP protocol header data configured by the tester;

[0068] Specifically, in response to the automated test instruction issued by the tester, such as starting the automated test system, the client displays a configuration interface, and the tester configures parameters through the configuration interface. In this embodiment, the configuration interface is displayed in the form of a pop-up window, and the tester enters the HTTP protocol header data to be tested in the pop-up window, and the automated test system starts to perform automated testing on the system under test based on the header data to be tested.

[0069] The step of generating test cases based on the HTTP protocol header data configured by the tester has three situations, including:

[0070] (1) Receive known HTTP protocol header data configured by the tester, and generate a test case according to the known HTTP protocol header data; wherein the known HTTP protocol header data refers to the standard header of the HTTP protocol well known to those skilled in the art. The test case is a set of data used by the tester to test the consistency of the proxy forwarding of the system under test. In this embodiment, the test case is a set of data specially designed by the tester to test certain functions of the system under test. Of course, the test case can also include a series of operation steps that can apply a certain test case or a group of test cases to the system under test to complete the functional test.

[0071] (2) Receiving custom header data configured by a tester, and generating a test case based on the custom header data; wherein the custom header data is a header that does not include the known HTTP protocol header data and is defined by the tester according to his or her own needs.

[0072] (3) Receive multiple header data configured by the tester, and generate test cases based on the multiple header data. The multiple header data is configured by the tester, and duplicate headers are added. Generally, two duplicate headers with the same name are sufficient. By checking the multiple headers, it is ensured that the system under test can meet the expectation that the duplicate headers are not lost or tampered with.

[0073] As an optional embodiment, the name of the header and the corresponding value can also be randomly generated by the automated testing system, without the need for testers to configure the header data, thereby ensuring robust testing functions and enriching test cases.

[0074] Furthermore, the automated testing method also includes: saving the header names and corresponding values ​​of all test cases, generating a list of known header names, so as to subsequently mine unknown headers and enrich test cases.

[0075] S20, determining the test type of the test case;

[0076] After the test case is generated, it is determined whether the test case belongs to a request direction test or a response direction test according to the content of the test case, and different test methods are used for different directions. Figure 2 The flowchart of the method for determining the test type of the test case is shown. Specifically, Figure 2 As shown, the determining the test type of the test case includes:

[0077] S21, determine the tag type of the test case; wherein, each test case will contain a tag tag. When it is a test case in the request direction, the tag tag of the test case is request, and when it is a test case in the response direction, the tag tag in the test case is response. Therefore, the test type can be determined based on different tags.

[0078] S22, when the tag type is a request tag, determining that the test type of the test case is a traffic request type; or,

[0079] S23, when the tag type is a response tag, determining that the test type of the test case is a flow response type, wherein the flow request type refers to flow communication from the client to the server, and the flow response type refers to flow communication from the server to the client.

[0080] S30, if the test type is a traffic request type, read the request header data of the test case, and send an execution request to the client, so that the client executes the test case, the execution request carries the request header data, wherein the client sends the request traffic which is forwarded to the server via the system under test, and receives the data to be verified which is returned by the server in the form of payload;

[0081] In this step, if the current test case is used to test the function of the system under test in the request direction, the configuration is sent to the client to execute the test case. The purpose of this step S30 is to obtain the header data of the request traffic after being forwarded by the proxy of the system under test, and to ensure that the header data of the request traffic cannot be tampered with or discarded when it is returned to the client in the original path.

[0082] Specifically, the request direction test is implemented according to the preset function, such as the interface of the function is called

[0083] / checkrequestsheader, this url (other urls do not have this function) will store all the headers requested by the client, such as accept, set-cookie, etc., in the payload of the response, and return them to the system under test DUT and then to the client. It can be understood that the server described in the present invention provides a request header data capture function and a storage function in the request direction. After the request traffic is forwarded to the server, the server saves the header data in the received traffic in the response data, generates data to be verified, and then returns the data to be verified to the client in the form of a payload. Transmitting data in the form of a payload makes data transmission more reliable and less likely to be lost. In this way, the automated testing system can obtain accurate data to be verified, achieve the purpose of automated testing in the request direction, and complete the test of verifying that the request header is not discarded or tampered with before and after the proxy forwarding of the system under test.

[0084] In actual application, the automated testing system obtains the header 1 of this verification, such as cookies; after obtaining the test header of the cookies, according to the test method of the request direction, an http request is sent to the client to execute the current test case, and the http request carries a cookie header, wherein the url of the http request is the specified method url of the request direction, such as / checkrequestsheader; the client sends the request traffic to the system under test DUT, and after the system under test DUT forwards the request traffic to the server, the server saves the cookie header in the client's request traffic into the returned payload according to the / checkrequestsheader function, and the payload is now the data to be verified, and the payload is returned to the system under test DUT, and the system under test DUT forwards it to the client, and after the client receives the payload forwarded by the DUT to the server, it saves the payload information.

[0085] Based on the security consideration of request direction data stored on the server, the embodiment of the present invention can add a data encryption function so that the data in the transmission process is encrypted data, thereby ensuring the security of the stored returned data. As an optional embodiment, the client sends the request traffic and forwards it to the server through the system under test. After the server generates the data to be verified, the server further includes:

[0086] The data to be verified is encrypted to generate encrypted data; and the encrypted data is sent to the system under test. Optionally, the data to be verified that is to be returned by the server is encrypted using an AES symmetric encryption method to ensure data security during transmission. In this embodiment, the payload is the data encrypted by AES.

[0087] S40, obtaining the data to be verified, where the data to be verified includes the response data of the server and the header data in the traffic received by the server;

[0088] S50, analyzing whether the system under test loses or tampers with header data in the request direction according to the header data in the data to be verified and the header data in the request traffic, and generating a first test result.

[0089] In step S50, after obtaining the data to be verified, the automated testing system parses the data to be verified to obtain the header data forwarded by the system under test, and then matches the header data with the header data sent by the client. If the header names in the two header data are the same and the values ​​corresponding to the headers are the same, it is considered that the system under test has not lost or tampered with the header data. If any of the header names and the values ​​corresponding to the headers in the two header data are different, it is considered that the system under test has lost or tampered with the header data, and a first test result is obtained. The first test result includes the header data and the corresponding execution analysis result.

[0090] For the request direction test, two verification scenarios are listed for illustration. Figure 3 The following figure shows a flow chart for checking all known HTTP protocol header fields. Figure 4 FIG. 2 shows a flow chart for checking multiple headers. Figure 3 As shown, for all known HTTP protocol header fields, each Header request is added to the DUT one by one. After the request reaches the DUT, the DUT will carry the received request Header when requesting the server. After the server records the request received from the DUT, the server records the Header requested by the DUT, saves it in the response Payload, and returns it to the DUT to ensure that the Header of this request can be passed step by step. In the client stage, the Header is checked based on the received Payload to see if it has been discarded or tampered with, so as to achieve the purpose of automatic verification. Among them, the known HTTP protocol headers include standard headers and custom headers, with a number of up to 70+.

[0091] like Figure 4 As shown, for the scenario of multiple headers, add duplicate headers, usually two with the same name, and the client sends it to the DUT, which then requests the server. The server then adds the header to the returned Payload and returns it. The client verifies whether there are duplicate headers in the returned Payload to ensure that the duplicate headers are not lost or tampered with.

[0092] Furthermore, the automated testing method further comprises:

[0093] S60: If the test type is a flow response type, analyzing whether the system under test loses or tampers with header data in the response direction, and generating a second test result.

[0094] Specifically, Figure 5 A flowchart of a method for generating a second test result is shown in which, if the test type is a flow response type, the system under test in the test response direction loses or tampers with the header data; Figure 5 As shown, step S60 includes:

[0095] S61, if the test type is a flow response type, reading the response header data in the test case;

[0096] S62, pre-configuring the server based on the response header data;

[0097] In this step, before testing, the automated testing system sends the expected configuration to the server, such as a web server, through the API interface of the server. The expected configuration includes the response header data, such as the requested / url1, which contains two headers: cookie and user-agent.

[0098] S63, sending an execution request to the client, the execution request carrying the response header data, wherein the request traffic sent by the client is forwarded to the server via the system under test, and the to-be-verified data returned by the server is received;

[0099] In actual application, the automated test system reads the headers tested in the test case, such as cookies and UA, and sends the expected configuration to the server. For example, the expected configuration is / url1, and / url1 contains cookies and UA headers. The request for / url1 is sent to the client to execute the test case. The request traffic is forwarded to the server through the system under test. After the server determines that it is a / url1 request, it returns the pre-configured headers, namely cookies and UA headers, to the system under test and then to the client.

[0100] S64, obtaining the data to be verified, wherein the data to be verified includes the header data of the response header data pre-configured by the server after being forwarded by the system under test; that is, the test in the response direction is based on matching the header data pre-configured by the server with the header data returned by the server received by the client.

[0101] S65, based on the header data in the data to be verified and the pre-configured response header data, test whether the system under test loses or tampers with the header data in the response direction, and generate a second test result.

[0102] In this step, the automated test system analyzes whether the header data in the data to be verified is the header data in the expected configuration. If so, it indicates that the system under test has not lost or tampered with the header data in the response direction; if not, it indicates that the system under test has lost or tampered with the header data in the response direction. In this embodiment, the execution result of / url1 is judged according to the preset configuration to determine whether it contains the header of cookie and user-agent to determine whether the test case is executed successfully or failed, and obtain the second test result. In this embodiment, the second test result may include the header data and the corresponding execution result.

[0103] As an optional embodiment, the automated testing method further includes:

[0104] The first test result is standardized based on the report template, and a first standard test report is generated and output; or the second test result is standardized based on the report template, and a second standard test report is generated and output. For example, the first standard test report and the second standard test report can be sent to clients such as WeChat for Enterprise, DingTalk, and Feishu, so that the tester can update the system under test and improve its functions according to the first standard test report and the second standard test report.

[0105] Considering the workload of the later maintenance of the system under test, as an optional embodiment, the automated testing method further includes:

[0106] S70, analyzing the unknown header data customized by real users based on the access log after the tested system is actually online; and re-executing the automated testing method based on the unknown header data.

[0107] Figure 6 The flowchart of the method for analyzing the real user-defined unknown header data based on the access log after the tested system is actually online is shown as follows: Figure 6 As shown, the access log after the tested system is actually online is analyzed to obtain the unknown header data customized by the real user, including:

[0108] S71, obtaining the access log of the system under test after it is actually online;

[0109] S72, determining whether the header data appearing in the access log is in the known header name list; if the header data appearing in the access log is not in the known header name list, it is regarded as unknown header data;

[0110] S73, add the name of the unknown header to the known header name list, and record the value corresponding to the unknown header.

[0111] Specifically, the automated test system actively reads the access log of the system under test, obtains the Header field, and compares it with the known header name list. If the Header field does not match the known header name list, the Header field is inserted into the known header name list, and steps S10-S50 are executed based on the discovered new Header field. That is, after discovering a new unknown header, the test case is supplemented to continue to verify the system under test.

[0112] As an optional embodiment, the automated testing method further includes:

[0113] S80, before testing the current test case, configuring the system under test; and after testing the current test case,

[0114] Delete the current configuration of the system under test.

[0115] Specifically, before the automated testing system starts testing, it enables the security function of the system under test by modifying the configuration, for example, issuing a protection policy such as policy acl 0.0.0.0 / 0protocol:http deny, and then executes the test case. After the test, it deletes all current configurations of the system under test, for example, the configuration information is delete policy acl0.0.0.0 / 0protocol:http deny, and step S80 is used to ensure the atomic operation of the automated test, that is, each time the test case is executed, it can be restored to the state before the test.

[0116] The automated testing method provided by the present invention captures and saves the header data in the received traffic at the server end, and then returns the captured header data together with the response data in the form of payload to the client through the tested system, thereby obtaining the data to be verified and achieving the purpose of automated testing; secondly, the automated testing process does not require manual execution of the client and the server, saving testing time; thirdly, the number of HTTP protocol headers in the test process is as high as 120+, which requires a large workload. The automated testing method provided by the present invention has a relatively fast testing speed, thereby improving testing efficiency; fourthly, the automated testing method provided by the present invention has a unified testing standard quality, has low requirements for testers, and is easy to operate.

[0117] According to a second aspect of the present invention, an embodiment of the present invention further provides an automated testing system, which corresponds to the automated testing method provided in the above embodiment, and the same parts are not repeated here. Figure 7 FIG. 4 shows a schematic diagram of the structure of an automated testing system provided by an embodiment of the present invention. Figure 7 As shown, the automated testing system comprises:

[0118] A test case generation module 10, used to generate test cases based on HTTP protocol header data configured by the tester;

[0119] A test type determination module 20, used to determine the test type of the test case;

[0120] The first processing module 30 is used for reading the request header data of the test case if the test type is a traffic request type, and sending an execution request to the client so that the client executes the test case, wherein the execution request carries the request header data, wherein the client sends the request traffic which is forwarded to the server via the system under test, and receives the data to be verified which is returned by the server in the form of a payload;

[0121] A first acquisition module 40 is used to acquire the data to be verified, where the data to be verified includes the response data of the server and the header data in the traffic received by the server;

[0122] The first analysis module 50 is used to analyze whether the header data is lost or tampered with before and after the proxy of the system under test in the request direction according to the header data in the data to be verified and the header data in the request traffic, and generate a first test result.

[0123] Furthermore, the automated testing system further includes: a second processing module 60 , a data configuration module 70 , a second acquisition module 80 , and a second analysis module 90 .

[0124] The second processing module 60 is used to read the response header data in the test case if the test type is a flow response type;

[0125] The data configuration module 70 is used to pre-configure the server based on the response header data;

[0126] The second processing module 60 is further configured to send an execution request to the client, wherein the execution request carries the response header data, wherein the request traffic sent by the client is forwarded to the server via the system under test, and receives the data to be verified returned by the server;

[0127] The second acquisition module 80 is used to acquire the data to be verified, wherein the data to be verified includes the header data of the response header data pre-configured by the server after being forwarded by the system under test;

[0128] The second analysis module 90 is used to analyze whether the header data is lost or tampered before and after the proxy of the system under test in the response direction according to the header data in the data to be verified and the pre-configured response header data, and generate a second test result.

[0129] Furthermore, the test type determination module 20 is also used to determine the tag type in the test case; when the tag type is a request tag, the test type of the test case is determined to be a traffic request type; or, when the tag type is a response tag, the test type of the test case is determined to be a traffic response type.

[0130] Furthermore, the automated testing system also includes a traffic analysis module 100, which is used to analyze unknown header data customized by real users based on the access log after the system under test is actually online; and send the unknown header data to the test case generation module to execute the automated testing method.

[0131] Furthermore, the data configuration module 70 is also used to configure the system under test before the current test case is tested; and to delete the current configuration data of the system under test after the current test case is tested.

[0132] Furthermore, the automated testing system also includes a test report generation module 110, which is used to standardize the first test result based on a report template, generate a first standard test report and output it to the tester; or, standardize the second test result based on a report template, generate a second standard test report and output it to the tester.

[0133] The automated testing system provided by the present invention captures and saves the header data in the received traffic at the server end, and then returns the captured header data together with the response data in the form of payload to the client through the system under test, thereby obtaining the data to be verified and achieving the purpose of automated testing; secondly, the automated testing system does not require manual execution of the client and the server, saving testing time; thirdly, the number of HTTP protocol headers during the test is as high as 120+, which requires a large workload. The automated testing system provided by the present invention has a relatively fast testing speed, thereby improving testing efficiency; fourthly, the automated testing system provided by the present invention has a unified testing standard quality, has low requirements for testers, and is easy to operate.

[0134] Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described device and equipment can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0135] In the embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative.

[0136] Those skilled in the art should understand that the scope of the invention involved in the present invention is not limited to the technical solutions formed by the specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present invention (but not limited to) to form a technical solution.

[0137] It should be understood that the size of the serial numbers of each step in the content of the invention and the embodiments of the present invention does not absolutely mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

Claims

1. An automated testing method, characterized in that: include: Generate test cases based on the HTTP protocol header data configured by the tester; Determining a test type for the test case; If the test type is a traffic request type, the request header data of the test case is read, and an execution request is sent to the client so that the client executes the test case, and the execution request carries the request header data, wherein the client sends the request traffic which is forwarded to the server via the system under test, and receives the data to be verified which is returned by the server in the form of a payload; Acquire the data to be verified, where the data to be verified includes the response data of the server and the header data in the traffic received by the server; Based on the header data in the data to be verified and the header data in the request traffic, it is analyzed whether the header data is lost or tampered with before and after the proxy of the system under test, and a first test result is generated.

2. The automated testing method according to claim 1, characterized in that: The generating of test cases based on the HTTP protocol header information configured by the tester includes: Receive known HTTP protocol header data configured by the tester, and generate a test case according to the known HTTP protocol header data; or, Receiving custom header data configured by a tester, and generating a test case according to the custom header data; or, Receive multiple header data configured by a tester, and generate test cases according to the multiple header data.

3. The automated testing method according to claim 1, characterized in that: Determining the test type of the test case includes: Determine the label type in the test case; When the tag type is a request tag, determining that the test type of the test case is a traffic request type; or, When the tag type is a response tag, it is determined that the test type of the test case is a flow response type.

4. The automated testing method according to claim 1, characterized in that: The client sends a request flow which is forwarded to the server through the system under test. After the server generates the data to be verified, the server further includes: The data to be verified is encrypted to generate encrypted data, and the encrypted data is sent to the system under test.

5. The automated testing method according to claim 1, characterized in that: The automated testing method further comprises: Based on the access logs of the tested system after it is actually online, analyzing the unknown header data customized by real users; The automated testing method is re-executed based on the unknown header data.

6. The automated testing method according to claim 5, characterized in that: The step of analyzing the unknown header data defined by real users based on the access logs of the tested system after it is actually online includes: Obtaining access logs after the system under test is actually online; Determine whether the header data appearing in the access log is in the known header name list; if the header data appearing in the access log does not exist in the known header name list, it is deemed that an unknown header appears; Add the name of the unknown header to the known header name list, and record the value corresponding to the unknown header.

7. The automated testing method according to claim 1, characterized in that: The automated testing method further comprises: If the test type is a flow response type, reading the response header data in the test case; pre-configuring the server based on the response header data; Sending an execution request to the client, the execution request carrying the response header data, wherein the request traffic sent by the client is forwarded to the server via the system under test, and receiving the data to be verified returned by the server in the original path; Acquire the data to be verified, wherein the data to be verified includes the header data of the response header data pre-configured by the server after being forwarded by the system under test; According to the header data in the data to be verified and the pre-configured response header data, it is analyzed whether the header data of the system under test is lost or tampered with before and after the proxy, and a second test result is generated.

8. The automated testing method according to claim 1, characterized in that: The automated testing method further comprises: Before testing the current test case, configuring the system under test; and, After the current test case is tested, the current configuration of the system under test is deleted.

9. An automated testing system, characterized in that: The automated testing system comprises: Test case generation module, used to generate test cases based on HTTP protocol header data configured by testers; A test type determination module, used to determine the test type of the test case; The first processing module is used for reading the request header data of the test case if the test type is a traffic request type, and sending an execution request to the client so that the client executes the test case, wherein the execution request carries the request header data, wherein the client sends the request traffic which is forwarded to the server via the system under test, and receives the data to be verified which is returned by the server in the form of a payload; A first acquisition module is used to acquire the data to be verified, wherein the data to be verified includes response data of the server and header data in traffic received by the server; The first analysis module is used to analyze whether the header data of the system under test is lost or tampered with before and after the proxy according to the header data in the data to be verified and the header data in the request flow, and generate a first test result.

10. The automated testing system according to claim 9, characterized in that: The automated testing system further comprises: A second processing module, configured to read the response header data in the test case if the test type is a flow response type; A data configuration module, used for pre-configuring the server based on the response header data; The second processing module is further used to send an execution request to the client, the execution request carries the response header data, wherein the request traffic sent by the client is forwarded to the server via the system under test, and receives the data to be verified returned by the server in the original path; A second acquisition module is used to acquire the data to be verified, wherein the data to be verified includes the header data of the response header data pre-configured by the server after being forwarded by the system under test; The second analysis module is used to analyze whether the header data of the system under test is lost or tampered with before and after the proxy according to the header data in the data to be verified and the pre-configured response header data, and generate a second test result.

Citation Information

Patent Citations

  • Message processing method and message processing device

    CN103078720A

  • Bug detection method, device and equipment

    CN111294345A