Application software testing method and device, electronic equipment and computer storage medium

Through the middleman proxy server and Markov model mutation technology, the network communication traffic of mobile application software is intercepted and mutated, and automated test scripts are generated, which solves the problem of low efficiency of existing testing methods and significantly improves test coverage and defect discovery rate.

CN118550820APending Publication Date: 2024-08-27HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410598359.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-14
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

The existing mobile application software testing methods are inefficient, and the system limitations and random fuzzy mutation use cases are huge, resulting in insufficient coverage and defect discovery rate.

Method used

Intercept network communication traffic through a middleman proxy server, generate target format files, use Markov models to mutate request and response data, write automated test scripts, monitor the running logs of the software to be tested in real time, and generate test reports.

Benefits of technology

Significantly improves test coverage and defect discovery rate, improves testing efficiency, and reduces redundant and invalid test cases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550820A
    Figure CN118550820A
Patent Text Reader

Abstract

The invention provides an application software testing method and device, electronic equipment and a computer storage medium, and the method comprises the steps: intercepting network communication flow through a man-in-the-middle proxy server when to-be-tested software is operated on a mobile terminal, and generating a first target format file; performing data variation on the request body and the response body of the first target format file to obtain a second target format file; then, according to the abnormal test case of the variation data and the conventional test case of the normal data, compiling an automatic test script; wherein the abnormal test case of the variation data is generated through a second target format file; deploying a real machine test environment and executing an automatic test script, and monitoring a running log of the to-be-tested software in real time; and after the test is finished, generating a test report of the to-be-tested software according to the running log of the to-be-tested software in the test process. Therefore, the coverage and the defect discovery rate of the test are obviously improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a testing method, device, electronic equipment and computer storage medium for application software. Background Art

[0002] In the field of mobile application software (Application, APP), stability can be understood as the ability of the client to continue to operate normally when the APP encounters abnormal environment or input during operation.

[0003] At present, many APP stability tests are based on the APP interface using tools such as Monkey to perform long-term random click operations on the APP user interface (UI), or manually input abnormal data on the App for testing, or perform random mutation or fuzzy testing on the interface data. The above methods either have system limitations or a huge number of random fuzzy mutation use cases, and low execution efficiency. Summary of the invention

[0004] In view of this, the present application provides a testing method, device, electronic device and computer storage medium for application software, which effectively improve the testing coverage and defect detection rate.

[0005] The first aspect of the present application provides a method for testing application software, comprising:

[0006] When operating the software to be tested on the mobile terminal, the network communication traffic is intercepted by the middleman proxy server, and a first target format file is generated; wherein the middleman proxy server and the mobile terminal are connected to the same local area network; the first target format file includes request information and response information; the request information includes a request body; the response information includes a response body;

[0007] For each first target format file, perform data mutation on the request body and response body of the first target format file to obtain a second target format file; wherein the second target format file includes mutation request information and mutation response information; the mutation request information includes a mutation request body; the mutation response information includes a mutation response body;

[0008] Writing an automated test script based on the abnormal test cases of the mutated data and the conventional test cases of the normal data; wherein the abnormal test cases of the mutated data are generated through the second target format file;

[0009] Deploy a real machine test environment and execute the automated test script, and monitor the running log of the software to be tested in real time;

[0010] After the test is completed, a test report of the software to be tested is generated according to the running log of the software to be tested during the test process.

[0011] Optionally, for each first target format file, performing data mutation on a request body and a response body of the first target format file to obtain a second target format file includes:

[0012] For each first target format file, format the first target format file to obtain a character string sequence;

[0013] Input the string sequence into a data mutation model, and output mutation request information and mutation response information; wherein the data mutation model is obtained by training a Markov model through a sample data set; the sample data set includes a sample request body and a sample response body;

[0014] A second target format file is generated according to the mutation request information and the mutation response information.

[0015] Optionally, the method for constructing the data variation model includes:

[0016] Constructing a sample data set; wherein the sample data set includes a sample request body and a sample response body;

[0017] Formatting the sample request body and the sample response body to obtain a sample character string sequence;

[0018] Inputting the sample character string sequence into a Markov model for training to obtain a mutated sample request body and a mutated sample response body;

[0019] Inputting the mutated sample request body and the mutated sample response body into a real system for execution to obtain an operating state of the real system;

[0020] evaluating the mutation quality of the mutated sample request body and the mutated sample response body according to the operating state of the real system to obtain a mutation quality evaluation result;

[0021] The parameters of the Markov model are optimized according to the variation quality assessment result until the variation quality assessment result meets the preset variation quality, and the Markov model is used as the data variation model.

[0022] Optionally, after inputting the sample character string sequence into a Markov model for training to obtain a mutated sample request body and a mutated sample response body, the method further includes:

[0023] Determining whether the mutated sample request body and the mutated sample response body meet preset constraint conditions;

[0024] If it is determined that the mutated sample request body and the mutated sample response body satisfy the preset constraint condition, the step of inputting the mutated sample request body and the mutated sample response body into the real system for execution to obtain the operating state of the real system is executed;

[0025] If it is determined that the mutated sample request body and the mutated sample response body do not satisfy the preset constraint conditions, the parameters of the Markov model are optimized.

[0026] Optionally, after the test is completed, a test report of the software to be tested is generated according to the running log of the software to be tested during the test process, including:

[0027] After the test is completed, the operation log is parsed to obtain abnormal log entries;

[0028] Obtain the request and response information recorded in the middleman proxy server;

[0029] Associating the request information and response information recorded in the middleman proxy server with the abnormal log entry to obtain the request information and response information corresponding to the abnormal log entry;

[0030] A test report of the software to be tested is generated based on the request information and response information corresponding to all the abnormal log entries.

[0031] A second aspect of the present application provides a testing device for application software, comprising:

[0032] The interception unit is used to intercept network communication traffic through a middleman proxy server when operating the software to be tested on the mobile terminal, and generate a first target format file; wherein the middleman proxy server and the mobile terminal are connected to the same local area network; the first target format file includes request information and response information; the request information includes a request body; the response information includes a response body;

[0033] a data mutation unit, configured to perform data mutation on a request body and a response body of each first target format file to obtain a second target format file; wherein the second target format file includes mutation request information and mutation response information; the mutation request information includes a mutation request body; and the mutation response information includes a mutation response body;

[0034] A writing unit, used for writing an automated test script according to abnormal test cases of mutated data and conventional test cases of normal data; wherein the abnormal test cases of mutated data are generated by a second target format file;

[0035] The testing unit is used to deploy a real machine testing environment and execute the automated testing script, and monitor the running log of the software to be tested in real time;

[0036] The first generating unit is used to generate a test report of the software to be tested according to the running log of the software to be tested during the test process after the test is completed.

[0037] Optionally, the data variation unit includes:

[0038] A first preprocessing unit, configured to format each first target format file to obtain a character string sequence;

[0039] A first input unit is used to input the string sequence into a data mutation model, and output mutation request information and mutation response information; wherein the data mutation model is obtained by training a Markov model through a sample data set; the sample data set includes a sample request body and a sample response body;

[0040] The second generating unit is configured to generate a second target format file according to the mutation request information and the mutation response information.

[0041] Optionally, the construction unit of the data variation model includes:

[0042] A sample data set construction unit, used to construct a sample data set; wherein the sample data set includes a sample request body and a sample response body;

[0043] A second preprocessing unit, configured to format the sample request body and the sample response body to obtain a sample character string sequence;

[0044] A second input unit is used to input the sample string sequence into the Markov model for training to obtain a mutated sample request body and a mutated sample response body;

[0045] a third input unit, configured to input the mutated sample request body and the mutated sample response body into a real system for execution, so as to obtain an operating state of the real system;

[0046] An evaluation unit, configured to evaluate the mutation quality of the mutated sample request body and the mutated sample response body according to the operating state of the real system, and obtain a mutation quality evaluation result;

[0047] The first optimization unit is used to optimize the parameters of the Markov model according to the variation quality evaluation result until the variation quality evaluation result meets the preset variation quality, and use the Markov model as the data variation model.

[0048] Optionally, the testing device for the application software further includes:

[0049] A judging unit, configured to judge whether the mutated sample request body and the mutated sample response body satisfy a preset constraint condition;

[0050] an activation unit, configured to activate a third input unit to input the mutated sample request body and the mutated sample response body into a real system for execution, if the judgment unit judges that the mutated sample request body and the mutated sample response body meet a preset constraint condition, so as to obtain an operating state of the real system;

[0051] The second optimization unit is configured to optimize the parameters of the Markov model if the judgment unit judges that the mutated sample request body and the mutated sample response body do not satisfy the preset constraint conditions.

