Stress testing methods, devices, equipment, media and program products
By obtaining stress testing instructions and test scripts in the database, the stress testing scripts are automatically generated, which solves the cumbersome problems of stress testing in the existing technology and improves the testing efficiency and automation level.
Patent Information
- Application Number
- CN202210321966.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-30
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2042-03-30
AI Technical Summary
The existing stress testing process is cumbersome and the degree of automation is low. Testers need to manually fill in the information of the pressure testing element table, resulting in inefficient testing.
By obtaining stress test instructions, determining the target test script from the database based on the test script identification, and executing it at a specified time, generating test results, and generating multiple test scripts using recorded functional test parameters and preset methods to achieve automated stress test preparation.
Simplifies the testing process, improves testing efficiency, provides a data cornerstone for automated stress testing, reduces manual operations, and improves test asset accumulation.
Smart Images

Figure CN114691506B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a stress testing method, apparatus, device, medium, and program product. Background Art
[0002] Stress testing has gradually become an essential stability and high-availability testing process for mainstream internet companies and large commercial banks. Unlike standard functional testing, which can be performed by simply clicking on a functional testing page to verify relevant functionality, stress testing requires a complex process: collecting stress testing interface information, filtering, extracting parameters, constructing stress testing scripts, and generating stress testing tasks.
[0003] When carrying out stress testing tasks in existing technologies, testers need to manually extract parameters, combine parameters, and create parameters. However, existing technologies have the problems of cumbersome testing and low automation. Summary of the Invention
[0004] Based on this, it is necessary to provide a stress testing method, device, equipment, medium and program product that can simplify the testing process and improve the degree of automation to address the above technical problems.
[0005] In a first aspect, the present application provides a stress testing method. The method comprises:
[0006] Obtain stress test instructions; stress test instructions include test script identifier and test execution time;
[0007] Determining a corresponding target test script from a preset database based on the test script identifier; wherein the database stores a plurality of test script identifiers and corresponding test scripts, wherein the plurality of test scripts are generated based on functional test parameters recorded during the functional test process and a preset test script generation method;
[0008] Execute the target test script at the test execution time to obtain the test results.
[0009] In one embodiment, a method for generating multiple test scripts includes:
[0010] The functional test parameters are expanded according to the test script generation method to obtain a plurality of stress test parameters, and the plurality of stress test parameters are converted into script format data to obtain a plurality of test scripts.
[0011] In one embodiment, data expansion processing is performed on the functional test parameters according to the test script generation method to obtain multiple stress test parameters, including:
[0012] Perform format conversion on each functional test parameter to obtain multiple data sequences in the target format;
[0013] Perform fuzzy testing on the initial parameter type and initial parameter length of each data sequence to determine the true parameter type and target parameter length range of each data sequence;
[0014] According to the actual parameter type and target parameter length range of each data sequence, multiple stress test parameters that meet the actual parameter type and target parameter length range of each data sequence are randomly generated.
[0015] In one embodiment, the initial parameter type and initial parameter length of each data sequence are fuzzy tested to determine the actual parameter type and target parameter length range of each data sequence, including:
[0016] Use the preset traversal algorithm to traverse each data sequence to obtain the initial data structure template;
[0017] According to the initial parameter length and initial parameter type of each data sequence, a preset number of random parameters are randomly generated and filled into the initial data structure template;
[0018] Perform fuzzy testing on the initial parameter type of each random parameter in the initial data structure template to determine the true parameter type of each data sequence;
[0019] Perform fuzzy testing on the parameter length of each random parameter in the initial data structure template to determine the target parameter length range of each data sequence.
[0020] In one embodiment, multiple stress test parameters are converted into script format data to obtain multiple test scripts, including:
[0021] Convert each stress test parameter into script format data to obtain reference script data for each stress test parameter;
[0022] The reference script data of each stress test parameter is input into a preset standard paradigm script generation template to obtain multiple test scripts.
[0023] In one embodiment, the stress testing method further includes:
[0024] Receive a recording instruction sent by the test terminal; the recording instruction includes a preset parameter identifier required for the stress test;
[0025] During the functional test, the functional test parameters corresponding to the parameter identifiers are stored according to the recording instructions.
[0026] In one embodiment, the stress testing method further includes:
[0027] When a test script generation instruction for a stress test is received from a test terminal, a step of generating multiple test scripts is executed according to the functional test parameters recorded during the functional test and a preset test script generation method.
[0028] In a second aspect, the present application also provides a pressure testing device. The device includes:
[0029] An acquisition module is used to obtain stress test instructions; the stress test instructions include a test script identifier and a test execution time;
[0030] A retrieval module is used to determine a corresponding target test script from a preset database based on a test script identifier; wherein the database stores a plurality of test script identifiers and corresponding test scripts, wherein the plurality of test scripts are generated based on functional test parameters recorded during a functional test process and a preset test script generation method;
[0031] The execution module is used to execute the target test script at the test execution time to obtain the test results.
[0032] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method in any one of the embodiments of the first aspect.
[0033] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method in any one of the embodiments of the first aspect.
[0034] In a fifth aspect, the present application further provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the method in any one of the embodiments of the first aspect.
[0035] The above-mentioned stress testing method, apparatus, equipment, medium and program product obtain stress testing instructions including a test script identifier and a test execution time; determine the corresponding target test script from a preset database storing multiple test script identifiers and corresponding test scripts according to the test script identifier, execute the target test script at the test execution time, and obtain the test results; wherein, multiple test scripts are generated according to the functional test parameters recorded during the functional test process and the preset test script generation method, and can independently realize a set of automated systems for interface positioning, data preparation, and stress testing tasks for testers before stress testing based on the multiple test scripts generated by the recorded functional test parameters. It solves the problem that in traditional manual testing, data relies on developers and testers to manually complete a series of information filling in the stress testing element table. It provides a data foundation for automated stress testing and test asset accumulation, simplifies the testing process, and improves testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 This is an application environment diagram of a stress testing method in one embodiment;
[0037] Figure 2 1 is a flow chart of a pressure testing method according to an embodiment;
[0038] Figure 3 A schematic flow chart of a pressure testing method according to another embodiment;
[0039] Figure 4 A schematic flow chart of a pressure testing method according to another embodiment;
[0040] Figure 5 A schematic flow chart of a pressure testing method according to another embodiment;
[0041] Figure 6 A schematic flow chart of a pressure testing method according to another embodiment;
[0042] Figure 7 is a structural block diagram of a pressure testing device in one embodiment;
[0043] Figure 8 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0045] With the continuous development of the internet, stability testing is becoming increasingly important. Stress testing, in particular, has become an essential stability and high-availability testing process for mainstream internet companies and large commercial banks. Unlike standard functional testing, which simply verifies functionality by clicking on page functions, stress testing requires a complex process involving stress testing interface information collection, screening, parameter extraction, stress testing script construction, and stress testing task generation. However, there is currently no unified, automated task pipeline or stress testing data generation pipeline for stress testing. Faced with this situation, developers typically provide testers with a comprehensive stress testing element table, which specifies all stress testing configuration and interface information. Testers then manually enter this information into the stress testing platform based on the form provided by the developer and directly generate stress testing tasks.
[0046] The pressure testing method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The server receives the stress test instruction sent by the user through the terminal, and determines the target test script among the multiple test scripts pre-stored in the database according to the stress test instruction, and executes the target test script to obtain the test result. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented as an independent server or a server cluster consisting of multiple servers.
[0047] In one embodiment, Figure 2 As shown, a stress test method is provided, which is applied to Figure 1 The following steps are used as an example to illustrate the server in the example:
[0048] S202, obtaining a stress test instruction; the stress test instruction includes a test script identifier and a test execution time.
[0049] The stress test instruction is triggered by the tester based on the terminal's test page and is used to instruct the test to proceed. The stress test instruction may also include other information from the stress test element table, such as concurrency, concurrency time, number of executions, test objectives, test tasks, and test executors. Stress testing, also known as light testing, involves subjecting the entire system to a specific extreme scenario, using high system load, long duration, and multiple requests to test the software's availability, stability, and reliability.
[0050] Specifically, when a stress test instruction triggered by a tester based on a terminal is received, the stress test instruction is obtained. The stress test instruction includes a test script identifier and a test execution time. Optionally, the stress test instruction may also include a tester identifier, a test project name, a test result storage address, etc., which are not limited here.
[0051] S204, determining the corresponding target test script from a preset database according to the test script identifier; wherein the database stores multiple test script identifiers and corresponding test scripts, and the multiple test scripts are generated according to the functional test parameters recorded during the functional test process and the preset test script generation method.
[0052] Among them, the recorded functional test parameters may include the information characteristics of the target test interface required by the tester, which may be the characteristics of the URL, the characteristics of the request parameters, the characteristics of the response, the characteristics of the request header, etc., which are not limited here. The functional test parameters may include the request information of the functional test initiated by the tester on the target service based on the terminal and the response request of the target service response. The target test script is a stress test script, which can be the actual operation logic of the stress test task, which includes information such as how to connect, how to splice parameters, which parameters to splice, and the execution environment parameter configuration. The script can be used to directly request the target machine.
[0053] Specifically, after obtaining the stress test instruction, a search can be performed in a preset database among multiple test scripts based on the test script identifier in the stress test instruction to find the corresponding test script identifier and the test script corresponding to the test script identifier, thereby obtaining the target test script. Among them, the multiple test scripts are recorded in the process of functional testing using a recording tool to record the required functional test parameters, and multiple test versions are generated according to a preset test script generation method. Optionally, the recording tool may include a goreplay recording tool.
[0054] Furthermore, it is preset that the script generation method may include analyzing and processing the recorded functional test parameters, generating multiple random intermediate test parameters based on the functional test parameters according to the preset data expansion rules, and performing fuzzy testing on each intermediate test parameter. When the fuzzy test passes, multiple stress test parameters are determined to achieve data expansion processing. After completing the data expansion processing, each stress test parameter is converted into script format data, and then corresponding multiple test scripts can be generated based on each script format data and the preset standard paradigm script generation template. The preset script generation method may also be to directly convert the format of the functional test parameters after obtaining the functional test parameters to obtain script format data. Based on each script format data and the preset standard paradigm script generation template, corresponding multiple test scripts are generated, and each script format data can be substituted into the preset standard paradigm script generation template to obtain corresponding multiple test scripts, which is not limited here. Among them, the preset data expansion rules may include data length expansion and / or data type expansion.
[0055] Optionally, generating corresponding multiple test scripts based on each script format data and a preset standard paradigm script generation template may include substituting each script format data into the standard paradigm script generation template, generating multiple corresponding test scripts, and uploading and saving them in a database.
[0056] S206, executing the target test script at the test execution time to obtain the test result.
[0057] The test execution time may include the time when the stress test instruction is received, or the preset target execution time.
[0058] Specifically, once the target test script is determined, the target test script can be executed when the test execution time arrives, and the test results are generated after execution is completed. Optionally, upon receiving a test script generation instruction for a stress test sent by the test terminal, the step of generating multiple test scripts based on the functional test parameters recorded during the functional test process and a preset test script generation method is executed.
[0059] In the above stress testing method, a stress testing instruction including a test script identifier and a test execution time is obtained; the corresponding target test script is determined from a preset database storing multiple test script identifiers and corresponding test scripts according to the test script identifier, and the target test script is executed at the test execution time to obtain the test result; wherein, multiple test scripts are generated according to the functional test parameters recorded during the functional test process and the preset test script generation method, and a set of automated systems for interface positioning, data preparation, and stress testing tasks before stress testing can be independently implemented based on the multiple test scripts generated by the recorded functional test parameters. This solves the problem that in traditional manual testing, data relies on developers and testers to manually complete a series of information filling in the stress testing element table. It provides a data foundation for automated stress testing and test asset accumulation, simplifies the testing process, and improves testing efficiency.
[0060] The above embodiment describes the stress testing method, which mainly relies on test scripts stored in a database. Now, an embodiment is used to describe how to generate test scripts. In one embodiment, the generation method of multiple test scripts includes:
[0061] The functional test parameters are expanded according to the test script generation method to obtain a plurality of stress test parameters, and the plurality of stress test parameters are converted into script format data to obtain a plurality of test scripts.
[0062] Specifically, after obtaining the functional test parameters, the initial data parameter type and initial parameter data length of the functional test parameters can be determined. Based on the initial data parameter type and / or initial parameter data length, data expansion processing can be performed to obtain multiple stress test parameters. The stress test parameters are not in script format and therefore need to be formatted. After being converted into script format data, multiple test scripts can be generated based on each script format data.
[0063] Furthermore, in one embodiment, Figure 3 As shown, the functional test parameters are expanded according to the test script generation method to obtain multiple stress test parameters, including:
[0064] S302: Convert the format of each functional test parameter to obtain multiple data sequences in a target format.
[0065] The target format may include json format.
[0066] Specifically, because the data format of functional test parameters differs from the format of parameters required for stress testing, each functional test parameter must first be formatted to obtain multiple data sequences in the target format. This format conversion can include using a serializer to directly convert functional test parameters in XML, character strings, binary arrays, and other formats into JSON-formatted data sequences. If the serializer is unable to directly format the functional test parameters, semantic parsing can be used to parse the HTTP parameter strings to obtain multiple data sequences.
[0067] S304: Perform fuzzy testing on the initial parameter type and initial parameter length of each data sequence to determine the actual parameter type and target parameter length range of each data sequence.
[0068] Specifically, the data structures of multiple data sequences are analyzed to obtain the initial parameter type and initial parameter length of each data sequence. A preset traversal algorithm is then used to traverse each data sequence to obtain an initial data structure template. Based on the initial parameter type and initial parameter length of each data sequence, the length or type of the corresponding data sequence is randomly transformed to obtain multiple random parameters. Each random parameter is then substituted into the initial data structure template and fuzzy tested to determine its true parameter type and target parameter length range. For example, a deep traversal algorithm (DFS algorithm) can be used to traverse each data sequence to obtain an initial data structure template; based on the initial parameter type and initial length of each data sequence, a plurality of random parameters are randomly generated and filled into the data structure template; the initial parameter type of the random parameter corresponding to each data sequence is processed by fuzzy testing (which can also be a sniffing or approximation algorithm) to determine the true parameter type of each data sequence; the initial length of the random parameter corresponding to each data sequence is obtained, and the initial length of the random parameter corresponding to each data sequence is changed to obtain new random parameters of different lengths of the random parameters corresponding to each data sequence, and the length of each new random parameter is verified by fuzzy testing to determine the target length range of each data sequence. Among them, the initial data structure template includes the initial keywords, initial parameter types, initial parameter levels, etc. corresponding to each data sequence. For example, in the data structure template, the initial sniffing type of the random parameter in the structure is first generated based on the initial parameter type. If the original is a number, it is considered to be int type data, and if it is a long number, it is considered to be a string.
[0069] S306 , randomly generating a plurality of stress test parameters that meet the actual parameter type and target parameter length range of each data sequence according to the actual parameter type and target parameter length range of each data sequence.
[0070] Specifically, after obtaining the actual parameter type and target parameter length range of each data sequence, multiple stress test parameters that meet the actual parameter type and target parameter length range of each data sequence can be randomly generated.
[0071] Optionally, after obtaining the actual parameter type and target parameter length range of each data sequence, multiple stress test parameters that meet the actual parameter type, target parameter length range and parameter structure of each data sequence can be randomly generated.
[0072] In this embodiment, by converting the format of each functional test parameter to obtain multiple data sequences in the target format, the initial parameter type and initial parameter length of each data sequence are fuzzy tested to determine the actual parameter type and target parameter length range of each data sequence. Based on the actual parameter type and target parameter length range of each data sequence, multiple stress test parameters that meet the actual parameter type and target parameter length range of each data sequence are randomly generated. After analyzing and processing each functional test parameter, data expansion processing can be performed to obtain multiple stress test parameters that meet the actual conditions, thereby achieving accurate stress testing and providing data support for stress testing. Moreover, there is no need for manual input of functional test parameters, and data expansion based on experience is performed, thereby enhancing test automation and improving the efficiency of test script generation.
[0073] Furthermore, in one embodiment, Figure 4 As shown, the initial parameter type and initial parameter length of each data sequence are fuzzy tested to determine the true parameter type and target parameter length range of each data sequence, including:
[0074] S402: traverse each data sequence using a preset traversal algorithm to obtain an initial data structure template.
[0075] S404: randomly generate a preset number of random parameters according to the initial parameter length and initial parameter type of each data sequence and fill them into the initial data structure template.
[0076] S406: Perform fuzzy testing on the initial parameter type of each random parameter in the initial data structure template to determine the true parameter type of each data sequence.
[0077] S408: Perform a fuzzy test on the parameter length of each random parameter in the initial data structure template to determine the target parameter length range of each data sequence.
[0078] The preset traversal algorithm may include a deep traversal algorithm. The initial data structure template includes the initial keywords, initial parameter types, and initial parameter hierarchies corresponding to each data sequence. For example, the template includes the parameter key name, parameter type, and the overall hierarchical relationship (e.g., a structure tree where parameter A includes objects B and C, object B includes objects E, object F, and so on).
[0079] Specifically, a deep traversal algorithm (DFS algorithm) is used to traverse each data sequence to obtain an initial data structure template; based on the initial parameter type and initial length of each data sequence, a plurality of random parameters are randomly generated and filled into the data structure template; the initial parameter type of the random parameter corresponding to each data sequence is fuzzy tested (or a sniffing or approximation algorithm) to determine the true parameter type of each data sequence; the initial parameter length of the random parameter corresponding to each data sequence is obtained, and the initial parameter length of the random parameter corresponding to each data sequence is changed to obtain new random parameters of different lengths corresponding to the random parameter of each data sequence, and the length of each new random parameter is verified by fuzz testing to determine the target parameter length range of each data sequence. For example, the fuzzy test can be performed by sending each new random parameter to the target service, and the response information of the target service will be obtained. If the parameter type and parameter length are unacceptable to the target service, the response information will include an error prompt. Based on the error message, adjust the random parameters and re-execute the message sent to the target service. You will get the response information of the target service. If the target service cannot accept the parameter type and parameter length, the response information will include the error prompt step. Until the error prompt is no longer reported in the feedback response information, the actual parameter type and the target parameter length range can be determined.
[0080] In this embodiment, each data sequence is traversed using a preset traversal algorithm to obtain an initial data structure template. Based on the initial parameter length and initial parameter type of each data sequence, a preset number of random parameters are randomly generated and filled into the initial data structure template. The initial parameter type of each random parameter in the initial data structure template is fuzzy tested to determine the actual parameter type of each data sequence. The parameter length of each random parameter in the initial data structure template is fuzzy tested to determine the target parameter length range of each data sequence. After analyzing and processing each functional test parameter, data expansion processing is performed to obtain multiple stress test parameters that meet actual conditions to achieve accurate stress testing, providing data support for stress testing. Moreover, there is no need for manual input of functional test parameters, and data expansion is performed based on experience, thereby enhancing test automation and improving the efficiency of test script generation.
[0081] Furthermore, after determining multiple stress test parameters, how to determine a test script based on the multiple stress test parameters is now described with an embodiment. In one embodiment, Figure 5 As shown, multiple stress test parameters are converted into script format data to obtain multiple test scripts, including:
[0082] S502: Convert each stress test parameter into script format data to obtain reference script data of each stress test parameter.
[0083] S504: Input the reference script data of each stress test parameter into a preset standard paradigm script generation template to obtain a plurality of test scripts.
[0084] The reference script data of the stress test parameters may include information such as the interface URL, interface cookie, and local host information.
[0085] Specifically, each stress test parameter is converted into script format data to obtain reference script data of each stress test parameter, and the reference script data of each stress test parameter is input into a preset standard paradigm script generation template to obtain multiple test scripts.
[0086] In this embodiment, by converting each stress test parameter into script format data, reference script data of each stress test parameter is obtained, and the reference script data of each stress test parameter is input into a preset standard paradigm script generation template to obtain multiple test scripts. This can realize the integration of stress test data and obtain multiple test scripts required for testing, so as to provide test cases for subsequent stress testing. There is no need to manually enter functional test parameters, and after analysis, the test scripts are involved, which simplifies the test process, realizes test automation, and strengthens the connection between functional testing and stress testing.
[0087] The above embodiment describes the stress test method. Before performing the stress test, a test script needs to be generated. When generating the test script, functional test parameters need to be obtained. Figure 6 As shown, the stress testing method also includes:
[0088] S602, receiving a recording instruction sent by the test terminal; the recording instruction includes a preset parameter identifier required for the stress test.
[0089] S604 , during the functional test process, storing the functional test parameters corresponding to the parameter identifier according to the recording instruction.
[0090] Specifically, the tester enters the functional test parameter identifiers required for the stress test using the terminal's preset recording interface, generates a recording instruction, and sends it to the server. The server receives the recording instruction sent by the test terminal. During the functional test, the server's recording tool stores the functional test parameters corresponding to the parameter identifiers based on the recording instruction.
[0091] Optionally, the recording tool forwards the terminal's request for functional testing of the target service and the target service's response information to the terminal.
[0092] In this embodiment, by receiving the recording instructions sent by the test terminal; the recording instructions include the parameter identifiers required for the preset stress test. During the functional test, the functional test parameters corresponding to the parameter identifiers are stored according to the recording instructions, which can realize the selection and recording of the test parameters during the functional test, so as to generate test cases for the subsequent stress test, thereby realizing an automated testing process.
[0093] To facilitate understanding by those skilled in the art, the pressure testing method is further described with reference to an embodiment. In one embodiment, the pressure testing method includes:
[0094] S100, receiving a recording instruction sent by a test terminal; the recording instruction includes a preset parameter identifier required for the stress test.
[0095] S200 , during a function test, storing function test parameters corresponding to parameter identifiers according to a recording instruction.
[0096] S300 , performing format conversion on each functional test parameter to obtain multiple data sequences in a target format.
[0097] S400: traverse each data sequence using a preset traversal algorithm to obtain an initial data structure template.
[0098] S500: randomly generate a preset number of random parameters according to the initial parameter length and initial parameter type of each data sequence and fill them into the initial data structure template.
[0099] S600: Perform fuzzy testing on the initial parameter type of each random parameter in the initial data structure template to determine the true parameter type of each data sequence.
[0100] S700: Perform a fuzzy test on the parameter length of each random parameter in the initial data structure template to determine the target parameter length range of each data sequence.
[0101] S800: Convert each stress test parameter into script format data to obtain reference script data of each stress test parameter.
[0102] S900: Inputting reference script data of various stress test parameters into a preset standard paradigm script generation template to obtain a plurality of test scripts.
[0103] S1000, obtaining a stress test instruction; the stress test instruction includes a test script identifier and a test execution time.
[0104] S1100, determining the corresponding target test script from a preset database according to the test script identifier; wherein the database stores multiple test script identifiers and corresponding test scripts, and the multiple test scripts are generated according to the functional test parameters recorded during the functional test process and the preset test script generation method.
[0105] S1200, executing the target test script at the test execution time to obtain the test result.
[0106] In this embodiment, by obtaining a stress test instruction including a test script identifier and a test execution time; determining the corresponding target test script from a preset database storing multiple test script identifiers and corresponding test scripts according to the test script identifier, executing the target test script at the test execution time, and obtaining a test result; wherein, multiple test scripts are generated according to the functional test parameters recorded during the functional test process and the preset test script generation method, and a set of automated systems for interface positioning, data preparation, and stress testing tasks before stress testing can be independently implemented based on the multiple test scripts generated by the recorded functional test parameters. This solves the problem in traditional manual testing where data relies on developers and testers to manually complete a series of information filling in the stress testing element table. It provides a data foundation for automated stress testing and test asset accumulation, simplifies the testing process, and improves testing efficiency.
[0107] It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts of the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0108] Based on the same inventive concept, embodiments of the present application also provide a pressure testing device for implementing the aforementioned pressure testing method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more pressure testing device embodiments provided below can be found in the above-described limitations of the pressure testing method and will not be further elaborated here.
[0109] In one embodiment, Figure 7 As shown, a pressure testing device is provided, comprising:
[0110] The acquisition module 701 is used to acquire a stress test instruction; the stress test instruction includes a test script identifier and a test execution time;
[0111] A retrieval module 702 is configured to determine a corresponding target test script from a preset database based on the test script identifier; wherein the database stores a plurality of test script identifiers and corresponding test scripts, wherein the plurality of test scripts are generated based on functional test parameters recorded during the functional test process and a preset test script generation method;
[0112] The execution module 703 is used to execute the target test script at the test execution time to obtain the test result.
[0113] The pressure testing device provided in this embodiment can execute the above method embodiment. Its implementation principles and technical effects are similar and will not be repeated here.
[0114] In one embodiment, the calling module includes:
[0115] The test script generation unit is used to perform data expansion processing on the functional test parameters according to the test script generation method to obtain multiple pressure test parameters, and convert the multiple pressure test parameters into script format data to obtain multiple test scripts.
[0116] In one embodiment, the calling module is specifically used to convert the format of each functional test parameter to obtain multiple data sequences in the target format; the initial parameter type and initial parameter length of each data sequence are fuzzy tested respectively to determine the real parameter type and target parameter length range of each data sequence; based on the real parameter type and target parameter length range of each data sequence, a plurality of stress test parameters that meet the real parameter type and target parameter length range of each data sequence are randomly generated.
[0117] In one embodiment, the calling module is specifically used to traverse each data sequence using a preset traversal algorithm to obtain an initial data structure template; randomly generate a preset number of random parameters according to the initial parameter length and initial parameter type of each data sequence and fill them into the initial data structure template; perform a fuzzy test on the initial parameter type of each random parameter in the initial data structure template to determine the true parameter type of each data sequence; perform a fuzzy test on the parameter length of each random parameter in the initial data structure template to determine the target parameter length range of each data sequence.
[0118] In one embodiment, the calling module is specifically used to convert each stress test parameter into script format data to obtain reference script data of each stress test parameter; the reference script data of each stress test parameter is input into a preset standard paradigm script generation template to obtain multiple test scripts.
[0119] In one embodiment, the stress testing module further includes:
[0120] The first receiving module is configured to receive a recording instruction sent by the test terminal; the recording instruction includes a preset parameter identifier required for the stress test;
[0121] The storage module is used to store the functional test parameters corresponding to the parameter identifier according to the recording instruction during the functional test process.
[0122] In one embodiment, the stress testing module further includes:
[0123] The second receiving module is used to execute the step of generating multiple test scripts according to the functional test parameters recorded during the functional test and the preset test script generation method when receiving the test script generation instruction of the stress test sent by the test terminal.
[0124] The pressure testing device provided in this embodiment can execute the above method embodiment. Its implementation principles and technical effects are similar and will not be repeated here.
[0125] Each module in the aforementioned stress testing device may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0126] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 8As shown. The computer device includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store test script data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a stress testing method is implemented.
[0127] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0128] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0129] Obtain stress test instructions; stress test instructions include test script identifier and test execution time;
[0130] Determining a corresponding target test script from a preset database based on the test script identifier; wherein the database stores a plurality of test script identifiers and corresponding test scripts, wherein the plurality of test scripts are generated based on functional test parameters recorded during the functional test process and a preset test script generation method;
[0131] Execute the target test script at the test execution time to obtain the test results.
[0132] In one embodiment, a method for generating multiple test scripts includes:
[0133] The functional test parameters are expanded according to the test script generation method to obtain a plurality of stress test parameters, and the plurality of stress test parameters are converted into script format data to obtain a plurality of test scripts.
[0134] In one embodiment, data expansion processing is performed on the functional test parameters according to the test script generation method to obtain multiple stress test parameters, including:
[0135] Perform format conversion on each functional test parameter to obtain multiple data sequences in the target format;
[0136] Perform fuzzy testing on the initial parameter type and initial parameter length of each data sequence to determine the true parameter type and target parameter length range of each data sequence;
[0137] According to the actual parameter type and target parameter length range of each data sequence, multiple stress test parameters that meet the actual parameter type and target parameter length range of each data sequence are randomly generated.
[0138] In one embodiment, the initial parameter type and initial parameter length of each data sequence are fuzzy tested to determine the actual parameter type and target parameter length range of each data sequence, including:
[0139] Use the preset traversal algorithm to traverse each data sequence to obtain the initial data structure template;
[0140] According to the initial parameter length and initial parameter type of each data sequence, a preset number of random parameters are randomly generated and filled into the initial data structure template;
[0141] Perform fuzzy testing on the initial parameter type of each random parameter in the initial data structure template to determine the true parameter type of each data sequence;
[0142] Perform fuzzy testing on the parameter length of each random parameter in the initial data structure template to determine the target parameter length range of each data sequence.
[0143] In one embodiment, multiple stress test parameters are converted into script format data to obtain multiple test scripts, including:
[0144] Convert each stress test parameter into script format data to obtain reference script data for each stress test parameter;
[0145] The reference script data of each stress test parameter is input into a preset standard paradigm script generation template to obtain multiple test scripts.
[0146] In one embodiment, the stress testing method further includes:
[0147] Receive a recording instruction sent by the test terminal; the recording instruction includes a preset parameter identifier required for the stress test;
[0148] During the functional test, the functional test parameters corresponding to the parameter identifiers are stored according to the recording instructions.
[0149] In one embodiment, the stress testing method further includes:
[0150] When a test script generation instruction for a stress test is received from a test terminal, a step of generating multiple test scripts is executed according to the functional test parameters recorded during the functional test and a preset test script generation method.
[0151] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0152] Obtain stress test instructions; stress test instructions include test script identifier and test execution time;
[0153] Determining a corresponding target test script from a preset database based on the test script identifier; wherein the database stores a plurality of test script identifiers and corresponding test scripts, wherein the plurality of test scripts are generated based on functional test parameters recorded during the functional test process and a preset test script generation method;
[0154] Execute the target test script at the test execution time to obtain the test results.
[0155] In one embodiment, a method for generating multiple test scripts includes:
[0156] The functional test parameters are expanded according to the test script generation method to obtain a plurality of stress test parameters, and the plurality of stress test parameters are converted into script format data to obtain a plurality of test scripts.
[0157] In one embodiment, data expansion processing is performed on the functional test parameters according to the test script generation method to obtain multiple stress test parameters, including:
[0158] Perform format conversion on each functional test parameter to obtain multiple data sequences in the target format;
[0159] Perform fuzzy testing on the initial parameter type and initial parameter length of each data sequence to determine the true parameter type and target parameter length range of each data sequence;
[0160] According to the actual parameter type and target parameter length range of each data sequence, multiple stress test parameters that meet the actual parameter type and target parameter length range of each data sequence are randomly generated.
[0161] In one embodiment, the initial parameter type and initial parameter length of each data sequence are fuzzy tested to determine the actual parameter type and target parameter length range of each data sequence, including:
[0162] Use the preset traversal algorithm to traverse each data sequence to obtain the initial data structure template;
[0163] According to the initial parameter length and initial parameter type of each data sequence, a preset number of random parameters are randomly generated and filled into the initial data structure template;
[0164] Perform fuzzy testing on the initial parameter type of each random parameter in the initial data structure template to determine the true parameter type of each data sequence;
[0165] Perform fuzzy testing on the parameter length of each random parameter in the initial data structure template to determine the target parameter length range of each data sequence.
[0166] In one embodiment, multiple stress test parameters are converted into script format data to obtain multiple test scripts, including:
[0167] Convert each stress test parameter into script format data to obtain reference script data for each stress test parameter;
[0168] The reference script data of each stress test parameter is input into a preset standard paradigm script generation template to obtain multiple test scripts.
[0169] In one embodiment, the stress testing method further includes:
[0170] Receive a recording instruction sent by the test terminal; the recording instruction includes a preset parameter identifier required for the stress test;
[0171] During the functional test, the functional test parameters corresponding to the parameter identifiers are stored according to the recording instructions.
[0172] In one embodiment, the stress testing method further includes:
[0173] When a test script generation instruction for a stress test is received from a test terminal, a step of generating multiple test scripts is executed according to the functional test parameters recorded during the functional test and a preset test script generation method.
[0174] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0175] Obtain stress test instructions; stress test instructions include test script identifier and test execution time;
[0176] Determining a corresponding target test script from a preset database based on the test script identifier; wherein the database stores a plurality of test script identifiers and corresponding test scripts, wherein the plurality of test scripts are generated based on functional test parameters recorded during the functional test process and a preset test script generation method;
[0177] Execute the target test script at the test execution time to obtain the test results.
[0178] In one embodiment, a method for generating multiple test scripts includes:
[0179] The functional test parameters are expanded according to the test script generation method to obtain a plurality of stress test parameters, and the plurality of stress test parameters are converted into script format data to obtain a plurality of test scripts.
[0180] In one embodiment, data expansion processing is performed on the functional test parameters according to the test script generation method to obtain multiple stress test parameters, including:
[0181] Perform format conversion on each functional test parameter to obtain multiple data sequences in the target format;
[0182] Perform fuzzy testing on the initial parameter type and initial parameter length of each data sequence to determine the true parameter type and target parameter length range of each data sequence;
[0183] According to the actual parameter type and target parameter length range of each data sequence, multiple stress test parameters that meet the actual parameter type and target parameter length range of each data sequence are randomly generated.
[0184] In one embodiment, the initial parameter type and initial parameter length of each data sequence are fuzzy tested to determine the actual parameter type and target parameter length range of each data sequence, including:
[0185] Use the preset traversal algorithm to traverse each data sequence to obtain the initial data structure template;
[0186] According to the initial parameter length and initial parameter type of each data sequence, a preset number of random parameters are randomly generated and filled into the initial data structure template;
[0187] Perform fuzzy testing on the initial parameter type of each random parameter in the initial data structure template to determine the true parameter type of each data sequence;
[0188] Perform fuzzy testing on the parameter length of each random parameter in the initial data structure template to determine the target parameter length range of each data sequence.
[0189] In one embodiment, multiple stress test parameters are converted into script format data to obtain multiple test scripts, including:
[0190] Convert each stress test parameter into script format data to obtain reference script data for each stress test parameter;
[0191] The reference script data of each stress test parameter is input into a preset standard paradigm script generation template to obtain multiple test scripts.
[0192] In one embodiment, the stress testing method further includes:
[0193] Receive a recording instruction sent by the test terminal; the recording instruction includes a preset parameter identifier required for the stress test;
[0194] During the functional test, the functional test parameters corresponding to the parameter identifiers are stored according to the recording instructions.
[0195] In one embodiment, the stress testing method further includes:
[0196] When a test script generation instruction for a stress test is received from a test terminal, a step of generating multiple test scripts is executed according to the functional test parameters recorded during the functional test and a preset test script generation method.
[0197] It should be noted that the user 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.
[0198] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.
[0199] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0200] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A stress testing method, characterized in that: The method comprises: Obtaining a stress test instruction; the stress test instruction includes a test script identifier and a test execution time; Determining a corresponding target test script from a preset database according to the test script identifier; wherein the database stores a plurality of test script identifiers and corresponding test scripts, wherein the plurality of test scripts are generated according to functional test parameters recorded during the functional test process and a preset test script generation method; Execute the target test script at the test execution time to obtain a test result; Methods for generating multiple test scripts include: Performing data expansion processing on the functional test parameters according to the test script generation method to obtain a plurality of stress test parameters, and converting the plurality of stress test parameters into script format data respectively to obtain a plurality of the test scripts; The function test parameters are expanded according to the test script generation method to obtain multiple stress test parameters, including: Performing format conversion on each of the functional test parameters to obtain multiple data sequences in a target format; Performing fuzzy testing on the initial parameter type and initial parameter length of each data sequence to determine the true parameter type and target parameter length range of each data sequence; According to the actual parameter type and target parameter length range of each data sequence, a plurality of stress test parameters that meet the actual parameter type and target parameter length range of each data sequence are randomly generated.
2. The method according to claim 1, characterized in that The fuzzy testing of the initial parameter type and initial parameter length of each data sequence to determine the true parameter type and target parameter length range of each data sequence includes: Using a preset traversal algorithm to traverse each of the data sequences to obtain an initial data structure template; Randomly generate a preset number of random parameters according to the initial parameter length and initial parameter type of each data sequence and fill them into the initial data structure template; Performing a fuzzy test on the initial parameter type of each of the random parameters in the initial data structure template to determine the true parameter type of each of the data sequences; A fuzzy test is performed on the parameter length of each of the random parameters in the initial data structure template to determine a target parameter length range for each of the data sequences.
3. The method according to claim 1 or 2, characterized in that The step of converting the plurality of stress test parameters into script format data to obtain the plurality of test scripts comprises: Converting each of the stress test parameters into the script format data to obtain reference script data for each of the stress test parameters; The reference script data of each stress test parameter is input into a preset standard paradigm script generation template to obtain a plurality of the test scripts.
4. The method according to claim 1, wherein The method further comprises: Receive a recording instruction sent by the test terminal; the recording instruction includes a preset parameter identifier required for the stress test; During the functional test, the functional test parameters corresponding to the parameter identifiers are stored according to the recording instructions.
5. The method according to claim 4, characterized in that The method further comprises: When receiving the test script generation instruction of the stress test sent by the test terminal, the step of generating multiple test scripts according to the functional test parameters recorded during the functional test and the preset test script generation method is executed.
6. A pressure testing device, characterized in that: The device comprises: An acquisition module is used to acquire a stress test instruction; the stress test instruction includes a test script identifier and a test execution time; A retrieval module is configured to determine a corresponding target test script from a preset database according to the test script identifier; wherein the database stores a plurality of test script identifiers and corresponding test scripts, wherein the plurality of test scripts are generated according to functional test parameters recorded during the functional test process and a preset test script generation method; An execution module, configured to execute the target test script at the test execution time to obtain a test result; The calling module includes: a test script generating unit, configured to perform data expansion processing on the functional test parameters according to the test script generating method to obtain a plurality of stress test parameters, and convert the plurality of stress test parameters into script format data respectively to obtain a plurality of the test scripts; The calling module is specifically used to convert the format of each functional test parameter to obtain multiple data sequences in the target format; perform fuzzy testing on the initial parameter type and initial parameter length of each data sequence to determine the true parameter type and target parameter length range of each data sequence; and randomly generate multiple stress test parameters that meet the true parameter type and target parameter length range of each data sequence based on the true parameter type and target parameter length range of each data sequence.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
9. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Interface performance test script generation method and device and computer equipment
CN113220566A
Application pressure testing method and device, storage medium and computer equipment
CN114116448A