Performance stress testing platform and method, electronic device and readable medium
By designing the recording, analysis and online adjustment module of the performance pressure testing platform, the test scripts are automatically processed, and the problems of time-consuming and complicated adjustment of parameters in the existing technology are solved, and the testing efficiency and simplicity of operation are improved.
Patent Information
- Application Number
- CN202110596090.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-29
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2041-05-29
AI Technical Summary
The existing performance pressure test requires staff to manually write test scripts, which consumes a lot of time and energy, and adjusts pressure parameters and is cumbersome to operate, resulting in inefficient testing.
A performance pressure testing platform is designed, including a recording module, analytical module and an online adjustment module, which can automatically record, analyze and adjust test scripts, generate execution data, reduce manual intervention, and support online recording-adjustment-execution scripts.
It greatly saves staff's time and energy, improves testing efficiency, does not require local installation of pressure testing software, saves equipment resources, is simple to operate, is highly promoted, supports parameterized testing and import of local scripts.
Smart Images

Figure CN113901365B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of testing technology, and more specifically relates to a performance stress testing platform and method, an electronic device and a computer-readable medium. Background Art
[0002] Performance testing is to test the performance indicators of the system by simulating various normal, peak and abnormal load conditions through automated testing tools. Load testing and stress testing are both performance tests, and the two can be combined. Among them, stress testing is to determine the bottleneck or unacceptable performance point of a system to obtain the maximum service level that the system can provide.
[0003] The existing performance stress test requires staff to manually write stress test scripts using local stress test software (such as JMETER or LOADRUNNER), then modify the script parameters, debug whether the script is executable, execute the script according to the stress test scenario, and finally obtain the execution data by exporting or taking screenshots, and then compile it into a single stress test report after sorting. Obviously, it takes a lot of time and energy for staff to manually write test scripts, and the operation of adjusting stress parameters is cumbersome, resulting in low test efficiency. Summary of the invention
[0004] In view of this, the present invention aims to propose a performance stress testing platform and method, an electronic device and a computer-readable medium, in order to at least partially solve at least one of the above-mentioned technical problems.
[0005] In order to solve the above technical problems, the first aspect of the present invention proposes a performance stress testing platform, including:
[0006] The recording module is used to respond to user recording requests and record test scripts;
[0007] A parsing module, which is used to respond to the execution instruction, obtain the script to be executed from the recording module, and parse the script to be executed into elements to be tested; the elements to be tested refer to objects that need to be tested;
[0008] An online adjustment module, used to assemble the elements to be tested parsed by the parsing module into a thread pool according to the usage scenario, and generate an adjusted script to be tested;
[0009] The execution module is used to execute the script to be tested adjusted by the online adjustment module to generate execution data.
[0010] A second aspect of the present invention provides a performance stress testing method, which is applied to any of the above-mentioned performance stress testing platforms, and the method comprises the following steps:
[0011] Respond to user recording requests and record test scripts;
[0012] In response to the execution instruction, the script to be executed is obtained and the script to be executed is parsed into elements to be tested; the elements to be tested refer to objects to be tested;
[0013] Assemble the elements to be tested into a thread pool according to the usage scenario and generate the adjusted script to be tested;
[0014] Execute the adjusted script to be tested to generate execution data.
[0015] The third aspect of the present invention further proposes an electronic device, comprising a processor and a memory, wherein the memory is used to store a computer executable program, and when the computer program is executed by the processor, the processor executes the described method.
[0016] The fourth aspect of the present invention further proposes a computer-readable medium storing a computer-executable program, which implements the method when executed.
[0017] Based on the above technical solutions, it can be seen that the performance stress testing platform and method, electronic device and computer-readable medium of the present invention have at least one of the following beneficial effects compared with the prior art:
[0018] 1. The present invention records the test script of the test object through the recording module, and parses the script to be executed into elements to be tested through the parsing module; and assembles the elements to be tested into a thread pool according to the usage scenario through the online adjustment module to generate an adjusted script to be tested; supports online recording-adjustment-execution of scripts, and does not require staff to manually write and adjust test scripts, saving a lot of time and energy for staff, and is convenient and fast. At the same time, there is no need to install stress testing software locally, saving equipment resources.
[0019] 2. The recording module of the present invention is simple to operate for recording test scripts, has a low entry level, has relatively low professional requirements for staff, and has strong scalability.
[0020] 3. The import module of the present invention supports importing local test scripts, user-imported auxiliary test data files, etc., and supports local stress testing software to modify test scripts and parameterized configuration.
[0021] 4. The script database of the present invention supports the storage of recorded or imported test scripts, as well as auxiliary test data files, etc., to facilitate online adjustment and execution of target test scripts.
[0022] 5. The present invention parses the script to be executed through the parsing module, obtains the auxiliary test data file through the online adjustment module and adjusts the script to be executed according to the auxiliary test data file, supports online adjustment of pressure parameters, supports parameterized testing, supports BEANSHELL testing, supports the introduction of JAR packages, etc.
[0023] 6. The present invention can generate and display a test report with one click, and can store the report for easy report comparison. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 This is a schematic diagram of the structural framework of the performance stress testing platform of the first embodiment of the present invention;
[0025] Figure 2 It is a schematic diagram of a flow chart of parsing a script to be executed into elements to be tested according to an embodiment of the present invention;
[0026] Figure 3 This is a schematic diagram of the structural framework of the performance stress testing platform of the second embodiment of the present invention;
[0027] Figure 4 It is a schematic diagram of the flow of a performance stress testing method executed by a performance stress testing platform in Embodiment 2 of the present invention;
[0028] Figure 5 It is a schematic diagram of the flow of the performance stress testing method of the present invention;
[0029] Figure 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
[0030] Figure 7 is a schematic diagram of a computer-readable recording medium according to an embodiment of the present invention. DETAILED DESCRIPTION
[0031] In the process of introducing specific embodiments, the detailed description of the structure, performance, effect or other characteristics is to enable those skilled in the art to fully understand the embodiments. However, it does not exclude that those skilled in the art can implement the present invention with a technical solution that does not contain the above-mentioned structure, performance, effect or other characteristics under certain circumstances.
[0032] The flowchart in the accompanying drawings is only an exemplary process demonstration, and does not mean that the solution of the present invention must include all the contents, operations and steps in the flowchart, nor does it mean that it must be executed in the order shown in the figure. For example, some operations / steps in the flowchart can be decomposed, some operations / steps can be combined or partially combined, etc. The execution order shown in the flowchart can be changed according to actual conditions without departing from the main purpose of the present invention.
[0033] Frames in the attached figure Figure 1 Generally, it refers to functional entities, which do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processing unit devices and / or microcontroller devices.
[0034] The same reference numerals in the drawings represent the same or similar elements, components or parts, and thus the repeated description of the same or similar elements, components or parts may be omitted below. It should also be understood that although the first, second, third and other attributives representing the numbers may be used herein to describe various devices, elements, components or parts, these devices, elements, components or parts should not be limited by these attributives. In other words, these attributives are only used to distinguish one from another. For example, the first device may also be called the second device, but it does not deviate from the essential technical solution of the present invention. In addition, the terms "and / or" and "and / or" refer to all combinations including any one or more of the listed items.
[0035] In order to solve the technical problems that it takes a lot of time and effort for staff to manually write test scripts, and the adjustment of stress parameters is cumbersome, resulting in low test efficiency, the present invention proposes a performance stress testing platform, including:
[0036] The recording module is used to respond to user recording requests and record test scripts;
[0037] A parsing module, which is used to respond to the execution instruction, obtain the script to be executed from the recording module, and parse the script to be executed into elements to be tested; the elements to be tested refer to objects that need to be tested;
[0038] An online adjustment module, used to assemble the elements to be tested parsed by the parsing module into a thread pool according to the usage scenario, and generate an adjusted script to be tested;
[0039] The execution module is used to execute the script to be tested adjusted by the online adjustment module to generate execution data.
[0040] In a preferred embodiment, the parsing module includes:
[0041] The identification submodule is used to identify the key-value pairs of each script file in the script to be executed;
[0042] Split sub-modules and split each script file into different elements to be tested according to the key-value pairs identified by the identification sub-modules.
[0043] In a preferred embodiment, the online adjustment module is further used to obtain a data file for auxiliary testing, adjust the number and loop mode of the thread pool according to the data file, and generate an adjusted script to be tested.
[0044] In a preferred embodiment, the platform further comprises:
[0045] The import module is used to receive imported test scripts and / or auxiliary test data files imported by users.
[0046] In a preferred implementation, the import module is further used to receive modification parameters for the imported test script, and start the stress testing software to modify the imported test script according to the modification parameters.
[0047] In a preferred embodiment, the platform further comprises:
[0048] A script database is used to store the test scripts recorded by the recording module and the test scripts imported by the import module or auxiliary test data files; so that the parsing module obtains the script to be tested from the script database, and the online adjustment module obtains the auxiliary test data files from the script database.
[0049] In a preferred embodiment, the platform further comprises:
[0050] The display module is used to generate and display a test report according to the execution data.
[0051] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings.
[0052] Embodiment 1
[0053] Figure 1 Schematic diagram of the structure of a performance stress testing platform according to the first embodiment of the present invention. Figure 1 As shown, the platform includes: a recording module 11, an analysis module 12, an online adjustment module 13, and an execution module 14, wherein:
[0054] The recording module 11 is used to respond to the user's recording request and record the test script;
[0055] Taking the performance stress test of a web page as an example, the recording module 11 may include:
[0056] The receiving submodule is used to receive a first user operation and generate a user recording request. The first user operation may be a user clicking an icon / button of a recording in the performance stress testing platform interface.
[0057] The recording submodule is used to respond to the user recording request of the receiving submodule, receive the URL address of the test webpage input by the user, and record the test script according to the URL address.
[0058] The parsing module 12 is used to respond to the execution instruction, obtain the script to be executed from the recording module, and parse the script to be executed into elements to be tested;
[0059] In an embodiment of the present invention, the elements to be tested refer to all elements contained in the system to be tested and elements of the system or carrier related to the system to be tested. For example, all components, modules, algorithms, etc. in the Taobao system are elements to be tested, and some background configuration systems related thereto are also elements to be tested. Taking the test of the web page of the Taobao official website as an example, the elements to be tested may be the domain name, port, transmission parameters, etc. of the interface to be tested. The transmission parameters are the input and output data of the interface. The specific transmission parameters can be set according to the business logic interface, such as an interface for querying the health code, the transmission parameters are divided into input parameters and output parameters, the input parameters may be a face picture, and the output parameters may be the information data of the health code. Taking the http request interface as an example, the transmission parameters are the request body parameters (body) of the http request interface. Among them, the request body parameters (body) refer to the parameters stored in the request body and sent to the server. The format is relatively diverse and complex. The server will obtain the format based on the Content-Type in the request header, and then parse the parameters according to its format. Among them, the script to be executed can be a test script selected by the user by inputting the script information, or it can be a test script at the scheduled execution time. The execution instruction may be a pre-configured instruction for timing execution of the script to be executed, or a single execution instruction for the script to be executed input by the user. The execution of the execution instruction may be real-time, or delayed execution according to the timer configuration. The present invention does not make specific limitations.
[0060] Exemplarily, the parsing module 12 may include:
[0061] An acquisition submodule, used for responding to an execution instruction and acquiring a script to be executed from a plurality of test scripts of the recording module 11;
[0062] The identification submodule is used to identify the key-value pairs of each script file in the script to be executed;
[0063] Among them, a script to be executed is composed of one or more script files. The script file can be a .jmx file. In one example, an interface corresponds to a .jmx file, and a .jmx file can contain key-value pairs, Jmeter version information, test plan, thread group, http sample API (Hypertext Transfer Protocol Sample Application Programming Interface, referred to as http interface), preset response assertion elements, and extended components. Among them, the assertion element is used to check whether the tested response data is consistent with the program design. There is a component called assertion in Jmeter. After adding this component, the exported .jmx file will contain assertion verification data logic information, such as checking whether the response text contains the success string, which is true if it is included and false if it is not. This information is called assertion elements. The ways to install assertions are: response assertion, JSON assertion, size assertion, JSR223 assertion, Xpath assertion, Html assertion, XML assertion, MD5hex assertion, Beanshell assertion, etc. The assertion content can include: response text, response code, response information, response header, request header, URL sample, document, ignore status and request data, etc. The assertion methods include match, contain, equal, or, idempotent, etc.
[0064] like Figure 2 As shown: the identification submodule traverses each script file (.jmx file) in the script to be identified, obtains and opens each script file, calls the parsing API to match the element key in the script file key-value pair with the element key in the preset script file key-value pair based on regular expressions and precise matching algorithms, and if the match is successful, obtains the corresponding value through the element key in the matched script file key-value pair. Among them, the element key and value in the preset script file key-value pair are used to identify the element attributes of the script.
[0065] The splitting submodule splits each script file into different elements to be tested according to the key-value pairs identified by the identification submodule. Exemplarily, the splitting submodule parses the value of the key-value pairs of each script file, and if the value is the same thread group, the script file is marked as the same element to be tested. At this point, the script files in the script to be executed can be split into different elements to be tested.
[0066] Furthermore, the parsing module 12 may also include:
[0067] The feedback submodule is used to feed back the analysis result, which may include: analysis success and analysis failure. The feedback method may be text display or voice prompt.
[0068] The embodiment of the present invention distinguishes scopes through the parsing module 12, and splits the script files .jmx of the same scope into the same element to be tested, so as to ensure the full-process interface test of the script to be executed.
[0069] An online adjustment module 13, used to assemble the elements to be tested parsed by the parsing module into a thread pool according to the usage scenario, and generate an adjusted script to be tested;
[0070] Exemplarily, the elements to be tested of the same usage scenario can be assembled into a thread pool according to the element assembly jmx file. The usage scenario can be: parameter verification, controller call, etc., and the specific usage scenario can be obtained by the element assembly jmx file. In the assembly process, the elements to be tested of the same usage scenario can be assembled into a thread pool. Further, the number and loop mode of the thread pool can be adjusted according to the auxiliary test data file imported by the user to generate the adjusted script to be tested. Among them, the auxiliary test data file is used to generate specified test data or test data for realizing specific business scenarios, and the test data can be a JAR package. For example: encrypted user unique identification ID, these are encrypted algorithms, and the parameters passed in by the interface cannot be called smoothly without decryption, so it is necessary to assist in generating a computer file format (Java Archive, JAR) package to assist testing. Among them, the Jar package is a document format of ava, which is used to publish program files. The auxiliary test data file can obtain pressure parameters, controller parameters and other configuration parameters, thereby supporting online adjustment of pressure parameters, supporting parameterized testing, supporting BEANSHELL testing, supporting the introduction of JAR packages, etc.
[0071] The execution module 14 is used to execute the script to be tested adjusted by the online adjustment module to generate execution data.
[0072] In the embodiment of the present invention, the execution data generated by the execution module 14 is preferably a .jtl file, which facilitates the subsequent generation of an HTML visual test report.
[0073] Embodiment 2
[0074] Figure 3 Schematic diagram of the structure of a performance stress testing platform according to the second embodiment of the present invention. Figure 3 As shown, the platform includes: a script database 30, a recording module 31, an import module 32, a parsing module 33, an online adjustment module 34, an execution module 35, and a display module 36, wherein:
[0075] The recording module 11 may include:
[0076] The receiving submodule is used to receive a first user operation and generate a user recording request. The first user operation may be a user clicking an icon / button of a recording in the performance stress testing platform interface.
[0077] The recording submodule is used to respond to the user recording request of the receiving submodule, receive the URL address of the test webpage input by the user, and record the test script according to the URL address.
[0078] The automatic saving module is used to automatically save the recorded test script to the script database 30 to facilitate subsequent execution.
[0079] Exemplarily, the recording module 11 may use a browser plug-in with a recording function. Figure 4 , pre-load the browser plug-in into the performance stress testing platform browser, and display the corresponding recording icon or button on the interface of the performance stress testing platform. When the user clicks the recording icon or button, respond to the user's recording request, enter the recording interface of the browser plug-in, receive the URL address of the test web page input by the user, enter the page and perform test recording. After the test is completed, a .jmx file is generated and automatically saved in the script database 30.
[0080] In an embodiment of the present invention, the browser plug-in is preferably a BLAZEMETER that supports web form. Among them, BLAZEMETER is an interface recording script plug-in based on the chrome browser, which is a browsing function extension program with a file format of .crx. In an embodiment of the present invention, BLAZEMETER is secondary developed based on the browser, and the secondary development can be: developing the underlying functions of the browser, and the underlying functions can be some application extensions based on the browser kernel, involving some content development of html, css and js. Among them, an application extension is a group of files compressed together, including HTML, CSS, JavaScript scripts, image files and any other required files. An application extension is essentially a web page that can interact with the web page, such as recording script functions. The developed BLAZEMETER entrance is a visible recording icon or button in the performance stress testing platform. After the user clicks it, the BLAZEMETER recording interface will be executed. The embodiment of the present invention also performs secondary development on the BLAZEMETER recording interface, receives the URL address of the test web page input by the user, and performs the test operation after entering the page. After the test is completed, the .jmx file is automatically saved in the script database 30.
[0081] In addition, the browser plug-in can also use Badboy script recording tool, Loadrunner's Virtualuser generator, etc. to complete script recording.
[0082] The import module 32 is used to receive an imported test script and / or a test-aiding data file imported by a user.
[0083] Among them, the imported test scripts and the auxiliary test data files imported by the user can be stored in the local storage medium. The auxiliary test data files may include: parameter files and auxiliary program JAR packages. For example, user-defined parameters, JAR packages connecting to the script database, JARs that bypass certain specific scenarios, and so on. The auxiliary test data files can be stored in the script database 30 by uploading files or links on the performance stress testing platform. So that the subsequent online adjustment module 34 can obtain the auxiliary test data files from the script database 30 to complete the adjustment of the number of thread pools and the loop mode. Among them, the script database 30 can store data such as script files, auxiliary jar packages, intermediate values of preset function executions, and specific incoming parameters of the business.
[0084] Exemplarily, the parameter file may include: a parameter collection file passed in the interface, a preset default parameter file, a parameter file generated by a function assistant, a parameter file uploaded locally and a custom variable, etc. Among them, the preset default parameter file is a general file pre-imported into the database, which is used to quickly pass parameters and improve efficiency. The general file contains general parameters that must be passed in but have no special requirements for the corresponding values, and general indicator data for performance testing. The general parameters passed in may be: gender: female, city: Beijing, starting page number: 1, number of pages: 10; the general performance indicator data for performance stress testing may include: thinking time, file data reading method CSV Data Set Config Fileencoding defaults to UTF-8, Delimiter defaults to comma, Allow quoted data defaults to false, etc. There are other configurations, such as preprocessors, timers, samplers, postprocessors, assertions, and listeners. These configurations have many respective properties that can be set as default values. The parameter file generated by the function assistant can be: a parameter file automatically generated according to the parameter name and function type entered by the user, and the function parameters, such as a random mobile phone number generation function can generate a user account parameter file, a timestamp function can randomly generate a creation date parameter file, etc. The JAR package includes: a general JAR package and a JAR package written according to test needs. Among them, the general JAR package can be: jdbc driver package mysql-connector-java-5.1.28.JAR, sqljdbc4.JAR, ojdbc14.JAR, etc.; the JAR package written according to test needs can be: first write the program in java code and make a JAR package, and then upload it to the script database 30 through the import module 32.
[0085] Furthermore, the import module 32 is also used to receive modification parameters of the imported test script, and start the stress testing software to modify the imported test script according to the modification parameters, and receive and display the modified test script.
[0086] Wherein, the modification parameters may include: the incoming parameters of the interface and the jmeter configuration components, pre- and post-processors, timers, samplers, assertions and listener properties. Wherein, the incoming parameters of the interface need to be parameterized by calling a suitable parameterization file or directly modifying the parameter value. The property modification of the configuration component of Jmeter itself is carried out in a direct modification manner. The stress testing software may use JMETER, LOADRUNNER, etc. Through the import module 32, the performance stress testing platform may support the parameter modification of the test script by the local stress testing software, and the modified test script is uploaded to the performance stress testing platform, and the modified test script content is displayed. Wherein, the display method of the test script content may be similar to JMETER.
[0087] The script database 30 is used to store the test scripts recorded by the recording module and the test scripts imported by the import module or the data files of the auxiliary test; so that the parsing module obtains the script to be tested from the script database, and the online adjustment module obtains the data files of the auxiliary test from the script database.
[0088] The parsing module 33 is used to respond to the execution instruction, obtain the script to be executed from the recording module, and parse the script to be executed into elements to be tested; the specific execution process can refer to the parsing module 12 in the first embodiment, which will not be repeated here.
[0089] The online adjustment module 34 is used to assemble the elements to be tested parsed by the parsing module into a thread pool according to the usage scenario, obtain the data file of the auxiliary test from the script database 30, adjust the number and loop mode of the thread pool according to the data file, and generate an adjusted script to be tested.
[0090] Exemplarily, during the assembly process, the elements to be tested of the same usage scenario can be assembled into a thread pool. Specifically, the elements to be tested of the same usage scenario can be assembled into a thread pool according to the element assembly jmx file. The element assembly jmx file can be added according to user input or by element matching. Among them, in the user input addition, the jmx file with modified parameters selected by the user can be added to a thread group ThreadGroup, and then added to the same test plan TestPlan. In the element matching addition, the parsed and modified elements are aggregated according to the association relationship. The association relationship can be determined according to the specific situation, such as the parameter association of each http sample api during verification. If the interface output parameter is the parameter of another interface, then these two interfaces need to be added to the same thread pool. For example, if the scope of the pre-processor of the verification is a separate interface, the pre-element needs to be added to the thread pool at the same time as this interface. For example, the number attribute of the controller is just to call the interface in sequence, but the loop mode of another thread group is 2 times, then the interface controlled by this controller cannot be automatically added to another thread group, and will not be assembled into a thread pool. The above situations and those not mentioned in the examples will be implemented in the program code, and the corresponding thread pool will be automatically added after parsing the modified jmx file.
[0091] Furthermore, during the assembly process, the auxiliary test data file imported by the user can be selected according to the usage scenario to adjust the number and loop mode of the thread pool to generate an adjusted script to be tested.
[0092] The execution module 35 is used to execute the script to be tested adjusted by the online adjustment module to generate execution data.
[0093] The display module 36 is used to generate and display a test report according to the execution data. Further, the display module 36 can store the test report, compare the multiple test reports and display the comparison results when receiving a user's instruction to compare multiple test reports, and display the test report when receiving a user's instruction to download at least one test report. Thus, the functions of comparing and downloading test reports can be supported.
[0094] Those skilled in the art will appreciate that the modules in the above device embodiments may be distributed in the device as described, or may be changed accordingly and distributed in one or more devices different from the above embodiments. The modules in the above embodiments may be combined into one module, or may be further split into multiple submodules.
[0095] Figure 5 is a flow chart of a performance stress testing method provided by the present invention, which is applied to any of the performance stress testing platforms described above, such as Figure 5As shown, the method comprises the following steps:
[0096] S1. Respond to user recording request and record test script;
[0097] Exemplarily, this step may include:
[0098] S11, receiving a first user operation and generating a user recording request, wherein the first user operation may be a user clicking an operation of a recording icon / button in an interface of the performance stress testing platform.
[0099] S12, responding to the user's recording request, receiving the URL address of the test web page input by the user, and recording the test script according to the URL address.
[0100] S13. The recorded test script is automatically saved in the script database to facilitate subsequent execution.
[0101] In one example, a browser plug-in with a recording function may be used. Figure 4 , pre-load the browser plug-in into the performance stress testing platform browser, and display the corresponding recording icon or button on the interface of the performance stress testing platform. When the user clicks the recording icon or button, respond to the user's recording request, enter the recording interface of the browser plug-in, receive the URL address of the test web page entered by the user, and perform test recording after entering the page. After the test is completed, a .jmx file is generated and automatically saved in the script database.
[0102] S2, responding to the execution instruction, obtaining the script to be executed and parsing the script to be executed into elements to be tested; the elements to be tested refer to objects to be tested;
[0103] Exemplary steps may include:
[0104] S21, identifying the key-value pairs of each script file in the script to be executed;
[0105] like Figure 2 As shown: Each script file in the script to be identified can be obtained and opened, and the element key in the script file key-value pair and the element key in the preset script file key-value pair are matched based on regular expressions and precise matching algorithms. If the match is successful, the corresponding value is obtained through the element key in the matched script file key-value pair. Among them, the element key and value in the preset script file key-value pair are used to identify the element attributes of the script.
[0106] S22. Split each script file into different elements to be tested according to the key-value pairs.
[0107] Exemplarily, the value of the key-value pair of each script file can be parsed. If the value is the same thread group, the script file is marked as the same element to be tested. At this point, the script files in the script to be executed can be split into different elements to be tested.
[0108] Furthermore, the analysis result can be fed back, and the analysis result can include: analysis success and analysis failure. The feedback method can be text display or voice prompt.
[0109] S3. Assemble the elements to be tested into a thread pool according to the usage scenario and generate an adjusted script to be tested;
[0110] Preferably, after assembling the elements to be tested into a thread pool according to the usage scenario, a data file for auxiliary testing can be obtained, and the number and loop mode of the thread pool can be adjusted according to the data file to generate an adjusted script to be tested.
[0111] S4. Execute the adjusted script to be tested to generate execution data.
[0112] S5. Generate and display a test report according to the execution data.
[0113] The present invention also supports importing and storing local test scripts, supports local stress testing software to modify test script parameters, uploads the modified test scripts to the performance stress testing platform, and displays the modified test script content. Therefore, the method may also include:
[0114] S6. Receive the imported test script, and / or the auxiliary test data file imported by the user; receive the modification parameters of the imported test script, and start the stress testing software to modify the imported test script according to the modification parameters.
[0115] Wherein, step S6 may be performed before or after any of the above steps S1 to S5, and the present invention does not make any specific limitation thereto.
[0116] Figure 6 It is a structural diagram of an electronic device of an embodiment of the present invention. The electronic device includes a processor and a memory. The memory is used to store a computer executable program. When the computer program is executed by the processor, the processor executes a performance stress testing platform.
[0117] like Figure 6 As shown, the electronic device is presented in the form of a general computing device. The processor may be one or more and work in coordination. The present invention does not exclude distributed processing, that is, the processor may be dispersed in different physical devices. The electronic device of the present invention is not limited to a single entity, but may also be the sum of multiple physical devices.
[0118] The memory stores a computer executable program, which is usually a machine-readable code. The computer-readable program can be executed by the processor to enable the electronic device to perform the method of the present invention, or at least part of the steps in the method.
[0119] The memory includes a volatile memory, such as a random access memory unit (RAM) and / or a cache memory unit, and may also be a non-volatile memory, such as a read-only memory unit (ROM).
[0120] Optionally, in this embodiment, the electronic device further includes an I / O interface, which is used for the electronic device to exchange data with an external device. The I / O interface can represent one or more of several types of bus structures, including a storage unit bus or a storage unit controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of a variety of bus structures.
[0121] It should be understood that Figure 6 The electronic device shown is only an example of the present invention, and the electronic device of the present invention may also include elements or components not shown in the above examples. For example, some electronic devices also include display units such as display screens, and some electronic devices also include human-computer interaction elements such as buttons, keyboards, etc. As long as the electronic device can execute the computer-readable program in the memory to implement the method of the present invention or at least part of the steps of the method, it can be considered as an electronic device covered by the present invention.
[0122] Figure 7 Schematic diagram of a computer readable recording medium according to an embodiment of the present invention. Figure 7 As shown, a computer executable program is stored in a computer-readable recording medium, and when the computer executable program is executed, the performance stress testing platform of the present invention is implemented. The computer-readable storage medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0123] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0124] Through the above description of the implementation method, it is easy for those skilled in the art to understand that the present invention can be implemented by hardware capable of executing a specific computer program, such as the system of the present invention, and the electronic processing unit, server, client, mobile phone, test unit, processor, etc. contained in the system. The present invention can also be implemented by a vehicle containing at least a part of the above system or components. The present invention can also be implemented by computer software that executes the method of the present invention, such as test software executed by a microprocessor, an electronic test unit, a client, a server, etc. of a live broadcast device. However, it should be noted that the computer software that executes the method of the present invention is not limited to being executed by one or a specific hardware entity, and it can also be implemented in a distributed manner by unspecified specific hardware. For computer software, the software product can be stored in a computer-readable storage medium (which can be a CD-ROM, a U disk, a mobile hard disk, etc.), or it can be distributed and stored on the network, as long as it enables the electronic device to execute the method according to the present invention.
[0125] The specific embodiments described above further describe the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the present invention is not inherently related to any specific computer, virtual device or electronic device, and various general devices can also implement the present invention. The above description is only a specific embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A performance stress testing platform, characterized in that: include: The recording module is used to respond to user recording requests and record test scripts; A parsing module is used to respond to the execution instruction, obtain the script to be executed from the recording module, and traverse each script file in the script to be identified, obtain and open each script file, call the parsing API to match the element key in the script file key-value pair with the element key in the preset script file key-value pair based on regular expressions and precise matching algorithms, if the match is successful, obtain the corresponding value value through the element key in the key-value pair of the successfully matched script file, parse the value value of each script file key-value pair, and if the value value is the same thread group, mark the script file as the same element to be tested; The element to be tested refers to the object that needs to be tested; An online adjustment module, used to assemble the elements to be tested parsed by the parsing module into a thread pool according to the usage scenario, and generate an adjusted script to be tested; The execution module is used to execute the script to be tested adjusted by the online adjustment module to generate execution data.
2. The performance stress testing platform according to claim 1, characterized in that: The online adjustment module is also used to obtain a data file for auxiliary testing, adjust the number and loop mode of the thread pool according to the data file, and generate an adjusted script to be tested.
3. The performance stress testing platform according to claim 2, characterized in that: The platform also includes: The import module is used to receive imported test scripts and / or auxiliary test data files imported by users.
4. The performance stress testing platform according to claim 3, characterized in that: The import module is further used to receive modification parameters for the imported test script, and start the stress testing software to modify the imported test script according to the modification parameters.
5. The performance stress testing platform according to claim 3, characterized in that: The platform also includes: A script database is used to store the test scripts recorded by the recording module and the test scripts imported by the import module or auxiliary test data files; so that the parsing module obtains the script to be tested from the script database, and the online adjustment module obtains the auxiliary test data files from the script database.
6. The performance stress testing platform according to claim 1, characterized in that: The platform also includes: The display module is used to generate and display a test report according to the execution data.
7. A performance stress testing method, characterized in that: Applied to the performance stress testing platform according to any one of claims 1 to 6, the method comprises the following steps: Respond to user recording requests and record test scripts; In response to the execution instruction, the script to be executed is obtained and each script file in the script to be identified is traversed, each script file is obtained and opened, and the parsing API is called to match the element key in the script file key-value pair with the element key in the preset script file key-value pair based on regular expressions and precise matching algorithms. If the match is successful, the corresponding value is obtained through the element key in the key-value pair of the successfully matched script file, and the value of each script file key-value pair is parsed. If the value is the same thread group, the script files are marked as the same element to be tested; The element to be tested refers to the object that needs to be tested; Assemble the elements to be tested into a thread pool according to the usage scenario and generate the adjusted script to be tested; Execute the adjusted script to be tested to generate execution data.
8. An electronic device, comprising a processor and a memory, wherein the memory is used to store a computer executable program, wherein: When the computer executable program is executed by the processor, the processor performs the method of claim 7.
9. A computer-readable medium storing a computer-executable program, characterized in that: When the computer executable program is executed, the method according to claim 7 is implemented.