[0052] Optionally, the first generating unit includes:

[0053] A parsing unit, used to parse the operation log after the test is completed to obtain abnormal log entries;

[0054] An acquisition unit, used to acquire request information and response information recorded in the middleman proxy server;

[0055] an associating unit, used to associate the request information and response information recorded in the middleman proxy server with the abnormal log entry to obtain the request information and response information corresponding to the abnormal log entry;

[0056] The first generating subunit is used to generate a test report of the software to be tested according to the request information and response information corresponding to all the abnormal log entries.

[0057] A third aspect of the present application provides an electronic device, including:

[0058] one or more processors;

[0059] a storage device having one or more programs stored thereon;

[0060] When the one or more programs are executed by the one or more processors, the one or more processors implement the application software testing method as described in any one of the first aspects.

[0061] A fourth aspect of the present application provides a computer storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the test method for application software as described in any one of the first aspects is implemented.

[0062] As can be seen from the above scheme, the present application provides a testing method, device, electronic device and computer storage medium for application software. When operating the software to be tested on the mobile terminal, the method intercepts the network communication traffic through the middleman proxy server, and after generating the first target format file, the request body and response body of the first target format file are mutated to obtain the second target format file; then, according to the abnormal test cases of the mutated data and the conventional test cases of the normal data, an automated test script is written; wherein the abnormal test cases of the mutated data are generated through the second target format file; a real machine test environment is deployed and the automated test script is executed to monitor the running log of the software to be tested in real time; after the test is completed, a test report of the software to be tested is generated according to the running log of the software to be tested during the test process. This significantly improves the coverage of the test and the defect detection rate. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0064] Figure 1 A specific flow chart of a method for testing application software provided in an embodiment of the present application;

[0065] Figure 2 A flowchart of a data mutation method provided in another embodiment of the present application;

[0066] Figure 3 A flowchart of a method for constructing a data variation model provided in another embodiment of the present application;

[0067] Figure 4 A flowchart of a method for generating a test report for software to be tested provided in another embodiment of the present application;

[0068] Figure 5 An overall framework diagram of a testing method for application software provided in another embodiment of the present application;

[0069] Figure 6 A schematic diagram of a testing device for application software provided in another embodiment of the present application;

[0070] Figure 7 A schematic diagram of an electronic device for implementing a method for testing application software provided in another embodiment of the present application. DETAILED DESCRIPTION

[0071] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0072] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0073] It should be noted that the information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0074] It should be noted that the concepts such as "first" and "second" mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0075] It should be noted that the modifications of "one" and "plurality" mentioned in the present application are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0076] The present application embodiment provides a method for testing application software, such as Figure 1 As shown, the specific steps include:

[0077] S101. When operating the software to be tested on the mobile terminal, network communication traffic is intercepted through a middleman proxy server, and a first target format file is generated.

[0078] The middleman proxy server and the mobile terminal are connected to the same local area network; the first target format file includes request information and response information; the request information includes a request body; and the response information includes a response body.

[0079] It should be noted that in the specific implementation process of this application, MitmProxy can be used but not limited to as the middleman proxy server, which is not limited here. The first target format can be but not limited to HAR (HTTP Archive), which is also not limited here.

[0080] MitmProxy is an open source interactive command line proxy tool developed based on Python, which is mainly used for intercepting, monitoring, modifying and replaying HTTP traffic. It can be used as a middleman proxy to analyze HTTP / HTTPS communications between clients and servers, and can also be used to intercept and modify these communication traffic.

[0081] HAR file is a file format used to record the communication details between web browsers and web servers. It provides a standardized way to capture and record HTTP request and response data. HAR files mainly contain request information (Request) and response information (Response). Request information: includes request method (GET, POST, etc.), request URL, request header (Headers), request body (Body) and other information. Response information: includes response status code, response header (Headers), response body (Body) and other information.

[0082] Specifically, in the specific implementation process of this application, after installing MitmProxy, use the command mitmproxy-p xxx (port number) to start the MitmProxy service, connect the mobile terminal to the same LAN as MitmProxy, configure the server IP + port number on the mobile terminal, open the mobile terminal browser and enter the address for downloading the MitmProxy certificate: mitm.it, download the corresponding certificate according to the mobile terminal system type, and then install the certificate on the device. Then, create a Python file such as script.py through the Python script customization rules to write proxy interception rules. For example: If you want to intercept requests for a specified domain name, you can use the flow.request.pretty_host.endswith("example.com") method to intercept, and you can use the flow.request.method == "POST" method to intercept all Post requests. Use the command mitmdump-sscript.py to execute the script proxy interception rule and it will take effect.

