CN114691506A - Pressure testing method, apparatus, device, medium, and program product - Google Patents
Pressure testing method, apparatus, device, medium, and program product Download PDFInfo
- Publication number
- CN114691506A CN114691506A CN202210321966.XA CN202210321966A CN114691506A CN 114691506 A CN114691506 A CN 114691506A CN 202210321966 A CN202210321966 A CN 202210321966A CN 114691506 A CN114691506 A CN 114691506A
- Authority
- CN
- China
- Prior art keywords
- test
- parameter
- script
- data
- pressure
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The present application relates to a pressure testing method, apparatus, device, medium and program product. The method comprises the following steps: acquiring a pressure test instruction; the pressure test instruction comprises a test script identifier and test execution time; determining a corresponding target test script from a preset database according to the test script identification; the database stores a plurality of test script identifications and corresponding test scripts, and the plurality of test scripts are generated according to function test parameters recorded in the function test process and a preset test script generation mode; and executing the target test script at the test execution time to obtain a test result. By adopting the method, the problem that in the traditional manual test, data depends on a series of information filling of the pressure test element table manually completed by developers and testers is solved. The method provides a data base stone for automatic pressure testing and asset accumulation testing, simplifies the testing process and improves the testing efficiency.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a pressure testing method, apparatus, device, medium, and program product.
Background
The pressure test is gradually becoming one of the essential stability and high availability test procedures of mainstream internet companies and large commercial banks. Different from the common function test, the verification of the related functionality can be carried out by simply clicking the function test page function. The pressure test needs a series of complex processes of pressure test interface information acquisition, screening, parameter extraction, pressure test script construction and pressure test task generation.
When a pressure test task in the prior art is carried out, a tester needs to manually carry out work such as parameter extraction, parameter splicing, parameter manufacturing and the like. However, the prior art has the problems of tedious test and low automation degree.
Disclosure of Invention
In view of the above, it is desirable to provide a pressure testing method, apparatus, device, medium, and program product that can simplify the testing process and improve the degree of automation.
In a first aspect, the present application provides a pressure testing method. The method comprises the following steps:
acquiring a pressure test instruction; the pressure test instruction comprises a test script identifier and test execution time;
determining a corresponding target test script from a preset database according to the test script identification; the database stores a plurality of test script identifications and corresponding test scripts, and the plurality of test scripts are generated according to function test parameters recorded in the function test process and a preset test script generation mode;
and executing the target test script at the test execution time to obtain a test result.
In one embodiment, the generating manner of the plurality of test scripts includes:
and performing data expansion processing on the functional test parameters according to a test script generation mode to obtain a plurality of pressure test parameters, and respectively converting the plurality of pressure test parameters into script format data to obtain a plurality of test scripts.
In one embodiment, the data expansion processing is performed on the functional test parameters according to a test script generation mode to obtain a plurality of pressure test parameters, including:
carrying out format conversion on each function test parameter to obtain a plurality of data sequences of a target format;
respectively carrying out fuzzy test on the initial parameter type and the initial parameter length of each data sequence, and determining the real parameter type and the target parameter length range of each data sequence;
and randomly generating a plurality of pressure test parameters meeting the real parameter types and the target parameter length ranges of the data sequences according to the real parameter types and the target parameter length ranges of the data sequences.
In one embodiment, the fuzzy test is performed on the initial parameter type and the initial parameter length of each data sequence, and the determining of the real parameter type and the target parameter length range of each data sequence includes:
traversing each data sequence by adopting a preset traversal algorithm to obtain an initial data structure template;
randomly generating a preset number of random parameters according to the initial parameter length and the initial parameter type of each data sequence and filling the random parameters into an initial data structure template;
carrying out fuzzy test on the initial parameter type of each random parameter in the initial data structure template to determine the real parameter type of each data sequence;
and carrying out fuzzy test on the parameter length of each random parameter in the initial data structure template, and determining the target parameter length range of each data sequence.
In one embodiment, converting the multiple pressure test parameters into script format data respectively to obtain multiple test scripts, including:
converting each pressure test parameter into script format data to obtain reference script data of each pressure test parameter;
and inputting the reference script data of each pressure test parameter into a preset standard normal form script generation template to obtain a plurality of test scripts.
In one embodiment, the pressure testing method further comprises:
receiving a recording instruction sent by a test terminal; the recording instruction comprises a preset parameter identification required by the pressure test;
and in the process of carrying out the function test, storing the function test parameters corresponding to the parameter identification according to the recording instruction.
In one embodiment, the pressure testing method further comprises:
and when a test script generation instruction of the pressure test sent by the test terminal is received, executing a step of generating a plurality of test scripts according to the function test parameters recorded in the function test process and a preset test script generation mode.
In a second aspect, the present application further provides a pressure testing device. The device includes:
the acquisition module is used for acquiring a pressure test instruction; the pressure test instruction comprises a test script identifier and test execution time;
the calling module is used for determining a corresponding target test script from a preset database according to the test script identification; the database stores a plurality of test script identifications and corresponding test scripts, and the plurality of test scripts are generated according to function test parameters recorded in the function test process and a preset test script generation mode;
and the execution module is used for executing the target test script at the test execution time to obtain a test result.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the steps of the method in any of the embodiments of the first aspect described above when the processor executes the computer program.
In a fourth aspect, the present application further provides a computer-readable storage medium. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any of the above-mentioned embodiments of the first aspect.
In a fifth aspect, the present application further provides a computer program product. A computer program product comprising a computer program which, when executed by a processor, performs the steps of the method in any of the embodiments of the first aspect described above.
According to the pressure test method, the pressure test device, the pressure test equipment, the pressure test medium and the pressure test program product, the pressure test instruction comprising the test script identification and the test execution time is obtained; determining a corresponding target test script from a preset database in which a plurality of test script identifications and corresponding test scripts are stored according to the test script identifications, and executing the target test script at the test execution time to obtain a test result; the plurality of test scripts are generated according to the function test parameters recorded in the function test process and a preset test script generation mode, and a set of automatic system for interface positioning, data preparation and pressure test preparation work of testers before pressure test can be automatically realized according to the plurality of test scripts generated according to the recorded function test parameters. The problem that in the traditional manual test, data is filled in by a series of information of a pressure test element table manually by developers and testers is solved. The method provides a data base stone for automatic pressure testing and asset accumulation testing, simplifies the testing process and improves the testing efficiency.
Drawings
FIG. 1 is a diagram of an exemplary pressure testing method;
FIG. 2 is a schematic flow chart of a pressure testing method in one embodiment;
FIG. 3 is a schematic flow chart of a pressure testing method in another embodiment;
FIG. 4 is a schematic flow chart of a pressure testing method in another embodiment;
FIG. 5 is a schematic flow chart of a pressure testing method in another embodiment;
FIG. 6 is a schematic flow chart of a pressure testing method in another embodiment;
FIG. 7 is a block diagram showing the structure of a pressure testing apparatus according to an embodiment;
FIG. 8 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
With the continuous development of the internet, the stability test of the internet is more and more important. Among them, the pressure test is becoming one of the essential stability and high availability test flows of mainstream internet companies and large commercial banks. Different from the common functional test process, functional verification is carried out by simply clicking the page function, and the pressure test needs to go through a series of complex processes of pressure test interface information acquisition, screening, parameter extraction, pressure test script construction and pressure test task generation. However, currently there is no unified automated task pipeline and pressure test data generation pipeline in the pressure test process. In view of such current situation, the industry generally provides a full-information pressure measurement element table to a tester by a developer, and all pressure measurement configuration and interface information are written in the pressure measurement element table. And the tester manually inputs information on the pressure testing platform according to the developed and written form to directly generate a pressure testing task.
The pressure testing method provided by the embodiment of the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104 or may be placed on the cloud or other network server. The server receives a pressure test instruction sent by a user through the terminal, determines a target test script in a plurality of test scripts pre-stored in the database according to the pressure test instruction, and executes the target test script to obtain a test result. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices and portable wearable devices, and the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart car-mounted devices, and the like. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, and the like. The server 104 may be implemented as a stand-alone server or as a server cluster comprised of multiple servers.
In one embodiment, as shown in fig. 2, a method for stress test is provided, which is described by taking the method as an example applied to the server in fig. 1, and includes the following steps:
s202, acquiring a pressure test instruction; the pressure test instruction comprises a test script identification and a test execution time.
The pressure test instruction is triggered by a test page of the terminal based on a tester and is used for indicating pressure test. The stress test instructions may further include: other information of the pressure measurement element table, such as concurrency, concurrency time, execution times, test targets, test tasks, test executors, and the like. The stress test is also called a mild test, and refers to that the whole system is placed in a specific extreme scene, and the availability, stability and reliability of software are tested in a mode of high system load, long time and multiple requests.
Specifically, when a pressure test instruction triggered by a tester based on a terminal is received, the pressure test instruction is obtained. The stress test instruction comprises a test script identification and a test execution time. Optionally, the stress test instruction may further include, without limitation, a tester identifier, a test item name, a test result saving address, and the like.
S204, determining a corresponding target test script from a preset database according to the test script identifier; the database stores a plurality of test script identifications and corresponding test scripts, and the plurality of test scripts are generated according to function test parameters recorded in the function test process and a preset test script generation mode.
The recorded functional test parameters may include information characteristics of a desired target test interface preset by a tester, and may be characteristics of url, characteristics of request parameters, characteristics of response, characteristics of request header, and the like, which are not limited herein. The functional test parameters can comprise request information of a functional test initiated by the target service based on the terminal and a response request of a target service response by a tester. The target test script is a pressure test script and can be the actual operation logic of the pressure test task, wherein the actual operation logic comprises information such as how to connect, how to splice parameters, which parameters to splice, and the configuration of execution environment parameters. The target machine may be requested directly using the script.
Specifically, after the pressure test instruction is obtained, the pressure test instruction can be searched for in a plurality of test scripts in a preset database according to the test script identifier in the pressure test instruction, and the corresponding test script identifier and the test script corresponding to the test script identifier are searched for, so that the target test script is obtained. The multiple test scripts are used for recording the required function test parameters by a recording tool in the process of performing function test, and multiple test versions are generated according to a preset test script generation mode. Alternatively, the recording tool may comprise a gorplay recording tool.
Further, it is preset that the script generation mode may include analyzing the recorded functional test parameters, generating a plurality of random intermediate test parameters according to a preset data expansion rule based on the functional test parameters, performing a fuzzy test on each intermediate test parameter, and determining a plurality of pressure test parameters to implement the data expansion processing when the fuzzy test is passed. After the data expansion processing is completed, each pressure test parameter is converted into script format data, and then a plurality of corresponding test scripts can be generated based on each script format data and a preset standard normal form script generation template. The preset script generation mode may also be that after the function test parameters are obtained, format conversion is directly performed on the function test parameters to obtain script format data. And generating a plurality of corresponding test scripts based on each script format data and a preset standard normal form script generation template, and respectively substituting each script format data into the preset standard normal form script generation template to obtain a plurality of corresponding test scripts, wherein the method is not limited. The preset data expansion rule may include data length expansion and/or data type expansion.
Optionally, generating a plurality of corresponding test scripts based on each script format data and the preset standard normal form script generation template may include substituting each script format data into the standard normal form script generation template, and uploading and storing the plurality of corresponding test scripts in the database.
And S206, executing the target test script at the test execution time to obtain a test result.
The test execution time may include a time when the pressure test instruction is received, or a preset target execution time.
Specifically, after the target test script is determined, the target test script may be executed when the test execution time comes, and after the execution is completed, the test result may be generated. Optionally, when a test script generation instruction of the pressure test sent by the test terminal is received, a step of generating a plurality of test scripts according to the function test parameters recorded in the function test process and a preset test script generation mode is executed.
In the pressure test method, a pressure test instruction comprising a test script identification and a test execution moment is obtained; determining a corresponding target test script from a preset database in which a plurality of test script identifications and corresponding test scripts are stored according to the test script identifications, and executing the target test script at the test execution time to obtain a test result; the plurality of test scripts are generated according to the function test parameters recorded in the function test process and a preset test script generation mode, and a set of automatic system for interface positioning, data preparation and pressure test preparation work of testers before pressure test can be automatically realized according to the plurality of test scripts generated according to the recorded function test parameters. The problem that in the traditional manual test, data is filled in by a series of information of a pressure test element table manually by developers and testers is solved. The method provides a data base stone for automatic pressure testing and asset accumulation testing, simplifies the testing process and improves the testing efficiency.
The above embodiments describe the pressure test method, which mainly depends on the test scripts stored in the database, and how to generate the test scripts is described with an embodiment. In one embodiment, the generating manner of the plurality of test scripts includes:
and performing data expansion processing on the functional test parameters according to a test script generation mode to obtain a plurality of pressure test parameters, and respectively converting the plurality of pressure test parameters into script format data to obtain a plurality of test scripts.
Specifically, after the functional test parameters are obtained, the initial data parameter type and the initial parameter data length of the functional test parameters may be determined first, and data expansion processing may be performed based on the initial data parameter type and/or the initial parameter data length to obtain a plurality of pressure test parameters. Since the pressure test parameters are not in the script format, format conversion is required, and a plurality of test scripts can be generated based on each script format data after conversion into script format data.
Further, in an embodiment, as shown in fig. 3, performing data expansion processing on the functional test parameters according to a test script generation manner to obtain a plurality of pressure test parameters includes:
s302, format conversion is carried out on each function test parameter to obtain a plurality of data sequences in a target format.
The target format may include a json format, among others.
Specifically, because the data format of the functional test parameters is different from the format of the parameters required by the pressure test, the format conversion of each functional test parameter is required to obtain a plurality of data sequences in the target format. Format conversion may include directly converting functional test parameters in the form of xml, character strings, binary arrays, etc. into data sequences in json format using a serializer. And when the sequencer can not directly convert the format of the function test parameters, analyzing the parameter character strings of the http in a semantic analysis mode to obtain a plurality of data sequences.
S304, respectively carrying out fuzzy test on the initial parameter type and the initial parameter length of each data sequence, and determining the real parameter type and the target parameter length range of each data sequence.
Specifically, the data structures of the plurality of data sequences are analyzed to obtain the initial parameter type and the initial parameter length of each data sequence. And traversing each data sequence by adopting a preset traversal algorithm to obtain an initial data structure template. And carrying out length or type conversion on the corresponding data sequence based on the initial parameter type and the initial parameter length of each data sequence to obtain a plurality of random parameters, substituting each random parameter into the initial data structure template, carrying out fuzzy test on each random parameter, and determining the real parameter type and the target parameter length range of each random parameter. Illustratively, a depth traversal algorithm (DFS algorithm) may be employed to traverse each data sequence, obtaining an initial data structure template; randomly generating a plurality of random parameters according to the initial parameter types of the data sequences and the initial lengths of the data sequences and filling the random parameters into a data structure template; carrying out fuzzy test (or sniffing and approximation algorithm) processing on the initial parameter type of the corresponding random parameter of each data sequence to determine the real parameter type of each data sequence; acquiring the initial length of the random parameter corresponding to each data sequence, changing the initial length of the random parameter corresponding to each data sequence, acquiring new random parameters with different lengths of the random parameter corresponding to each data sequence, performing length verification on each new random parameter by adopting a fuzzy test, and determining the target length range of each data sequence. The initial data structure template comprises initial keywords, initial parameter types, initial parameter levels and the like corresponding to the data sequences. For example, in the data structure template, an initial sniffing type of random parameters in the structure is generated according to an initial parameter type, and if the initial sniffing type is a number, the data is considered to be int-type data, and if the number is long, the data is considered to be a character string.
S306, randomly generating a plurality of pressure test parameters meeting the real parameter type and the target parameter length range of each data sequence according to the real parameter type and the target parameter length range of each data sequence.
Specifically, after the real parameter type and the target parameter length range of each data sequence are obtained, a plurality of pressure test parameters meeting the real parameter type and the target parameter length range of each data sequence can be randomly generated.
Optionally, after the real parameter type and the target parameter length range of each data sequence are obtained, a plurality of pressure test parameters satisfying the real parameter type, the target parameter length range and the parameter structure of each data sequence may be randomly generated.
In this embodiment, format conversion is performed on each functional test parameter to obtain a plurality of data sequences in a target format, fuzzy test is performed on the initial parameter type and the initial parameter length of each data sequence, a real parameter type and a target parameter length range of each data sequence are determined, and a plurality of pressure test parameters meeting the real parameter type and the target parameter length range of each data sequence are randomly generated according to the real parameter type and the target parameter length range of each data sequence. The method can analyze and process each function test parameter, and then perform data expansion processing to obtain a plurality of pressure test parameters meeting real conditions, so as to realize accurate pressure test, provide data support for pressure test, and avoid manual input of the function test parameters, and expand data according to experience, thereby enhancing test automation and improving test script generation efficiency.
Further, in an embodiment, as shown in fig. 4, the performing a fuzzy test on the initial parameter type and the initial parameter length of each data sequence, and determining the ranges of the true parameter type and the target parameter length of each data sequence includes:
s402, traversing each data sequence by adopting a preset traversal algorithm to obtain an initial data structure template.
S404, randomly generating a preset number of random parameters according to the initial parameter length and the initial parameter type of each data sequence and filling the random parameters into the initial data structure template.
S406, fuzzy test is carried out on the initial parameter types of the random parameters in the initial data structure template, and the real parameter types of the data sequences are determined.
S408, carrying out fuzzy test on the parameter length of each random parameter in the initial data structure template, and determining the target parameter length range of each data sequence.
Wherein the preset traversal algorithm may include a depth traversal algorithm. The initial data structure template comprises initial keywords, initial parameter types, initial parameter levels and the like corresponding to all data sequences. Illustratively, the template includes the name of the parameter key, the type of the parameter, and the overall hierarchical relationship. (parameter A includes object B, which includes a structure tree of object E, object F, etc., and object C).
Specifically, a depth traversal algorithm (DFS algorithm) is adopted to traverse each data sequence to obtain an initial data structure template; randomly generating a plurality of random parameters according to the initial parameter types of the data sequences and the initial lengths of the data sequences and filling the random parameters into a data structure template; carrying out fuzzy test (or sniffing and approximation algorithm) processing on the initial parameter type of the corresponding random parameter of each data sequence to determine the real parameter type of each data sequence; acquiring the initial parameter length of the random parameter corresponding to each data sequence, changing the initial parameter length of the random parameter corresponding to each data sequence, acquiring new random parameters with different lengths of the random parameter corresponding to each data sequence, performing length verification on each new random parameter by adopting a fuzzy test, and determining the target parameter length range of each data sequence. For example, the fuzzing test may be performed by sending each new random parameter to the target service, so as to obtain response information of the target service, where if the parameter type and the parameter length that are unacceptable for the target service, the response information may include an error notification. Based on the error reporting information, adjusting the random parameters, re-executing the random parameters and sending the random parameters to the target service, obtaining the response information of the target service, if the parameter type and the parameter length which are unacceptable for the target service are available, the response information comprises the step of error reporting prompt, and the real parameter type and the target parameter length range can be determined until the error reporting prompt is not carried out in the feedback response information.
In this embodiment, each data sequence is traversed by using a preset traversal algorithm to obtain an initial data structure template, a preset number of random parameters are randomly generated according to the initial parameter length and the initial parameter type of each data sequence and filled into the initial data structure template, the initial parameter type of each random parameter in the initial data structure template is subjected to a fuzzy test to determine the real parameter type of each data sequence, the parameter length of each random parameter in the initial data structure template is subjected to a fuzzy test to determine the target parameter length range of each data sequence. The method can analyze and process each function test parameter, and then perform data expansion processing to obtain a plurality of pressure test parameters meeting real conditions, so as to realize accurate pressure test, provide data support for pressure test, and avoid manual input of the function test parameters, and expand data according to experience, thereby enhancing test automation and improving test script generation efficiency.
Further, after determining the plurality of stress test parameters, how to determine the test script based on the plurality of stress test parameters is now described with an embodiment. In one embodiment, as shown in fig. 5, converting the plurality of stress test parameters into script format data, respectively, to obtain a plurality of test scripts, includes:
s502, converting each pressure test parameter into script format data to obtain reference script data of each pressure test parameter.
S504, inputting the reference script data of each pressure test parameter into a preset standard normal form script generation template to obtain a plurality of test scripts.
The reference script data of the stress test parameters may include information such as an interface url, an interface cookie, and native host information.
Specifically, each pressure test parameter is converted into script format data to obtain reference script data of each pressure test parameter, and the reference script data of each pressure test parameter is input into a preset standard normal form script generation template to obtain a plurality of test scripts.
In this embodiment, the reference script data of each pressure test parameter is obtained by converting each pressure test parameter into script format data, the reference script data of each pressure test parameter is input into a preset standard normal form script generation template to obtain a plurality of test scripts, the integration of the pressure test data can be realized, a plurality of test scripts required by the test are obtained, a test case is provided for the subsequent pressure test, the functional test parameters are not required to be manually input, and after the analysis, the test scripts are involved, the test flow is simplified, the test automation is realized, and the relation between the functional test and the pressure test is strengthened.
The above embodiment describes the pressure testing method, and a test script needs to be generated before the pressure testing, and functional test parameters need to be obtained when the test script is generated. This is now described in one embodiment. In one embodiment, as shown in fig. 6, the pressure testing method further includes:
s602, receiving a recording instruction sent by a test terminal; the recorded instruction comprises parameter identification required by the preset pressure test.
And S604, storing the function test parameters corresponding to the parameter identifications according to the recording instruction in the process of performing function test.
Specifically, a tester inputs a functional test parameter identifier required to be obtained for pressure testing based on a recording interface preset by a terminal, generates a recording instruction, and sends the recording instruction to a server. And the server receives the recording instruction sent by the test terminal. And in the process of carrying out the function test, the recording tool of the server stores the function test parameters corresponding to the parameter identification according to the recording instruction.
Optionally, the recording tool forwards a request for a function test performed by the terminal on the target service, and response information of the target service to the terminal.
In this embodiment, a recording instruction sent by a test terminal is received; the recording instruction comprises a parameter identification required by the preset pressure test, and in the process of performing the function test, the function test parameters corresponding to the parameter identification are stored according to the recording instruction, so that the selection and the recording of the test parameters in the function test can be realized, and the test case of the pressure test can be generated subsequently, and the automatic test process can be further realized.
To facilitate understanding by those skilled in the art, the pressure test method will now be further described with reference to one embodiment. In one embodiment, a pressure testing method includes:
s100, receiving a recording instruction sent by a test terminal; the recorded instruction comprises parameter identification required by the preset pressure test.
And S200, storing the function test parameters corresponding to the parameter identifications according to the recording instruction in the function test process.
And S300, carrying out format conversion on each function test parameter to obtain a plurality of data sequences in a target format.
S400, traversing each data sequence by adopting a preset traversal algorithm to obtain an initial data structure template.
And S500, randomly generating a preset number of random parameters according to the initial parameter length and the initial parameter type of each data sequence and filling the random parameters into the initial data structure template.
S600, carrying out fuzzy test on the initial parameter types of the random parameters in the initial data structure template, and determining the real parameter types of the data sequences.
S700, carrying out fuzzy test on the parameter length of each random parameter in the initial data structure template, and determining the target parameter length range of each data sequence.
And S800, converting the pressure test parameters into script format data to obtain reference script data of the pressure test parameters.
And S900, inputting the reference script data of each pressure test parameter into a preset standard normal form script generation template to obtain a plurality of test scripts.
S1000, acquiring a pressure test instruction; the pressure test instruction comprises a test script identification and a test execution time.
S1100, determining a corresponding target test script from a preset database according to the test script identifier; the database stores a plurality of test script identifications and corresponding test scripts, and the plurality of test scripts are generated according to function test parameters recorded in the function test process and a preset test script generation mode.
And S1200, executing the target test script at the test execution time to obtain a test result.
In the embodiment, the pressure test instruction including the test script identification and the test execution time is obtained; determining a corresponding target test script from a preset database in which a plurality of test script identifications and corresponding test scripts are stored according to the test script identifications, and executing the target test script at the test execution time to obtain a test result; the plurality of test scripts are generated according to the function test parameters recorded in the function test process and a preset test script generation mode, and a set of automatic system for interface positioning, data preparation and pressure test preparation work of testers before pressure test can be automatically realized according to the plurality of test scripts generated according to the recorded function test parameters. The problem that in the traditional manual test, data is filled in by a series of information of a pressure test element table manually by developers and testers is solved. The method provides a data base stone for automatic pressure testing and asset accumulation testing, simplifies the testing process and improves the testing efficiency.
It should be understood that, although the steps in the flowcharts related to the embodiments are shown in sequence as indicated by the arrows, the steps are not necessarily executed in sequence as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the above embodiments may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the application also provides a pressure testing device for realizing the pressure testing method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the method, so the specific limitations in one or more embodiments of the pressure testing device provided below can be referred to the limitations of the pressure testing method in the above, and are not described herein again.
In one embodiment, as shown in fig. 7, there is provided a pressure testing apparatus including:
an obtaining module 701, configured to obtain a pressure test instruction; the pressure test instruction comprises a test script identifier and test execution time;
a calling module 702, configured to determine a corresponding target test script from a preset database according to the test script identifier; the database stores a plurality of test script identifications and corresponding test scripts, and the plurality of test scripts are generated according to function test parameters recorded in the function test process and a preset test script generation mode;
the execution module 703 is configured to execute the target test script at the test execution time to obtain a test result.
The pressure testing apparatus provided in this embodiment may implement the method embodiments described above, and the implementation principle and the technical effect are similar, which are not described herein again.
In one embodiment, a retrieval module includes:
and the test script generating unit is used for performing data expansion processing on the functional test parameters according to the test script generating mode to obtain a plurality of pressure test parameters, and respectively converting the plurality of pressure test parameters into script format data to obtain a plurality of test scripts.
In one embodiment, the invoking module is specifically configured to perform format conversion on each functional test parameter to obtain a plurality of data sequences in a target format; respectively carrying out fuzzy test on the initial parameter type and the initial parameter length of each data sequence, and determining the real parameter type and the target parameter length range of each data sequence; and randomly generating a plurality of pressure test parameters meeting the real parameter types and the target parameter length ranges of the data sequences according to the real parameter types and the target parameter length ranges of the data sequences.
In one embodiment, the invoking module is specifically configured to traverse each data sequence by using a preset traversal algorithm to obtain an initial data structure template; randomly generating a preset number of random parameters according to the initial parameter length and the initial parameter type of each data sequence and filling the random parameters into an initial data structure template; carrying out fuzzy test on the initial parameter type of each random parameter in the initial data structure template to determine the real parameter type of each data sequence; and carrying out fuzzy test on the parameter length of each random parameter in the initial data structure template, and determining the target parameter length range of each data sequence.
In one embodiment, the invoking module is specifically configured to convert each pressure test parameter into script format data to obtain reference script data of each pressure test parameter; and inputting the reference script data of each pressure test parameter into a preset standard normal form script generation template to obtain a plurality of test scripts.
In one embodiment, the pressure test module further comprises:
the first receiving module is used for receiving a recording instruction sent by the test terminal; the recording instruction comprises a preset parameter identifier required by the pressure test;
and the storage module is used for storing the function test parameters corresponding to the parameter identifications according to the recording instruction in the process of performing the function test.
In one embodiment, the pressure test module further comprises:
and the second receiving module is used for executing the step of generating a plurality of test scripts according to the functional test parameters recorded in the functional test process and a preset test script generating mode when receiving the test script generating instruction of the pressure test sent by the test terminal.
The pressure testing apparatus provided in this embodiment may implement the method embodiments described above, and the implementation principle and the technical effect are similar, which are not described herein again.
The various modules in the pressure testing apparatus described above may be implemented in whole or in part by software, hardware, and combinations thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 8. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured 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 an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing test script data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a stress testing method.
Those skilled in the art will appreciate that the architecture shown in fig. 8 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring a pressure test instruction; the pressure test instruction comprises a test script identifier and test execution time;
determining a corresponding target test script from a preset database according to the test script identification; the database stores a plurality of test script identifications and corresponding test scripts, and the plurality of test scripts are generated according to function test parameters recorded in the function test process and a preset test script generation mode;
and executing the target test script at the test execution time to obtain a test result.
In one embodiment, the manner of generating the plurality of test scripts includes:
and performing data expansion processing on the functional test parameters according to a test script generation mode to obtain a plurality of pressure test parameters, and respectively converting the plurality of pressure test parameters into script format data to obtain a plurality of test scripts.
In one embodiment, the data expansion processing is performed on the functional test parameters according to a test script generation mode to obtain a plurality of pressure test parameters, including:
carrying out format conversion on each function test parameter to obtain a plurality of data sequences in a target format;
respectively carrying out fuzzy test on the initial parameter type and the initial parameter length of each data sequence, and determining the real parameter type and the target parameter length range of each data sequence;
and randomly generating a plurality of pressure test parameters meeting the real parameter types and the target parameter length ranges of the data sequences according to the real parameter types and the target parameter length ranges of the data sequences.
In one embodiment, the fuzzy test is performed on the initial parameter type and the initial parameter length of each data sequence, and the determining of the real parameter type and the target parameter length range of each data sequence includes:
traversing each data sequence by adopting a preset traversal algorithm to obtain an initial data structure template;
randomly generating a preset number of random parameters according to the initial parameter length and the initial parameter type of each data sequence and filling the random parameters into an initial data structure template;
carrying out fuzzy test on the initial parameter type of each random parameter in the initial data structure template to determine the real parameter type of each data sequence;
and carrying out fuzzy test on the parameter length of each random parameter in the initial data structure template, and determining the target parameter length range of each data sequence.
In one embodiment, converting the pressure test parameters into script format data to obtain a plurality of test scripts respectively includes:
converting each pressure test parameter into script format data to obtain reference script data of each pressure test parameter;
and inputting the reference script data of each pressure test parameter into a preset standard normal form script generation template to obtain a plurality of test scripts.
In one embodiment, the pressure testing method further comprises:
receiving a recording instruction sent by a test terminal; the recording instruction comprises a preset parameter identifier required by the pressure test;
and in the process of carrying out the function test, storing the function test parameters corresponding to the parameter identification according to the recording instruction.
In one embodiment, the pressure testing method further comprises:
and when a test script generation instruction of the pressure test sent by the test terminal is received, executing a step of generating a plurality of test scripts according to the function test parameters recorded in the function test process and a preset test script generation mode.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring a pressure test instruction; the pressure test instruction comprises a test script identifier and test execution time;
determining a corresponding target test script from a preset database according to the test script identification; the database stores a plurality of test script identifications and corresponding test scripts, and the plurality of test scripts are generated according to function test parameters recorded in the function test process and a preset test script generation mode;
and executing the target test script at the test execution time to obtain a test result.
In one embodiment, the generating manner of the plurality of test scripts includes:
and performing data expansion processing on the functional test parameters according to a test script generation mode to obtain a plurality of pressure test parameters, and respectively converting the plurality of pressure test parameters into script format data to obtain a plurality of test scripts.
In one embodiment, the data expansion processing is performed on the functional test parameters according to the test script generation mode to obtain a plurality of pressure test parameters, and the method includes:
carrying out format conversion on each function test parameter to obtain a plurality of data sequences in a target format;
respectively carrying out fuzzy test on the initial parameter type and the initial parameter length of each data sequence, and determining the real parameter type and the target parameter length range of each data sequence;
and randomly generating a plurality of pressure test parameters meeting the real parameter types and the target parameter length ranges of the data sequences according to the real parameter types and the target parameter length ranges of the data sequences.
In one embodiment, the fuzzy test is performed on the initial parameter type and the initial parameter length of each data sequence, and the determining of the real parameter type and the target parameter length range of each data sequence includes:
traversing each data sequence by adopting a preset traversal algorithm to obtain an initial data structure template;
randomly generating a preset number of random parameters according to the initial parameter length and the initial parameter type of each data sequence and filling the random parameters into an initial data structure template;
carrying out fuzzy test on the initial parameter type of each random parameter in the initial data structure template to determine the real parameter type of each data sequence;
and carrying out fuzzy test on the parameter length of each random parameter in the initial data structure template, and determining the target parameter length range of each data sequence.
In one embodiment, converting the pressure test parameters into script format data to obtain a plurality of test scripts respectively includes:
converting each pressure test parameter into script format data to obtain reference script data of each pressure test parameter;
and inputting the reference script data of each pressure test parameter into a preset standard normal form script generation template to obtain a plurality of test scripts.
In one embodiment, the pressure testing method further comprises:
receiving a recording instruction sent by a test terminal; the recording instruction comprises a preset parameter identification required by the pressure test;
and in the process of carrying out the function test, storing the function test parameters corresponding to the parameter identification according to the recording instruction.
In one embodiment, the pressure testing method further comprises:
and when a test script generation instruction of the pressure test sent by the test terminal is received, executing a step of generating a plurality of test scripts according to the function test parameters recorded in the function test process and a preset test script generation mode.
In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, performs the steps of:
acquiring a pressure test instruction; the pressure test instruction comprises a test script identifier and test execution time;
determining a corresponding target test script from a preset database according to the test script identification; the database stores a plurality of test script identifications and corresponding test scripts, and the plurality of test scripts are generated according to function test parameters recorded in the function test process and a preset test script generation mode;
and executing the target test script at the test execution time to obtain a test result.
In one embodiment, the generating manner of the plurality of test scripts includes:
and performing data expansion processing on the functional test parameters according to a test script generation mode to obtain a plurality of pressure test parameters, and respectively converting the plurality of pressure test parameters into script format data to obtain a plurality of test scripts.
In one embodiment, the data expansion processing is performed on the functional test parameters according to a test script generation mode to obtain a plurality of pressure test parameters, including:
carrying out format conversion on each function test parameter to obtain a plurality of data sequences in a target format;
respectively carrying out fuzzy test on the initial parameter type and the initial parameter length of each data sequence, and determining the real parameter type and the target parameter length range of each data sequence;
and randomly generating a plurality of pressure test parameters meeting the real parameter types and the target parameter length ranges of the data sequences according to the real parameter types and the target parameter length ranges of the data sequences.
In one embodiment, the fuzzy test is performed on the initial parameter type and the initial parameter length of each data sequence, and the determining of the real parameter type and the target parameter length range of each data sequence includes:
traversing each data sequence by adopting a preset traversal algorithm to obtain an initial data structure template;
randomly generating a preset number of random parameters according to the initial parameter length and the initial parameter type of each data sequence and filling the random parameters into an initial data structure template;
carrying out fuzzy test on the initial parameter type of each random parameter in the initial data structure template to determine the real parameter type of each data sequence;
and carrying out fuzzy test on the parameter length of each random parameter in the initial data structure template, and determining the target parameter length range of each data sequence.
In one embodiment, converting the pressure test parameters into script format data to obtain a plurality of test scripts respectively includes:
converting each pressure test parameter into script format data to obtain reference script data of each pressure test parameter;
and inputting the reference script data of each pressure test parameter into a preset standard normal form script generation template to obtain a plurality of test scripts.
In one embodiment, the pressure testing method further comprises:
receiving a recording instruction sent by a test terminal; the recording instruction comprises a preset parameter identification required by the pressure test;
and in the process of carrying out the function test, storing the function test parameters corresponding to the parameter identification according to the recording instruction.
In one embodiment, the pressure testing method further comprises:
and when a test script generation instruction of the pressure test sent by the test terminal is received, executing a step of generating a plurality of test scripts according to the function test parameters recorded in the function test process and a preset test script generation mode.
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 for analysis, stored data, displayed data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high-density embedded nonvolatile Memory, resistive Random Access Memory (ReRAM), Magnetic Random Access Memory (MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (PCM), graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases referred to in various embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims (11)
1. A method of pressure testing, the method comprising:
acquiring a pressure test instruction; the pressure test instruction comprises a test script identifier and test execution time;
determining a corresponding target test script from a preset database according to the test script identifier; the database is stored with a plurality of test script identifications and corresponding test scripts, and the plurality of test scripts are generated according to function test parameters recorded in a function test process and a preset test script generation mode;
and executing the target test script at the test execution time to obtain a test result.
2. The method of claim 1, wherein the manner in which the plurality of test scripts are generated comprises:
and performing data expansion processing on the function test parameters according to the test script generation mode to obtain a plurality of pressure test parameters, and respectively converting the plurality of pressure test parameters into script format data to obtain a plurality of test scripts.
3. The method according to claim 2, wherein the performing data expansion processing on the functional test parameters according to the test script generation manner to obtain a plurality of stress test parameters comprises:
carrying out format conversion on each function test parameter to obtain a plurality of data sequences in a target format;
respectively carrying out fuzzy test on the initial parameter type and the initial parameter length of each data sequence to determine the range of the real parameter type and the target parameter length of each data sequence;
and randomly generating a plurality of pressure test parameters meeting the real parameter type and the target parameter length range of each data sequence according to the real parameter type and the target parameter length range of each data sequence.
4. The method of claim 3, wherein the fuzzy testing the initial parameter type and the initial parameter length of each data sequence to determine the true parameter type and the target parameter length range of each data sequence comprises:
traversing each data sequence by adopting a preset traversal algorithm to obtain an initial data structure template;
randomly generating a preset number of random parameters according to the initial parameter length and the initial parameter type of each data sequence and filling the random parameters into the initial data structure template;
carrying out fuzzy test on the initial parameter type of each random parameter in the initial data structure template to determine the real parameter type of each data sequence;
and carrying out fuzzy test on the parameter length of each random parameter in the initial data structure template, and determining the target parameter length range of each data sequence.
5. The method according to any one of claims 2-4, wherein said converting the plurality of stress test parameters into script format data, respectively, to obtain a plurality of test scripts, comprises:
converting each pressure test parameter into script format data to obtain reference script data of each pressure test parameter;
and inputting the reference script data of each pressure test parameter into a preset standard normal form script generation template to obtain a plurality of test scripts.
6. The method of claim 2, further comprising:
receiving a recording instruction sent by a test terminal; the recording instruction comprises a preset parameter identification required by pressure test;
and storing the function test parameters corresponding to the parameter identification according to the recording instruction in the function test process.
7. The method of claim 2, further comprising:
and when a test script generation instruction of the pressure test sent by the test terminal is received, executing the step of generating a plurality of test scripts according to the function test parameters recorded in the function test process and a preset test script generation mode.
8. A pressure testing apparatus, the apparatus comprising:
the acquisition module is used for acquiring a pressure test instruction; the pressure test instruction comprises a test script identifier and test execution time;
the calling module is used for determining a corresponding target test script from a preset database according to the test script identifier; the database is stored with a plurality of test script identifications and corresponding test scripts, and the plurality of test scripts are generated according to function test parameters recorded in a function test process and a preset test script generation mode;
and the execution module is used for executing the target test script at the test execution time to obtain a test result.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 8.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 8.
11. A computer program product comprising a computer program, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 8 when executed by a processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210321966.XA CN114691506A (en) | 2022-03-30 | 2022-03-30 | Pressure testing method, apparatus, device, medium, and program product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210321966.XA CN114691506A (en) | 2022-03-30 | 2022-03-30 | Pressure testing method, apparatus, device, medium, and program product |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114691506A true CN114691506A (en) | 2022-07-01 |
Family
ID=82141306
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210321966.XA Pending CN114691506A (en) | 2022-03-30 | 2022-03-30 | Pressure testing method, apparatus, device, medium, and program product |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114691506A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114860617A (en) * | 2022-07-06 | 2022-08-05 | 上海金仕达软件科技有限公司 | Intelligent pressure testing method and system |
CN117171053A (en) * | 2023-11-01 | 2023-12-05 | 睿思芯科(深圳)技术有限公司 | Test method, system and related equipment for vectorized programming |
-
2022
- 2022-03-30 CN CN202210321966.XA patent/CN114691506A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114860617A (en) * | 2022-07-06 | 2022-08-05 | 上海金仕达软件科技有限公司 | Intelligent pressure testing method and system |
CN117171053A (en) * | 2023-11-01 | 2023-12-05 | 睿思芯科(深圳)技术有限公司 | Test method, system and related equipment for vectorized programming |
CN117171053B (en) * | 2023-11-01 | 2024-02-20 | 睿思芯科(深圳)技术有限公司 | Test method, system and related equipment for vectorized programming |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114691506A (en) | Pressure testing method, apparatus, device, medium, and program product | |
JP2021002315A (en) | Method and apparatus for generating information | |
CN107276842B (en) | Interface test method and device and electronic equipment | |
US20080276225A1 (en) | Testing Executable Logic | |
CN111309734A (en) | Method and system for automatically generating table data | |
CN112363953A (en) | Interface test case generation method and system based on crawler technology and rule engine | |
CN114356631A (en) | Fault positioning method and device, computer equipment and storage medium | |
CN114238085A (en) | Interface testing method and device, computer equipment and storage medium | |
CN117290236A (en) | Software testing method, device, computer equipment and computer readable storage medium | |
CN116719735A (en) | Test case generation method and device | |
CN114385722A (en) | Interface attribute consistency checking method and device, electronic equipment and storage medium | |
CN116561003A (en) | Test data generation method, device, computer equipment and storage medium | |
US11681511B2 (en) | Systems and methods for building and deploying machine learning applications | |
CN112231377A (en) | Data mapping method, system, device, server and storage medium | |
CN112363944A (en) | Method and equipment for comparing return values of multiple environment interfaces | |
CN116795723B (en) | Chain unit test processing method and device and computer equipment | |
CN114528198A (en) | Software automation test method and device, electronic equipment and storage medium | |
CN117453561A (en) | Test script calling method, device, computer equipment and storage medium | |
CN114780401A (en) | Interface testing method and device, computer equipment and storage medium | |
CN115424052A (en) | Image classification method based on SPARK and transfer learning fusion | |
CN117389605A (en) | Service interface configuration method, device, equipment, storage medium and program product | |
CN117389978A (en) | Automatic importing method and device for interface file, computer equipment and storage medium | |
CN115904968A (en) | Interface testing method and device, computer equipment and storage medium | |
KR20230091748A (en) | Distributed workflow apparatus for executing and managing application tasks across multiple servers and method thereof | |
CN117971649A (en) | Data processing method, device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |