Automatic performance testing method and system based on JMeter secondary development
By JMETER -based automatic performance testing methods, the problem of low performance test complexity and efficiency in existing technologies is solved, and the effect of simplifying the test process and improving work efficiency is achieved.
Patent Information
- Application Number
- CN202411504451.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-26
- Publication Date
- 2025-01-28
AI Technical Summary
In the performance testing of existing technologies, there are problems such as complex script writing, limited resource monitoring scope, and complex test result analysis, resulting in inefficiency between development and testing parties.
Based on JMETER's secondary development of automated performance testing methods, target testing items are obtained, the requirements for extracting performance indicators, constructing performance testing plans, running test scenes, analyzing performance index values, generating test reports, simplifying the test process and improving efficiency.
It has significantly improved the efficiency of the development and testing, reduced the complexity of the learning curve and test results of the testers, eliminates the dependence of the test environment, and meets the performance test needs of different scenes.
Smart Images

Figure CN119377069A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software development and operation and maintenance technology, and more specifically, to an automated performance testing method and system based on JMeter secondary development. Background Art
[0002] Performance testing is an indispensable part of software development and operation and maintenance. With the rapid development of the Internet and the increasing requirements of users for system performance, it is particularly important to ensure that the system can still run stably under high load and respond quickly to user requests. Performance testing puts pressure on the system by simulating user behavior to obtain performance indicators such as system response time, throughput, and resource utilization, thereby helping developers and operation and maintenance personnel to find system bottlenecks and optimize system performance. Traditionally, most of the performance testing tools we use are commercial and open source versions, but there are still many shortcomings, such as complex script writing, difficult resource detection, and complex result analysis.
[0003] Therefore, the prior art has defects and needs to be improved urgently. Summary of the invention
[0004] In view of the above problems, the purpose of the present invention is to provide an automated performance testing method and system based on JMeter secondary development, which can solve the problems of the prior art in performance testing, complex script writing, limited resource monitoring range, complex test result analysis, etc., and significantly improve the work efficiency of both development and testing.
[0005] The first aspect of the present invention provides an automated performance testing method based on JMeter secondary development, comprising:
[0006] Get the target test items;
[0007] Extract the performance index requirements from the target test items;
[0008] Construct a performance test plan based on the performance indicator requirements of the target test project;
[0009] Extract the test scenarios in the performance test plan and run them to obtain the test process log;
[0010] The performance indicator values in the test process log are extracted and analyzed to obtain a test report.
[0011] In this solution, the step of obtaining the target test items specifically includes:
[0012] Get the input project name and login address;
[0013] Associate the input project name and login address to build the current target test project;
[0014] Compare and analyze the current target test item with the preset target test item. If there is a consistency, a prompt message is triggered, and the preset target test item that is consistent with the current target test item is sent to the preset display terminal for display;
[0015] If there is no consistency, the corresponding target test items will be sent to the preset management terminal for unified management.
[0016] In this solution, the steps of constructing a performance test solution specifically include:
[0017] Get test account information;
[0018] Verify the test account based on the preset verification terminal. If the verification is successful, build a test scenario based on the performance indicator requirements in the target test project;
[0019] Based on the path in the test scenario, the interface of the test scenario is parsed to obtain the Jmx script;
[0020] The Jmx script is sent to the test account end for display.
[0021] In this solution, after obtaining the test report, the following steps are included:
[0022] Get the application server and database IP corresponding to the target test project;
[0023] Based on the preset configuration system, the resource usage data of the Worker node server resources and the Rds database in the K8s cluster are obtained according to the application server and database IP corresponding to the target test project;
[0024] The resource usage data and the test reports under the corresponding resource usage data are associated and stored.
[0025] In this solution, the step of analyzing the performance indicator value includes:
[0026] Extract the performance indicator values in the test process log and the performance indicator requirements in the target test items;
[0027] According to the performance indicators, determine the performance indicator requirements corresponding to the same performance indicators;
[0028] If the performance indicator value in the test process log is within the performance indicator requirement range of the corresponding same performance indicator, the corresponding performance indicator value is normal and the corresponding performance indicator is qualified in the test report;
[0029] If the performance indicator value in the test process log is not within the performance indicator requirement range corresponding to the same performance indicator, the corresponding performance indicator value is abnormal and the corresponding performance indicator is unqualified in the test report.
[0030] In this solution, the step of analyzing the performance indicator value also includes:
[0031] Build a result analysis Gantt chart based on the performance indicator values in the test process log;
[0032] The corresponding values of the performance indicator requirements of the same performance indicator are marked in the result analysis Gantt chart;
[0033] The result analysis Gantt chart is sent to the preset management terminal for display.
[0034] In this solution, after obtaining the test results, the method further includes: archiving the test report and the script in a unified manner, and sending the archived script and the test report to a preset sharing terminal for display.
[0035] A second aspect of the present invention provides an automated performance testing system based on JMeter secondary development, including a memory and a processor, wherein the memory stores an automated performance testing method program based on JMeter secondary development, and when the automated performance testing method program based on JMeter secondary development is executed by the processor, the following steps are implemented:
[0036] Get the target test items;
[0037] Extract the performance index requirements from the target test items;
[0038] Construct a performance test plan based on the performance indicator requirements of the target test project;
[0039] Extract the test scenarios in the performance test plan and run them to obtain the test process log;
[0040] The performance indicator values in the test process log are extracted and analyzed to obtain a test report.
[0041] In this solution, the step of obtaining the target test items specifically includes:
[0042] Get the input project name and login address;
[0043] Associate the input project name and login address to build the current target test project;
[0044] Compare and analyze the current target test item with the preset target test item. If there is a consistency, a prompt message is triggered, and the preset target test item that is consistent with the current target test item is sent to the preset display terminal for display;
[0045] If there is no consistency, the corresponding target test items will be sent to the preset management terminal for unified management.
[0046] In this solution, the steps of constructing a performance test solution specifically include:
[0047] Get test account information;
[0048] Verify the test account based on the preset verification terminal. If the verification is successful, build a test scenario based on the performance indicator requirements in the target test project;
[0049] Based on the path in the test scenario, the interface of the test scenario is parsed to obtain the Jmx script;
[0050] The Jmx script is sent to the test account end for display.
[0051] The automated performance testing method and system based on JMeter secondary development disclosed in the present invention can meet the performance testing needs of different scenarios, reduce the learning curve of testers, reduce the complexity of test result analysis, eliminate the dependence on the test environment, and improve the work efficiency of testers and developers on weekends and holidays. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 The flowchart of the automated performance testing method based on JMeter secondary development of the present invention is shown;
[0053] Figure 2 The block diagram of the automated performance testing system of the present invention based on the secondary development of JMeter is shown. DETAILED DESCRIPTION
[0054] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0055] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.
[0056] Figure 1 The flowchart of the automated performance testing method based on JMeter secondary development of the present invention is shown.
[0057] like Figure 1 As shown, the present invention discloses an automated performance testing method based on JMeter secondary development, including:
[0058] S101, obtaining target test items;
[0059] S102, extracting performance index requirements of target test items;
[0060] S103, constructing a performance test plan according to the performance indicator requirements of the target test project;
[0061] S104, extracting and running the test scenarios in the performance test solution to obtain a test process log;
[0062] S105, extracting the performance indicator values in the test process log, and analyzing the performance indicator values to obtain a test report.
[0063] According to an embodiment of the present invention, the performance indicators in the target test project include response time, throughput, error rate, etc. If the performance indicator is response time, the corresponding performance indicator requirement is the response time requirement of the corresponding software during the test process, such as the response time requirement is 0 to 3 seconds.
[0064] According to an embodiment of the present invention, the step of obtaining the target test item specifically includes:
[0065] Get the input project name and login address;
[0066] Associate the input project name and login address to build the current target test project;
[0067] Compare and analyze the current target test item with the preset target test item. If there is a consistency, a prompt message is triggered, and the preset target test item that is consistent with the current target test item is sent to the preset display terminal for display;
[0068] If there is no consistency, the corresponding target test items will be sent to the preset management terminal for unified management.
[0069] It should be noted that the project name and login address are entered in the preset shared service portal - Quality Inspection Center, and a new target test project is created with the entered project name and login address, which is the current target test project; the preset target test project is the historical data stored in the preset management end. When the target test project is consistent with the preset target test project, it means that the current target test project has been completed; if the target test project is not consistent with the preset target test project, the current target test project will be sent to the preset management end for unified management.
[0070] According to an embodiment of the present invention, the step of constructing a performance test solution specifically includes:
[0071] Get test account information;
[0072] Verify the test account based on the preset verification terminal. If the verification is successful, build a test scenario based on the performance indicator requirements in the target test project;
[0073] Based on the path in the test scenario, the interface of the test scenario is parsed to obtain the Jmx script;
[0074] The Jmx script is sent to the test account end for display.
[0075] It should be noted that the step of constructing a test scenario based on the performance indicator requirements in the target test project specifically includes: classifying the performance indicators in the target test project to obtain multiple sub-performance indicators; querying in a preset test sub-scenario table based on the sub-performance indicators to determine the initial test sub-scenario corresponding to the sub-performance indicator; extracting the sub-performance indicator requirements, and dividing the sub-performance indicator requirements into levels according to a preset indicator range to determine the requirement level of each sub-performance indicator; multiplying the sub-performance indicator requirement level by the parameter weight coefficient of the corresponding sub-performance indicator to obtain the test sub-scenario parameters of the corresponding sub-performance indicator; setting the initial test sub-scenario of the sub-performance indicator based on the test sub-scenario parameters to obtain the test sub-scenario corresponding to the sub-performance indicator; and sorting the test sub-scenario of all sub-performance indicators according to a preset sorting rule. The test scenarios corresponding to the performance index requirements in the target test items are obtained by combining the rows; various sub-performance indexes and corresponding initial test sub-scenario are stored in the preset test sub-scenario table; the test process is determined according to the sorting rules of the initial test sub-scenario in the test scenario, and the path in the corresponding test scenario is constructed with the corresponding test sub-scenario parameters as the path nodes; the Jmx script is generated by automatically parsing the interface of the test scenario through the preset server; there is no need to use the HTTP proxy server to record the script by setting the browser proxy; the generated script can be directly used by simply modifying the test account end; further, the preset sorting rules can be one or more; when it is one sorting rule, one test scenario is generated; when it is multiple sorting rules, multiple sequencing scenarios are constructed.
[0076] It should be noted that when there are multiple sequencing scenarios, multiple sequencing reports in the multiple sequencing scenarios are extracted; if the performance indicators in the multiple sequencing reports are all qualified, the performance indicator values in the sequencing reports are extracted; based on the preset performance weight coefficient, the performance indicator value in the sequencing report is multiplied by the performance weight coefficient to obtain the weight score of the corresponding performance indicator; the weight scores of the performance indicators in the same sequencing report are added up to obtain the total weight score of the corresponding sequencing report; the multiple sequencing reports are arranged in order from large to small according to the corresponding total weight scores and sent to the test account end for display, and the sequencing scenarios corresponding to the sequencing reports are sent to the sequencing account end for display.
[0077] It should be noted that when there are multiple test scenarios and there are unqualified performance indicators in all sequencing reports, the number of unqualified performance indicators in each sequencing report is recorded; and the sequencing report with the least number of unqualified performance indicators is extracted, and the sequencing report with the least number of unqualified performance indicators is used as a benchmark, and compared and analyzed with other sequencing reports in turn, and the performance indicator values of the same performance indicators are calculated differentially; the performance indicator difference corresponding to the unqualified performance indicators is obtained; the test scenarios of the two sequencing reports for comparative analysis are extracted, and the difference of the same test sub-scenario parameters in the corresponding two sequencing scenarios is calculated differentially to obtain the test sub-scenario parameter difference corresponding to the unqualified performance indicators; the test sub-scenario parameter difference corresponding to the unqualified performance indicators is divided by the performance indicator difference corresponding to the unqualified performance indicators to obtain the adjustment coefficient; all test scenarios are traversed to obtain the test sub-scenario adjustment parameter set corresponding to the unqualified performance indicator; the adjustment coefficient in the test sub-scenario adjustment parameter set corresponding to the unqualified performance indicator is adjusted. The coefficient is averaged to obtain an average adjustment coefficient; the average adjustment coefficient is then used in turn to perform difference calculation with the adjustment coefficient to obtain a first difference; if the first difference is greater than a preset first threshold, the adjustment coefficient corresponding to the first difference is deleted, and the average adjustment coefficient is recalculated until the first difference between all adjustment coefficients and the average adjustment coefficient is less than or equal to the preset first threshold; if the unqualified performance indicator value is less than the corresponding performance indicator requirement, the minimum standard value in the corresponding performance indicator requirement is extracted, and the corresponding unqualified performance indicator value is subtracted from the minimum standard value to obtain a performance indicator adjustment difference; if the unqualified performance indicator value is greater than the corresponding performance indicator requirement, the maximum standard value in the corresponding performance indicator requirement is extracted, and the corresponding unqualified performance indicator value is subtracted from the maximum standard value to obtain a performance indicator adjustment difference; then the corresponding performance indicator adjustment difference is multiplied by the corresponding average adjustment coefficient to obtain a test sub-scenario adjustment parameter corresponding to the unqualified performance indicator; and the test scenario is adjusted according to the test sub-scenario adjustment parameter.
[0078] According to an embodiment of the present invention, after obtaining the test report, the process includes:
[0079] Get the application server and database IP corresponding to the target test project;
[0080] Based on the preset configuration system, the resource usage data of the Worker node server resources and the Rds database in the K8s cluster are obtained according to the application server and database IP corresponding to the target test project;
[0081] The resource usage data and the test reports under the corresponding resource usage data are associated and stored.
[0082] It should be noted that resource usage data is stored for later performance diagnosis and performance tuning.
[0083] According to an embodiment of the present invention, the step of analyzing the performance indicator value includes:
[0084] Extract the performance indicator values in the test process log and the performance indicator requirements in the target test items;
[0085] According to the performance indicators, determine the performance indicator requirements corresponding to the same performance indicators;
[0086] If the performance indicator value in the test process log is within the performance indicator requirement range of the corresponding same performance indicator, the corresponding performance indicator value is normal and the corresponding performance indicator is qualified in the test report;
[0087] If the performance indicator value in the test process log is not within the performance indicator requirement range corresponding to the same performance indicator, the corresponding performance indicator value is abnormal and the corresponding performance indicator is unqualified in the test report.
[0088] It should be noted that during the test, it is necessary to analyze the performance indicator values, such as response time, throughput, error rate and other performance indicators, to draw test conclusions; the test report records the performance indicator values and the test conclusions drawn based on the corresponding performance indicator values.
[0089] According to an embodiment of the present invention, the step of analyzing the performance indicator value further includes:
[0090] Build a result analysis Gantt chart based on the performance indicator values in the test process log;
[0091] The corresponding values of the performance indicator requirements of the same performance indicator are marked in the result analysis Gantt chart;
[0092] The result analysis Gantt chart is sent to the preset management terminal for display.
[0093] It should be noted that the preset management end is operated by corresponding development and testing personnel, and the system performance bottleneck can be analyzed intuitively through the result analysis Gantt chart.
[0094] According to the embodiment of the present invention, after obtaining the test result, the method further includes: archiving the test report and the script in a unified manner, and sending the archived script and the test report to a preset sharing terminal for display.
[0095] It should be noted that after the sequencing scenario is executed, the test report and script are archived at the same time, and the archived script and test report are shared. The shared script and test report are convenient for other testers to use.
[0096] Figure 2 The block diagram of the automated performance testing system of the present invention based on the secondary development of JMeter is shown.
[0097] like Figure 2 As shown, the second aspect of the present invention provides an automated performance testing system 2 based on JMeter secondary development, including a memory 21 and a processor 22, wherein the memory stores an automated performance testing method program based on JMeter secondary development, and the automated performance testing method program based on JMeter secondary development is executed by the processor to implement the following steps:
[0098] Get the target test items;
[0099] Extract the performance index requirements from the target test items;
[0100] Construct a performance test plan based on the performance indicator requirements of the target test project;
[0101] Extract the test scenarios in the performance test plan and run them to obtain the test process log;
[0102] The performance indicator values in the test process log are extracted and analyzed to obtain a test report.
[0103] According to an embodiment of the present invention, the step of obtaining the target test item specifically includes:
[0104] Get the input project name and login address;
[0105] Associate the input project name and login address to build the current target test project;
[0106] Compare and analyze the current target test item with the preset target test item. If there is a consistency, a prompt message is triggered, and the preset target test item that is consistent with the current target test item is sent to the preset display terminal for display;
[0107] If there is no consistency, the corresponding target test items will be sent to the preset management terminal for unified management.
[0108] According to an embodiment of the present invention, the step of constructing a performance test solution specifically includes:
[0109] Get test account information;
[0110] Verify the test account based on the preset verification terminal. If the verification is successful, build a test scenario based on the performance indicator requirements in the target test project;
[0111] Based on the path in the test scenario, the interface of the test scenario is parsed to obtain the Jmx script;
[0112] The Jmx script is sent to the test account end for display.
[0113] The automated performance testing method and system based on JMeter secondary development disclosed in the present invention can meet the performance testing needs of different scenarios, reduce the learning curve of testers, reduce the complexity of test result analysis, eliminate the dependence on the test environment, and improve the work efficiency of testers and developers on weekends and holidays.
[0114] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0115] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0116] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0117] Those skilled in the art can understand that: all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiments; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), disks or optical disks, etc. Various media that can store program codes.
[0118] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
Claims
1. The automated performance testing method based on JMeter secondary development is characterized by: include: Get the target test item; Extract the performance index requirements from the target test items; Construct a performance test plan based on the performance indicator requirements of the target test project; Extract the test scenarios in the performance test plan and run them to obtain the test process log; The performance indicator values in the test process log are extracted and analyzed to obtain a test report.
2. The automated performance testing method based on JMeter secondary development according to claim 1 is characterized in that: The step of obtaining the target test item specifically includes: Get the input project name and login address; Associate the input project name and login address to build the current target test project; Compare and analyze the current target test item with the preset target test item. If there is a consistency, a prompt message is triggered, and the preset target test item that is consistent with the current target test item is sent to the preset display terminal for display; If there is no consistency, the corresponding target test items will be sent to the preset management terminal for unified management.
3. The automated performance testing method based on JMeter secondary development according to claim 1 is characterized in that: The steps of constructing the performance test plan specifically include: Get test account information; Verify the test account based on the preset verification terminal. If the verification is successful, build a test scenario based on the performance indicator requirements in the target test project; Based on the path in the test scenario, the interface of the test scenario is parsed to obtain the Jmx script; The Jmx script is sent to the test account end for display.
4. The automated performance testing method based on JMeter secondary development according to claim 1 is characterized in that: After obtaining the test report, it includes: Get the application server and database IP corresponding to the target test project; Based on the preset configuration system, the resource usage data of the Worker node server resources and the Rds database in the K8s cluster are obtained according to the application server and database IP corresponding to the target test project; The resource usage data and the test reports under the corresponding resource usage data are associated and stored.
5. The automated performance testing method based on JMeter secondary development according to claim 1 is characterized in that: The step of analyzing the performance indicator value includes: Extract the performance indicator values in the test process log and the performance indicator requirements in the target test items; According to the performance indicators, determine the performance indicator requirements corresponding to the same performance indicators; If the performance indicator value in the test process log is within the performance indicator requirement range of the corresponding same performance indicator, the corresponding performance indicator value is normal and the corresponding performance indicator is qualified in the test report; If the performance indicator value in the test process log is not within the performance indicator requirement range corresponding to the same performance indicator, the corresponding performance indicator value is abnormal and the corresponding performance indicator is unqualified in the test report.
6. The automated performance testing method based on JMeter secondary development according to claim 5 is characterized in that: The step of analyzing the performance indicator value also includes: Build a result analysis Gantt chart based on the performance indicator values in the test process log; The corresponding values of the performance indicator requirements of the same performance indicator are marked in the result analysis Gantt chart; The result analysis Gantt chart is sent to the preset management terminal for display.
7. The automated performance testing method based on JMeter secondary development according to claim 1 is characterized in that: After the test results are obtained, the method further includes: archiving the test report and the script in a unified manner, and sending the archived script and the test report to a preset sharing terminal for display.
8. Based on the secondary development of JMeter, the automated performance testing system is characterized by: The system comprises a memory and a processor, wherein the memory stores an automated performance testing method program based on the secondary development of JMeter, and when the automated performance testing method program based on the secondary development of JMeter is executed by the processor, the following steps are implemented: Get the target test item; Extract the performance index requirements from the target test items; Construct a performance test plan based on the performance indicator requirements of the target test project; Extract the test scenarios in the performance test plan and run them to obtain the test process log; The performance indicator values in the test process log are extracted and analyzed to obtain a test report.
9. The automated performance testing system based on JMeter secondary development according to claim 8 is characterized in that: The step of obtaining the target test item specifically includes: Get the input project name and login address; Associate the input project name and login address to build the current target test project; Compare and analyze the current target test item with the preset target test item. If there is a consistency, a prompt message is triggered, and the preset target test item that is consistent with the current target test item is sent to the preset display terminal for display; If there is no consistency, the corresponding target test items will be sent to the preset management terminal for unified management.
10. The automated performance testing system based on JMeter secondary development according to claim 8, characterized in that: The steps of constructing the performance test plan specifically include: Get test account information; Verify the test account based on the preset verification terminal. If the verification is successful, build a test scenario based on the performance indicator requirements in the target test project; Based on the path in the test scenario, the interface of the test scenario is parsed to obtain the Jmx script; The Jmx script is sent to the test account end for display.