[0083] S102: For each first target format file, perform data mutation on the request body and the response body of the first target format file to obtain a second target format file.

[0084] The second target format file includes mutation request information and mutation response information; the mutation request information includes a mutation request body; and the mutation response information includes a mutation response body.

[0085] Optionally, in another embodiment of the present application, an implementation of step S102 is as follows: Figure 2 As shown, including:

[0086] S201: For each first target format file, format the first target format file to obtain a character string sequence.

[0087] For example, to flatten JSON data into a string:

[0088] _name_Alice_age_30_emails_0_alice@test.com_emails_1_alice@example.com_address_street_123Main St_address_city_Anytown_address_codes_0_12345_

[0089] address_codes_1_67890.

[0090] S202: Input the string sequence into the data mutation model, and output mutation request information and mutation response information.

[0091] The data variation model is obtained by training the Markov model through a sample data set; the sample data set includes a sample request body and a sample response body.

[0092] S203: Generate a second target format file according to the mutation request information and the mutation response information.

[0093] The method of generating the second target format file may refer to the above method of generating the first target format file, which will not be described in detail here.

[0094] Optionally, in another embodiment of the present application, an implementation method of a method for constructing a data variation model is as follows: Figure 3 As shown, including:

[0095] S301: Build a sample data set.

[0096] The sample data set includes a sample request body and a sample response body.

[0097] It is understandable that it is necessary to collect enough request and response body samples as training data. The sample request and response bodies in the sample data set can be, but are not limited to, from the HAR file previously intercepted by MitmProxy, including real network request and response data, which is not limited here.

[0098] S302: Format the sample request body and the sample response body to obtain a sample character string sequence.

[0099] S303: Input the sample character string sequence into the Markov model for training to obtain a mutated sample request body and a mutated sample response body.

[0100] The Markov model training process will learn the transition probabilities between characters and obtain the state transition probability matrix. Assuming that a Markov process has N possible states, we use S = {s1, s2, ...s N} represents this state space. Then its state transition probability matrix is ​​an N x N matrix P:

[0101] P=

[0102] |P 11 P 12 ...P 1N |

[0103] |P 21 P 22 ...P 2N |

[0104] |.........|

[0105] |P N1 P N2 ...P NN |

[0106] Where P ij In this process, from state s i Transfer to state s j Probability: P ij =P(X(t+1)=s j |X(t)=si)(1<=i, j<=N).

[0107] Each row of the matrix P is a valid probability distribution, and all elements sum to 1: P 1j +P 2j +...+P Nj =1(1<=j<=N), which ensures that the sum of the probabilities is 1 regardless of the current state.

[0108] In the specific implementation process of this application, independent Markov models can be constructed for the request body and the response body respectively, which is not limited here. Using the trained Markov model, sampling can be performed to generate new variant sequences from the model as the mutated request body and response body. The sampling algorithm uses Monte Carlo Markov chain (MCMC) sampling.

[0109] Since the Markov model is a probabilistic model, the sampled variant sequence may not fully meet the business requirements or format requirements. Therefore, it is necessary to add some preset constraints to control the variant results. In another embodiment of the present application, an implementation method of the application software testing method further includes:

[0110] Determine whether the mutated sample request body and the mutated sample response body meet the preset constraint conditions.

[0111] Among them, the preset constraints include but are not limited to structural constraints (the original JSON data structure must be maintained after mutation), data type constraints (ensuring that the mutated value conforms to the original type), business constraints (mutation cannot violate known business rules), etc., which are not limited here.

[0112] Specifically, if it is determined that the mutated sample request body and the mutated sample response body meet the preset constraints, the mutated sample request body and the mutated sample response body are input into the real system for execution to obtain the operating state step of the real system; if it is determined that the mutated sample request body and the mutated sample response body do not meet the preset constraints, the parameters of the Markov model are optimized.

[0113] S304: Input the mutated sample request body and the mutated sample response body into the real system for execution to obtain the running status of the real system.

[0114] The operating status of the actual system includes, but is not limited to, indicators such as system behavior and code coverage, which are not limited here.

[0115] S305. Evaluate the mutation quality of the mutated sample request body and the mutated sample response body according to the operating state of the real system to obtain a mutation quality evaluation result.

[0116] S306. Optimize the parameters of the Markov model according to the variation quality assessment result until the variation quality assessment result meets the preset variation quality, and use the Markov model as the data variation model.

[0117] S103. Write an automated test script based on the abnormal test cases of the mutated data and the conventional test cases of the normal data.

[0118] The abnormal test cases of the mutated data are generated through the second target format file.

[0119] It can be understood that the abnormal test cases of mutant data are generated by the mutant data generated by the above-mentioned data mutation model. The purpose of using the data mutation model to generate abnormal test cases of mutant data is to generate abnormal test case scenario data more efficiently. The traditional randomly generated abnormal data will be very redundant and contain a lot of invalid data.

[0120] S104. Deploy a real machine test environment and execute automated test scripts to monitor the running log of the software to be tested in real time.

[0121] In the process of executing the automated test script, you can write a Python script har_reader.py to read the HAR file through the interface hijacking module of the middleman proxy server. This script first uses the python-har library to read the HAR file and stores the request and response data in a dictionary. Then, in the request and response functions, find the corresponding data according to the request URL and apply the data to the real-time traffic. Finally, use the MitmProxy command mitmdump-s har_reader.py to execute the script.

[0122] In the specific implementation process of this application, the data mutation model and the interface hijacking module of the middleman proxy server can also be integrated into an automated testing framework. Among them, the automated testing framework can adopt but is not limited to Appium, which is not limited here. Appium is an open source test automation framework that can be used for native, hybrid and mobile web application testing. It uses the WebDriver protocol to drive IOS, Android and Windows applications.

[0123] S105: After the test is completed, a test report of the software to be tested is generated according to the running log of the software to be tested during the test process.

[0124] Continuing with the above example, the log capture function provided by Appium can be used to capture the running log of the software under test in real time during the execution of automated tests, but is not limited to this. The running log includes but is not limited to abnormal information such as crash, ANR, Native Crash, etc., which are not limited here, as well as ordinary log output.

[0125] Optionally, in another embodiment of the present application, an implementation of step S105 is as follows: Figure 4 As shown, including:

[0126] S401. After the test is completed, the operation log is parsed to obtain abnormal log entries.

[0127] In the specific implementation process of this application, the exception log can be distinguished from the ordinary log by, but not limited to, keyword search (such as "Exception", "Crash", etc.) or by using a log parsing library to parse the log format, thereby obtaining the exception log entry, which is not limited here.

[0128] S402: Obtain request information and response information recorded in the middleman proxy server.

[0129] S403: Associating the request information and response information recorded in the middleman proxy server with the abnormal log entry to obtain the request information and response information corresponding to the abnormal log entry.

[0130] Specifically, the request information and response information recorded in the middleman proxy server can be associated with the abnormal log entry through but not limited to identification information such as timestamp and URL to obtain the request information and response information corresponding to the abnormal log entry, which is not limited here.

[0131] S404: Generate a test report for the software to be tested based on the request information and response information corresponding to all abnormal log entries.

[0132] Specifically, for the parsed abnormal log, the corresponding mutated request data and response data are searched according to the associated request identification information, and these mutated data are marked as "abnormal mutated data" that cause the abnormality.

[0133] In the specific implementation process of this application, various abnormal situations detected and their abnormality rates can also be counted, and the variant data samples that cause the abnormality can be output for problem location and repair. This stability test solution is incorporated into the continuous integration process, and stability regression testing is performed before each new version is released to continuously verify and improve the stability and stability of the application software.

[0134] like Figure 5As shown, it is an overall framework diagram of a testing method for application software provided by the present application, including deploying an agent, configuring a mobile terminal, the software to be tested, a testing framework, a data mutation model and a real machine environment. Deploying an agent means deploying a proxy server MitmProxy. Then, after configuring the agent and certificate of the mobile terminal, when operating the software to be tested (APP) on the mobile terminal, the network communication traffic can be intercepted through the middleman proxy server, and then, the data mutation model (mutation generator) is used to mutate the data and generate a second target format file; thereby, during the operation of the software to be tested, the interface data traffic is hijacked through the middleman proxy server and replaced with a test case generated according to the second target format file, the operation log of the software to be tested is monitored in real time, and feedback test results are obtained. After the test is completed, the hijacking behavior of the middleman proxy server is terminated, the proxy configuration is cleaned up, the mobile terminal removes the proxy and certificate, and outputs the test report and mutation data sample for this time.

[0135] As can be seen from the above scheme, the present application provides a testing method for application software. When operating the software to be tested on a mobile terminal, the network communication traffic is intercepted through an intermediary proxy server, and after generating a first target format file, the request body and response body of the first target format file are mutated to obtain a second target format file; then, an automated test script is written based on the abnormal test cases of the mutated data and the conventional test cases of the normal data; wherein the abnormal test cases of the mutated data are generated through the second target format file; a real machine test environment is deployed and the automated test script is executed to monitor the running log of the software to be tested in real time; after the test is completed, a test report of the software to be tested is generated based on the running log of the software to be tested during the test process. This significantly improves the coverage of the test and the defect detection rate.

[0136] The present application embodiment provides a testing device for application software, such as Figure 6 As shown, specifically including:

[0137] The interception unit 601 is used to intercept network communication traffic through a middleman proxy server and generate a first target format file when operating the software to be tested on the mobile terminal.

[0138] The middleman proxy server and the mobile terminal are connected to the same local area network; the first target format file includes request information and response information; the request information includes a request body; and the response information includes a response body.

[0139] The data mutation unit 602 is used to perform data mutation on the request body and the response body of each first target format file to obtain a second target format file.

[0140] The second target format file includes mutation request information and mutation response information; the mutation request information includes a mutation request body; and the mutation response information includes a mutation response body.

[0141] Optionally, in another embodiment of the present application, an implementation of the data variation unit 602 includes:

[0142] The first preprocessing unit is used to format each first target format file to obtain a character string sequence.

[0143] The first input unit is used to input a string sequence into the data mutation model, and output mutation request information and mutation response information.

[0144] The data variation model is obtained by training the Markov model through a sample data set; the sample data set includes a sample request body and a sample response body.

[0145] The second generating unit is used to generate a second target format file according to the mutation request information and the mutation response information.

[0146] For the specific working process of the units disclosed in the above embodiments of the present application, please refer to the corresponding method embodiments, such as Figure 2 As shown, no further description is given here.

[0147] Optionally, in another embodiment of the present application, an implementation of a construction unit of a data variation model includes:

[0148] The sample data set construction unit is used to construct the sample data set.

[0149] The sample data set includes a sample request body and a sample response body.

[0150] The second preprocessing unit is used to format the sample request body and the sample response body to obtain a sample character string sequence.

[0151] The second input unit is used to input the sample character string sequence into the Markov model for training to obtain a mutated sample request body and a mutated sample response body.

[0152] Optionally, in another embodiment of the present application, an implementation of the testing device for application software further includes:

[0153] The judging unit is used to judge whether the mutated sample request body and the mutated sample response body meet the preset constraint conditions.

[0154] The activation unit is used to activate the third input unit to input the mutated sample request body and the mutated sample response body into the real system for execution if the judgment unit judges that the mutated sample request body and the mutated sample response body meet the preset constraint conditions, so as to obtain the operating state of the real system.

[0155] The second optimization unit is configured to optimize the parameters of the Markov model if the judgment unit judges that the mutated sample request body and the mutated sample response body do not satisfy the preset constraint conditions.

[0156] The specific working process of the units disclosed in the above embodiments of the present application can be found in the corresponding method embodiments, which will not be repeated here.

[0157] The third input unit is used to input the mutated sample request body and the mutated sample response body into the real system for execution to obtain the running state of the real system.

[0158] The evaluation unit is used to evaluate the mutation quality of the mutated sample request body and the mutated sample response body according to the operating state of the real system to obtain a mutation quality evaluation result.

[0159] The first optimization unit is used to optimize the parameters of the Markov model according to the variation quality evaluation result until the variation quality evaluation result meets the preset variation quality, and the Markov model is used as the data variation model.

[0160] For the specific working process of the units disclosed in the above embodiments of the present application, please refer to the corresponding method embodiments, such as Figure 3 As shown, no further description is given here.

[0161] The writing unit 603 is used to write an automated test script according to abnormal test cases of mutated data and conventional test cases of normal data.

[0162] The abnormal test cases of the mutated data are generated through the second target format file.

[0163] The testing unit 604 is used to deploy a real machine testing environment and execute automated testing scripts, and monitor the running logs of the software to be tested in real time.

[0164] The first generating unit 605 is used to generate a test report of the software to be tested according to the running log of the software to be tested during the test process after the test is completed.

[0165] For the specific working process of the units disclosed in the above embodiments of the present application, please refer to the corresponding method embodiments, such as Figure 1 As shown, no further description is given here.

[0166] Optionally, in another embodiment of the present application, an implementation of the first generating unit 605 includes:

[0167] The parsing unit is used to parse the running log after the test is completed to obtain abnormal log entries.

[0168] The acquisition unit is used to acquire the request information and response information recorded in the middleman proxy server.

[0169] The association unit is used to associate the request information and response information recorded in the middleman proxy server with the abnormal log entry to obtain the request information and response information corresponding to the abnormal log entry.

[0170] The first generating subunit is used to generate a test report of the software to be tested according to the request information and response information corresponding to all the abnormal log entries.

[0171] For the specific working process of the units disclosed in the above embodiments of the present application, please refer to the corresponding method embodiments, such as Figure 4 As shown, no further description is given here.

[0172] As can be seen from the above scheme, the present application provides a testing device for application software. When the interception unit 601 operates the software to be tested on the mobile terminal, the network communication traffic is intercepted through the middleman proxy server, and after generating the first target format file, the data mutation unit 602 performs data mutation on the request body and response body of the first target format file to obtain the second target format file; thereafter, the writing unit 603 writes an automated test script according to the abnormal test cases of the mutated data and the conventional test cases of the normal data; wherein the abnormal test cases of the mutated data are generated through the second target format file; the testing unit 604 deploys a real machine test environment and executes an automated test script to monitor the running log of the software to be tested in real time; after the test is completed, the first generating unit 605 generates a test report of the software to be tested according to the running log of the software to be tested during the test process. This significantly improves the coverage of the test and the defect discovery rate.

[0173] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0174] Another embodiment of the present application provides an electronic device, such as Figure 7 As shown, including:

[0175] One or more processors 701.

[0176] The storage device 702 stores one or more programs.

[0177] When the one or more programs are executed by the one or more processors 701, the one or more processors 701 implement the test method for application software as described in any one of the above embodiments.

[0178] Another embodiment of the present application provides a computer storage medium on which a computer program is stored, wherein when the computer program is executed by a processor, the test method for application software as described in any one of the above embodiments is implemented.

[0179] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0180] It should be noted that the computer-readable medium mentioned above in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0181] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0182] Another embodiment of the present application provides a computer program product. When the computer program product is executed, it is used to execute any of the above-mentioned application software testing methods.

[0183] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processing device, the above-mentioned functions defined in the method of the embodiment of the present application are executed.

[0184] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

[0185] Although several specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present application. Certain features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination.

[0186] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of application involved in the present application is not limited to the technical solution formed by a 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 above application concept. For example, the above features are replaced with (but not limited to) technical features with similar functions applied in the present application.

Claims

1. A testing method for application software, It is characterized in that include: When operating the software to be tested on the mobile terminal, the network communication traffic is intercepted by the middleman proxy server, and a first target format file is generated; wherein the middleman proxy server and the mobile terminal are connected to the same local area network; the first target format file includes request information and response information; the request information includes a request body; the response information includes a response body; For each first target format file, perform data mutation on the request body and response body of the first target format file to obtain a second target format file; wherein the second target format file includes mutation request information and mutation response information; the mutation request information includes a mutation request body; the mutation response information includes a mutation response body; Writing an automated test script based on the abnormal test cases of the mutated data and the conventional test cases of the normal data; wherein the abnormal test cases of the mutated data are generated through the second target format file; Deploy a real machine test environment and execute the automated test script, and monitor the running log of the software to be tested in real time; After the test is completed, a test report of the software to be tested is generated according to the running log of the software to be tested during the test process.

2. The method for testing application software according to claim 1, It is characterized in that The step of performing data mutation on the request body and the response body of each first target format file to obtain a second target format file includes: For each first target format file, format the first target format file to obtain a character string sequence; Input the string sequence into a data mutation model, and output mutation request information and mutation response information; wherein the data mutation model is obtained by training a Markov model through a sample data set; the sample data set includes a sample request body and a sample response body; A second target format file is generated according to the mutation request information and the mutation response information.

3. The method for testing application software according to claim 2, It is characterized in that The method for constructing the data variation model includes: Constructing a sample data set; wherein the sample data set includes a sample request body and a sample response body; Formatting the sample request body and the sample response body to obtain a sample character string sequence; Inputting the sample character string sequence into a Markov model for training to obtain a mutated sample request body and a mutated sample response body; Inputting the mutated sample request body and the mutated sample response body into a real system for execution to obtain an operating state of the real system; evaluating the mutation quality of the mutated sample request body and the mutated sample response body according to the operating state of the real system to obtain a mutation quality evaluation result; The parameters of the Markov model are optimized according to the variation quality assessment result until the variation quality assessment result meets the preset variation quality, and the Markov model is used as the data variation model.

4. The method for testing application software according to claim 3, It is characterized in that After the sample character string sequence is input into the Markov model for training to obtain a mutated sample request body and a mutated sample response body, the method further includes: Determining whether the mutated sample request body and the mutated sample response body meet preset constraint conditions; If it is determined that the mutated sample request body and the mutated sample response body satisfy the preset constraint condition, the step of inputting the mutated sample request body and the mutated sample response body into the real system for execution to obtain the operating state of the real system is executed; If it is determined that the mutated sample request body and the mutated sample response body do not satisfy the preset constraint conditions, the parameters of the Markov model are optimized.

5. The method for testing application software according to claim 1, It is characterized in that After the test is completed, a test report of the software to be tested is generated according to the running log of the software to be tested during the test process, including: After the test is completed, the operation log is parsed to obtain abnormal log entries; Obtain the request and response information recorded in the middleman proxy server; Associating the request information and response information recorded in the middleman proxy server with the abnormal log entry to obtain the request information and response information corresponding to the abnormal log entry; A test report of the software to be tested is generated based on the request information and response information corresponding to all the abnormal log entries.

6. A testing device for application software, It is characterized in that include: The interception unit is used to intercept network communication traffic through a middleman proxy server when operating the software to be tested on the mobile terminal, and generate a first target format file; wherein the middleman proxy server and the mobile terminal are connected to the same local area network; the first target format file includes request information and response information; the request information includes a request body; the response information includes a response body; a data mutation unit, configured to perform data mutation on a request body and a response body of each first target format file to obtain a second target format file; wherein the second target format file includes mutation request information and mutation response information; the mutation request information includes a mutation request body; and the mutation response information includes a mutation response body; A writing unit, used for writing an automated test script according to abnormal test cases of mutated data and conventional test cases of normal data; wherein the abnormal test cases of mutated data are generated by a second target format file; The testing unit is used to deploy a real machine testing environment and execute the automated testing script, and monitor the running log of the software to be tested in real time; The first generating unit is used to generate a test report of the software to be tested according to the running log of the software to be tested during the test process after the test is completed.

7. The application software testing device according to claim 6, It is characterized in that The data variation unit comprises: A first preprocessing unit, configured to format each first target format file to obtain a character string sequence; A first input unit is used to input the string sequence into a data mutation model, and output mutation request information and mutation response information; wherein the data mutation model is obtained by training a Markov model through a sample data set; the sample data set includes a sample request body and a sample response body; The second generating unit is configured to generate a second target format file according to the mutation request information and the mutation response information.

8. The application software testing device according to claim 7, It is characterized in that The construction unit of the data variation model includes: A sample data set construction unit, used to construct a sample data set; wherein the sample data set includes a sample request body and a sample response body; A second preprocessing unit, configured to format the sample request body and the sample response body to obtain a sample character string sequence; A second input unit is used to input the sample string sequence into the Markov model for training to obtain a mutated sample request body and a mutated sample response body; a third input unit, configured to input the mutated sample request body and the mutated sample response body into a real system for execution, so as to obtain an operating state of the real system; An evaluation unit, configured to evaluate the mutation quality of the mutated sample request body and the mutated sample response body according to the operating state of the real system, and obtain a mutation quality evaluation result; The first optimization unit is used to optimize the parameters of the Markov model according to the variation quality evaluation result until the variation quality evaluation result meets the preset variation quality, and use the Markov model as the data variation model.

9. An electronic device, It is characterized in that include: one or more processors; a storage device having one or more programs stored thereon; When the one or more programs are executed by the one or more processors, the one or more processors implement the application software testing method according to any one of claims 1 to 5.

10. A computer storage medium, It is characterized in that A computer program is stored thereon, wherein when the computer program is executed by a processor, the test method for application software as claimed in any one of claims 1 to 5 is implemented.