CN115248782A - Automatic testing method and device and computer equipment - Google Patents
Automatic testing method and device and computer equipment Download PDFInfo
- Publication number
- CN115248782A CN115248782A CN202211156627.7A CN202211156627A CN115248782A CN 115248782 A CN115248782 A CN 115248782A CN 202211156627 A CN202211156627 A CN 202211156627A CN 115248782 A CN115248782 A CN 115248782A
- Authority
- CN
- China
- Prior art keywords
- scene
- pressure measurement
- class
- module
- index
- 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.)
- Granted
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
-
- 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)
- Measuring Fluid Pressure (AREA)
- General Factory Administration (AREA)
Abstract
The invention relates to an automatic testing method, which comprises the following steps: building a public class library; managing a pressure measurement scene; configuring a threshold; executing control; acquiring an index; analyzing a bottleneck; displaying a report; and presenting a trend. The invention provides a programmable automatic performance testing method and device based on Gatling, which integrates performance scripts, data preparation, execution control, server resource collection, pressure test result analysis and performance problem diagnosis into a platform, provides a device with automatic performance, can manage the programmable scene, effectively improves the script reusability, enables scripts to be written intuitively and efficiently, reduces the input of pressure test personnel, improves the performance testing efficiency, and greatly reduces machine resources and personnel cost based on the platform with automatic performance based on Gatling.
Description
Technical Field
The invention relates to the technical field of software testing, in particular to a programmable performance automatic testing method and device based on Gatling and computer equipment.
Background
The performance test is an important ring of software test, the functional test mainly ensures the functional correctness of the software, and the performance test needs: 1) Ensuring the functional correctness under high concurrency; 2) The response speed under high concurrency and large data volume is improved, and the access smoothness of the user is improved; 3) The method and the system ensure long-time stable operation of the service, and avoid the problems of memory leakage, memory overflow and the like. With the rise of internet technology and big data technology, the importance of performance testing becomes more and more prominent. Commonly used performance testers are Loadrunner, meter, gatling, ab, locust, etc. Conventional performance testing generally has the following problems: the performance test scripts are not highly reusable, and when program optimization requires performance regression or when a new scene needs to be pressed, a great deal of effort needs to be invested in manual work to prepare/maintain the pressure test scripts, prepare data, perform control, collect server resources, analyze pressure test results, diagnose performance problems and the like.
In the aspect of scripts, the multiplexing degree of the scripts is not high after a complex pressure test scene is compiled in the conventional performance test; in the flow aspect, a tool for integrating the whole pressure measurement flow is lacked, the performance test flow is complicated, and each pressure measurement step needs human intervention; in the aspect of personnel, the requirement on personnel is high, and more manpower is required to be invested; in the aspect of pressure measurement result analysis, a unified judgment basis is lacked, and due to the fact that collected data are lacked or the experience of an analyst is different, the analyzed conclusion may be deviated or limited.
Disclosure of Invention
Based on the method, the device and the computer equipment, the programmable performance automatic testing method and device based on Gatling are provided by the invention.
The invention provides an automatic testing method on one hand, which comprises the following steps:
s1, building a public class library, and compiling the public class library based on Gatling, wherein the public class library comprises a plurality of systems, a public system server list class, a data factory class and a practical tool class;
s2, managing the pressure measurement scene, namely performing scene new construction, scene cloning, scene editing and scene deletion on the basis of a public class library, and managing the pressure measurement scene according to requirements;
s3, threshold value configuration, namely subdividing different index items according to different indexes, configuring different range threshold values for each index item, and grading according to the different range threshold values;
s4, executing control, including exploration pressure measurement and formal pressure measurement, wherein in the exploration pressure measurement, a pressure measurement scene is selected, concurrence of the selected pressure measurement scene is set to be 1, and execution times are set to be 1; in formal pressure measurement, the concurrency, the execution times/the execution duration are configured according to requirements, and the formal pressure measurement is arranged and executed according to a pressure measurement scene;
s5, acquiring indexes, and acquiring the numerical value of each index item of different indexes;
s6, bottleneck analysis, namely comparing the index value obtained in the step S5 with the range threshold value obtained in the step S3 to identify a bottleneck point;
s7, displaying a report, namely integrating the information acquired in the steps S1-S6 into a unified report for intensively displaying the pressure measurement information, wherein the pressure measurement information comprises a gateway pressure measurement report, a server resource report and a service reliability report;
and S8, trend display, namely performing trend display on TPS/response time of pressure measurement scenes of different systems according to time dimension, and sending out early warning when performance is reduced to exceed a preset proportion.
Preferably, each of the plurality of systems of the common class library includes an Http interface class, a Dubbo interface class, a Kafka interface class, a different scene class, an environment management class, a data management class, and a concurrency control class;
the Http interface class, the Dubbo interface class and the Kafka interface class define interfaces of different protocols, different interfaces are assembled into different scenes through the arrangement of different interfaces, and a scene class pressure measurement script is generated in an arrangement mode;
the environment management class maintains addresses of different systems;
the data management maintains the data acquisition mode;
the concurrency control class maintains concurrency number, execution duration, and pressure growth models.
Preferably, the system server list class is used for configuring an application server list and a database server list which need to be monitored in the system pressure measurement process; the data factory class is used for packaging data acquisition rules; the utility class is used to define the data processing method.
Preferably, before the new scene is created, a preparation step is included, which specifically includes:
s201, preparing a gateway-based pressure measurement script, wherein interfaces of a related system, including parameterization and check points, are extracted as required, and returned results are stored in a session;
s202, providing parameters for initializing an interface by a data factory class;
the new creation of the scene comprises the following steps:
s21, preparing data, selecting method rules in the data factory class, initializing required parameters, and calling an interface;
s22, controlling the process, namely determining an interface called in the next step of the scene by judging interface return parameters;
s23, interface circulation is carried out, and a plurality of interfaces are connected in series;
s24, preparing a proportion, and transferring the flow to different interfaces according to the proportion;
and after the scene is built, producing the pressure measurement scene script according to the script specification.
Preferably, the scene clone is used for cloning an existing scene, and is stored as a new scene after the scene name and the scene flow are modified; the scene editing is used for viewing and editing the pressure measurement scene arrangement; and deleting scenes for deleting inapplicable flows by the scene deletion.
Preferably, in steps S3, S5 and S6, the indexes of the threshold configuration, the index acquisition and the bottleneck analysis include a performance index, a server resource index and a service reliability index;
the performance indicators include a number of transactions processed per second, an average response time, a percentage of errors, and a total number of requests sent;
the server resource index comprises a server CPU, a server Load, a server memory, a database CPU, a database Load and a database disk io wait time;
the server reliability index includes an application GC frequency and an application error log key.
Preferably, the manner of acquiring the index in step S5 is:
the performance index obtaining mode is as follows: obtaining from the gating report, including the number of transactions processed per second, the average response time, the error percentage, and the total number of requests sent;
the acquisition mode of the server resource index is as follows: after the control is executed in step S4, resource information of the server in a period from the start of pressure measurement to the completion of pressure measurement is acquired through a query interface provided by Promethus, the server resource information is collected on the monitored machine through a node _ exporter, the Promethus stores data through a pull method, and an API is provided for query;
the server reliability index obtaining mode is as follows: and calling an interface provided by a log platform for query according to the keywords configured by the application error log, and counting the occurrence times of the corresponding keywords and the sentences of the keywords.
In another aspect, the present invention further provides an automatic testing apparatus, including:
the system comprises a public class library module, a plurality of system and public system server list classes, data factory classes and utility classes, wherein each system comprises an Http interface class, a Dubbo interface class, a Kafka interface class, different scene classes, an environment management class, a data management class and a concurrency control class;
the pressure measurement scene management module comprises scene creation, scene cloning, scene editing and scene deletion, and can perform programmable management on the pressure measurement scene according to requirements;
the threshold configuration module is used for configuring performance indexes, server resource indexes and service reliability indexes, subdividing different index items according to different indexes, configuring different range thresholds for each index item, and grading according to different range thresholds;
the execution control module comprises a probing pressure measurement module and a formal pressure measurement module, wherein a pressure measurement scene is selected in the probing pressure measurement module, the concurrence of the selected pressure measurement scene is set to be 1, and the execution times is set to be 1; in the formal pressure measurement module, the concurrency, the execution times/the execution duration are configured according to requirements, and formal pressure measurement is arranged and executed according to a pressure measurement scene;
the index acquisition module is used for acquiring the numerical value of each index item of the performance index acquisition, the server resource index acquisition and the service reliability index;
the bottleneck analysis module is used for comparing the index value acquired in the index acquisition module with the range threshold value in the threshold value configuration module to identify a bottleneck point;
the report display module comprises a gateway pressure measurement report, a server resource report and a service reliability report, and integrates the obtained information into a unified report for intensively displaying the pressure measurement information;
and the trend presentation module is used for carrying out trend display on TPS/response time of pressure measurement scenes of different systems according to the time dimension, and sending out early warning when the performance is reduced to exceed a preset proportion.
Preferably, the device comprises an application layer, a service layer and a storage layer, wherein the application layer comprises a pressure measurement scene management module, a threshold configuration module, a report display module and a trend presentation module; the service layer is used for providing bottom layer functions for the application layer and comprises a public class library module, an execution control module, an index acquisition module, a bottleneck analysis module and a basic module; the storage layer provides data storage for the device and comprises a platform file server and a platform database.
The invention also provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of any of the above methods when executing the computer program.
The invention provides a method and a device for programmable automatic performance testing based on Gatling, which integrate performance scripts, data preparation, execution control, server resource collection, pressure test result analysis and performance problem diagnosis into one platform, and provide a device for automatic performance.
Drawings
The foregoing and other objects, features and advantages of the invention will be apparent from the following more particular description of preferred embodiments of the invention, as illustrated in the accompanying drawings. Like reference numerals refer to like parts throughout the drawings, and the drawings are not intended to be drawn to scale in actual dimensions, emphasis instead being placed upon illustrating the principles of the invention.
Fig. 1 is a schematic diagram of a configurable automatic performance testing apparatus based on Gatling according to an embodiment of the present invention;
FIG. 2 is a block diagram of a common class library module according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a pressure measurement scene management module according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a call relationship between modules of a programmable performance automation testing apparatus based on Gatling according to an embodiment of the present invention.
Detailed Description
The following detailed description of the present invention is provided in connection with the accompanying drawings and specific embodiments for the purpose of better understanding and enabling those skilled in the art to practice the present invention, which are not intended to limit the present invention.
In one aspect, an embodiment of the present invention provides an automated testing method, including the following steps:
s1, building a public class library, and compiling the public class library based on Gatling, wherein the public class library comprises a plurality of systems, a public system server list class, a data factory class and a utility tool class. Gatling is one of the commonly used server pressure measurement tools, and compared with Jmeter and Locus pressure measurement tools, the Gatling has the characteristics of high performance, simple script writing, strong maintainability and the like. The method comprises the steps of compiling a public class library based on Gatling, taking systems as dimensions on a script structure, and configuring a plurality of classes in each system, wherein the classes comprise an Http interface class, a Dubbo interface class, a Kafka interface class, different scene classes, an environment management class, a data management class and a concurrency control class. The environment management type, the data management type and the concurrency control type of each system abstract common modification items into configuration, so that decoupling between the configuration and codes is realized, the flexibility of the script is increased, and the maintainability of the script is enhanced.
And S2, managing the pressure measurement scene, namely performing scene new creation, scene cloning, scene editing and scene deletion on the basis of the public class library, and managing the pressure measurement scene according to requirements. The programmable scene management realizes the high multiplexing of the pressure measurement script, improves the compiling efficiency of the pressure measurement script, and the diversification of the pressure measurement scene meets the pressure measurement requirements of different services.
And S3, threshold value configuration, namely subdividing different index items according to different indexes, configuring different range threshold values for each index item, and dividing grades according to different range threshold values, such as a good grade, a good grade and a poor grade, wherein the threshold value configuration is mainly used for automatic bottleneck analysis in subsequent steps and providing a comparison threshold value for the bottleneck analysis.
S4, executing control, including exploration pressure measurement and formal pressure measurement, wherein in exploration pressure measurement, a pressure measurement scene is selected, concurrence of the selected pressure measurement scene is set to be 1, and execution times are set to be 1; in formal pressure measurement, concurrency, execution times/execution duration are configured according to requirements, and formal pressure measurement is arranged and executed according to pressure measurement scenes. The range involved in the execution control may be a scene level, that is, a plurality of scenes are sequentially executed, or a system level; the system level is the pressure measurement of all the scenes under the execution system.
And S5, acquiring indexes, and acquiring the numerical value of each index item of different indexes. The index acquisition is used for comparing with relevant indexes configured in threshold configuration and discovering various abnormalities in the automatic bottleneck analysis and pressure measurement processes, so that the complexity of manually collecting various performance indexes is saved, the human resources are saved, the bottleneck and the abnormality are easier to expose, and the pressure measurement process is standardized, automated and streamlined.
S6, bottleneck analysis, namely comparing the index value obtained in the step S5 with the range threshold value obtained in the step S3 to identify a bottleneck point;
s7, displaying a report, namely integrating the information acquired in the steps S1-S6 into a unified report for intensively displaying the pressure measurement information, wherein the pressure measurement information comprises a gateway pressure measurement report, a server resource report and a service reliability report;
and S8, trend display, namely performing trend display on TPS/response time of pressure measurement scenes of different systems according to time dimension, and sending out early warning when performance is reduced to exceed a preset proportion. Through trend presentation, scattered pressure measurement scene data are summarized, historical data of performance are obviously seen, display is visual, and data are provided for performance evaluation.
In the present embodiment, the Http interface class, the Dubbo interface class, the Kafka interface class, the different scene class, the environment management class, the data management class, and the concurrency control class in each system have different roles:
interfaces of different protocols are defined by the Http interface class, the Dubbo interface class and the Kafka interface class, different interfaces are assembled into different scenes through arrangement of the different interfaces, and a scene class pressure measurement script is generated in an arrangement mode, so that the reusability of the interface classes is high, the scene generation is convenient and fast, and the coverage is comprehensive;
the environment management maintains the addresses of different systems;
maintaining a data acquisition mode by a data management class;
the concurrency control class maintains concurrency number, execution duration, and pressure rise models.
In this embodiment, the system server list class is used to configure an application server list and a database server list that need to be monitored in the system pressure measurement process; the data factory class is used for packaging data acquisition rules, such as common identity cards, mobile phone numbers, random numbers, unique numbers and the like; the utility class is used to define data processing methods such as data encryption, data decryption, etc.
In this embodiment, before a new scene is created, the following preparation steps need to be performed, which specifically include:
s201, preparing a Gatling-based pressure measurement script, wherein the interfaces of the related system comprise parameterization and check points, extracting an interface return result as required, and storing the interface return result in a session for transferring subsequent interface parameterization;
s202, providing parameters for initializing an interface by a data factory, such as common data of an identity card, a random number, a unique number, a customer number, a bank card and the like;
the pressure measurement scene can be as simple as one interface or a flow formed by connecting a plurality of interfaces in series. According to the embodiment of the invention, basic interfaces are arranged into a complex pressure measurement scene according to an actual scene, and the arrangement mainly comprises data preparation, flow control, interface circulation and proportion configuration. Referring to fig. 3, the pressure measurement scenario management is further explained, and the formal scenario creation includes the following steps:
s21, preparing data, selecting method rules in a data factory class, initializing required parameters, and calling an interface;
s22, controlling the process, namely determining an interface called in the next step of the scene by judging interface return parameters;
s23, interface circulation is carried out, and a plurality of interfaces are connected in series;
s24, preparing a proportion, and transferring the flow to different interfaces according to the proportion;
and after the scene is built, producing the pressure measurement scene script according to the script specification.
Furthermore, the scene gram Long Shizhi clones the existing scene, and the scene is saved as a new scene after the scene name and the scene flow are modified, so that the script compiling efficiency is improved; scene editing refers to viewing and editing of pressure measurement scene arrangement; scene deletion refers to deleting scenes of inapplicable flows. Through the programmable scene management, the high multiplexing of the pressure measurement script is realized, the compiling efficiency of the pressure measurement script is improved, and the pressure measurement scene diversification meets the pressure measurement requirements of different services.
In this embodiment, in steps S3, S5 and S6, the indexes of the threshold configuration, the index acquisition and the bottleneck analysis include a performance index, a server resource index and a service reliability index;
the performance indicators include the number of transactions processed per second, the average response time, the error percentage, and the total number of requests sent;
the server resource indexes comprise a server CPU, a server Load, a server memory, a database CPU, a database Load and a database disk io wait time;
the server reliability index includes an application GC frequency and an application error log key.
Further, the way of acquiring the index in step S5 is:
the performance index acquisition mode is as follows: obtaining from the gating report, including the number of transactions processed per second, the average response time, the error percentage, and the total number of requests sent;
the acquisition mode of the server resource index is as follows: after the control is executed in the step S4, resource information of the server in a period from the start of the pressure measurement to the completion of the pressure measurement is acquired through a query interface provided by Promethus, the server resource information is collected on the monitored machine through a node _ exporter, and the Promethus stores data through a pull method and provides an API for query;
the method for acquiring the reliability index of the server comprises the following steps: and calling an interface provided by a log platform for query according to the keywords configured by the application error log, and counting the occurrence times of the corresponding keywords and the sentences of the keywords. The service reliability index is used for checking various abnormalities in the pressure measurement process, and the stability and reliability of the service are ensured.
The invention also provides an automatic testing device, which comprises:
referring to fig. 2, the common class library module includes a plurality of systems, and a common system server list class, a data factory class, and a utility class, each system including an Http interface class, a Dubbo interface class, a Kafka interface class, a different scene class, an environment management class, a data management class, and a concurrency control class. The common class library module is input by the scene arrangement module, different scenes are combined through the scene management which can be arranged in an arrangement mode, so that a new pressure measurement scene is formed, and all pressure measurement scripts are maintained through Git.
The pressure measurement scene management module comprises scene creation, scene cloning, scene editing and scene deletion, and can perform programmable management on the pressure measurement scene according to requirements;
the threshold configuration module is used for configuring performance indexes, server resource indexes and service reliability indexes, subdividing different index items according to different indexes, configuring different range thresholds for each index item, and grading according to different range thresholds;
the execution control module comprises a probing pressure measurement module and a formal pressure measurement module, wherein a pressure measurement scene is selected in the probing pressure measurement module, the concurrence of the selected pressure measurement scene is set to be 1, and the execution times is set to be 1; in the formal pressure measurement module, the concurrency, the execution times/the execution duration are configured according to requirements, and formal pressure measurement is arranged and executed according to a pressure measurement scene;
the index acquisition module is used for acquiring the numerical value of each index item of the performance index acquisition, the server resource index acquisition and the service reliability index;
the bottleneck analysis module is used for comparing the index value acquired in the index acquisition module with the range threshold value in the threshold value configuration module to identify a bottleneck point;
the report display module comprises a gateway pressure measurement report, a server resource report and a service reliability report, and integrates the obtained information into a unified report for intensively displaying the pressure measurement information;
and the trend presentation module is used for carrying out trend display on TPS/response time of pressure measurement scenes of different systems according to the time dimension, and sending out early warning when the performance is reduced to exceed a preset proportion.
Referring to fig. 4, the present embodiment further explains a call relationship among modules, specifically:
1. binding a corresponding threshold level in a pressure measurement scene, and configuring a server ip corresponding to a system for acquiring various resource indexes in the execution control process;
2. the threshold configuration module configures the performance level:
(1) A:TPS>x
(2) B:y<TPS<=x
(3) C:TPS<=y
and similarly, allocating the early warning level of the resource utilization rate and allocating the reliability index.
3. Executing control: and controlling the pressure size through the concurrency number and the execution duration/times, initiating pressure measurement or stopping pressure measurement, and recording the starting time and the ending time as the input of the index acquisition module.
4. Index acquisition: calling an API (application programming interface) provided by promethus to acquire indexes such as CPUs (central processing units), memories and the like of the application server and the database server; generating a database report of the pressure measuring period for bottleneck analysis; in the pressure measurement process, automatically acquiring GC data to generate a Full GC curve and a GC curve; after the pressure measurement is finished, the log management platform searches whether the pressure measurement period has configured error log keywords.
5. Bottleneck analysis: and marking the index item exceeding the threshold value after the pressure measurement is finished, thereby giving a basic bottleneck point prejudgment. Such as application CPU bottlenecks, memory bottlenecks, database bottlenecks, etc. And when the resource utilization rate of the database server exceeds a threshold value, automatically generating an AWR report of the database in the pressure measurement period for bottleneck analysis.
6. And (3) report display: integrating the gateway pressure measurement report, the server resource report and the service reliability report. Wherein, the Gatling pressure measurement report comprises TPS, response time and the like; the server resource report comprises information such as a CPU, a memory, a disk io and the like, the service reliability report comprises application GC frequency, and error logs are collected in the process.
7. And presenting the trend: through the graphical mode, show historical pressure measurement record, the change of the visual display performance.
Referring to fig. 1, in the embodiment, the programmable automatic performance testing apparatus based on Gatling adopts a hierarchical design mode and a modular testing framework, including an application layer, a service layer and a storage layer, and interacts with a third party/other system, such as Git, promethus, grafana, and the like, and is further provided with a pressing machine for performing a pressing test. The application layer comprises a pressure measurement scene management module, a threshold configuration module, a report display module and a trend presentation module, wherein the report display module displays a pressure measurement result record of each time, and the trend presentation module compares key indexes of the same scene and multiple pressure measurements, so that the data comparison with the conventional data is facilitated.
The service layer is used for providing bottom layer functions for the application layer and comprises a public class library module, an execution control module, an index acquisition module, a bottleneck analysis module and a basic module; the execution control module and the index acquisition module carry out pressure measurement by adjusting the concurrency number, the pressure measurement duration and the pressure measurement times, control the initiation and the stop of the pressure measurement, and acquire indexes such as application server resource indexes, database server resource indexes, TPS (thermoplastic polystyrene) and response time, application error logs and the like in a pressure measurement time period; the bottleneck analysis module assists in performing bottleneck analysis under the conditions of low performance, high resource occupation and the like of application, and provides a performance problem troubleshooting means and method; the base module provides the common service capabilities required by the various modules.
The storage layer provides data storage for the device, and comprises a platform file server and a platform database. All the pressure measurement reports of the device are uploaded to a file server; pressure measurement flow, threshold configuration, result data and the like all need to be stored in a database.
Embodiments of the present invention further provide a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the steps of the method in any of the above embodiments are implemented. The computer device may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server or a cabinet server (including an independent server or a server cluster composed of a plurality of servers) capable of executing programs, and the like. The computer device of the embodiment at least includes but is not limited to: a memory, a processor communicatively coupled to each other via a system bus.
In this embodiment, the memory (i.e., the readable storage medium) includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the memory may be an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. In other embodiments, the memory may be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, provided on the computer device. Of course, the memory may also include both internal and external storage devices for the computer device. In this embodiment, the memory is generally used to store an operating system, various types of application software, and the like installed in the computer device. In addition, the memory may also be used to temporarily store various types of data that have been output or are to be output.
The processor may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor is typically used to control the overall operation of the computer device. In this embodiment, the processor is configured to run a program code stored in the memory or process data to implement the end-to-end retrievable dialog method of the above embodiment.
The programmable performance automation test method and device based on Gatling provided by the embodiment of the invention integrate the performance script, data preparation, execution control, server resource collection, pressure test result analysis and performance problem diagnosis into one platform, and provide a performance automation device.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (10)
1. An automated testing method is characterized by comprising the following steps:
s1, building a public class library, and compiling the public class library based on Gatling, wherein the public class library comprises a plurality of systems, a public system server list class, a data factory class and a practical tool class;
s2, managing the pressure measurement scene, namely performing scene new construction, scene cloning, scene editing and scene deletion on the basis of a public class library, and managing the pressure measurement scene according to requirements;
s3, threshold value configuration, namely subdividing different index items according to different indexes, configuring different range threshold values for each index item, and grading according to the different range threshold values;
s4, executing control, including probing pressure measurement and formal pressure measurement, wherein in the probing pressure measurement, a pressure measurement scene is selected, the concurrence of the selected pressure measurement scene is set to be 1, and the execution times is set to be 1; in formal pressure measurement, the concurrency, the execution times/the execution duration are configured according to requirements, and the formal pressure measurement is arranged and executed according to a pressure measurement scene;
s5, acquiring indexes, namely acquiring the numerical value of each index item of different indexes;
s6, bottleneck analysis, namely comparing the index value obtained in the step S5 with the range threshold value obtained in the step S3 to identify a bottleneck point;
s7, displaying a report, namely integrating the information acquired in the steps S1-S6 into a unified report for intensively displaying the pressure measurement information, wherein the pressure measurement information comprises a gateway pressure measurement report, a server resource report and a service reliability report;
and S8, trend display, namely performing trend display on TPS/response time of pressure measurement scenes of different systems according to time dimension, and sending out early warning when performance is reduced to exceed a preset proportion.
2. The automated testing method of claim 1, wherein each of the plurality of systems of the common class library comprises an Http interface class, a Dubbo interface class, a Kafka interface class, a different scenario class, an environment management class, a data management class, and a concurrency control class;
the Http interface class, the Dubbo interface class and the Kafka interface class define interfaces of different protocols, different interfaces are assembled into different scenes through the arrangement of different interfaces, and a scene class pressure measurement script is generated in an arrangement mode;
the environment management class maintains addresses of different systems;
the data management maintains the data acquisition mode;
the concurrency control class maintains concurrency number, execution duration, and pressure growth models.
3. The automated testing method of claim 1, wherein the system server list class is used to configure a list of application servers and a list of database servers that need to be monitored during a system pressure test; the data factory class is used for packaging data acquisition rules; the utility class is used to define data processing methods.
4. The automated testing method of claim 1, wherein a preparation step is included before the new creation of the scene, specifically including:
s201, preparing an interface of a system related in the pressure measurement script based on Gatling, the method comprises parameterization and check points, and an interface return result is extracted as required and stored in session;
s202, providing parameters for initializing an interface by a data factory class;
the new creation of the scene comprises the following steps:
s21, preparing data, selecting method rules in the data factory class, initializing required parameters, and calling an interface;
s22, controlling the process, namely determining an interface called by the next scene step by judging an interface return parameter;
s23, interface circulation is carried out, and a plurality of interfaces are connected in series;
s24, preparing a proportion, and transferring the flow to different interfaces according to the proportion;
and after the scene is newly built, producing a pressure measurement scene script according to the script specification.
5. The automated testing method of claim 4, wherein the scene clone is used to clone an existing scene, modify a scene name and a scene flow, and save the scene as a new scene; the scene editing is used for viewing and editing the pressure measurement scene arrangement; and deleting scenes for deleting inapplicable flows by the scene deletion.
6. The automated testing method of claim 1, wherein in steps S3, S5 and S6, the indicators of the threshold configuration, the indicator acquisition and the bottleneck analysis comprise a performance indicator, a server resource indicator and a service reliability indicator;
the performance indicators include a number of transactions processed per second, an average response time, a percentage of errors, and a total number of requests sent;
the server resource indexes comprise a server CPU, a server Load, a server memory, a database CPU, a database Load and a database disk io wait time;
the server reliability index includes an application GC frequency and an application error log key.
7. The automated testing method of claim 6, wherein the indicator is obtained in step S5 by:
the performance index acquisition mode is as follows: obtaining from the gating report, including the number of transactions processed per second, the average response time, the error percentage, and the total number of requests sent;
the acquisition mode of the server resource index is as follows: after the control is executed in the step S4, resource information of the server in a period from the start of the pressure measurement to the completion of the pressure measurement is acquired through a query interface provided by Promethus, the server resource information is collected on the monitored machine through a node _ exporter, and the Promethus stores data through a pull method and provides an API for query;
the server reliability index obtaining mode is as follows: and calling an interface provided by a log platform for query according to the keywords configured by the application error log, and counting the occurrence times of the corresponding keywords and the sentences of the keywords.
8. An automated testing device, comprising:
the system comprises a public class library module, a plurality of system and public system server list classes, data factory classes and utility classes, wherein each system comprises an Http interface class, a Dubbo interface class, a Kafka interface class, different scene classes, an environment management class, a data management class and a concurrency control class;
the pressure measurement scene management module comprises scene creation, scene cloning, scene editing and scene deleting, and can manage the pressure measurement scene in an arranging way according to the requirement;
the threshold configuration module is used for configuring performance indexes, server resource indexes and service reliability indexes, subdividing different index items according to different indexes, configuring different range thresholds for each index item, and grading according to different range thresholds;
the execution control module comprises a probing pressure measurement module and a formal pressure measurement module, wherein a pressure measurement scene is selected in the probing pressure measurement module, the concurrence of the selected pressure measurement scene is set to be 1, and the execution times is set to be 1; in the formal pressure measurement module, the concurrency, the execution times/the execution duration are configured according to requirements, and formal pressure measurement is arranged and executed according to a pressure measurement scene;
the index acquisition module is used for acquiring the numerical value of each index item of the performance index acquisition, the server resource index acquisition and the service reliability index;
the bottleneck analysis module is used for comparing the index value acquired in the index acquisition module with the range threshold value in the threshold value configuration module to identify a bottleneck point;
the report display module comprises a gateway pressure measurement report, a server resource report and a service reliability report, and integrates the obtained information into a unified report for intensively displaying the pressure measurement information;
and the trend presentation module is used for carrying out trend display on TPS/response time of pressure measurement scenes of different systems according to the time dimension, and sending out early warning when the performance is reduced to exceed a preset proportion.
9. The automated testing apparatus of claim 8, wherein the apparatus comprises an application layer, a service layer, and a storage layer, the application layer comprising a pressure test scenario management module, a threshold configuration module, a report presentation module, and a trend presentation module; the service layer is used for providing bottom layer functions for the application layer and comprises a public class library module, an execution control module, an index acquisition module, a bottleneck analysis module and a basic module; the storage layer provides data storage for the device and comprises a platform file server and a platform database.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1 to 7 are implemented by the processor when executing the computer program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211156627.7A CN115248782B (en) | 2022-09-22 | 2022-09-22 | Automatic testing method and device and computer equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211156627.7A CN115248782B (en) | 2022-09-22 | 2022-09-22 | Automatic testing method and device and computer equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115248782A true CN115248782A (en) | 2022-10-28 |
CN115248782B CN115248782B (en) | 2022-12-23 |
Family
ID=83700323
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211156627.7A Active CN115248782B (en) | 2022-09-22 | 2022-09-22 | Automatic testing method and device and computer equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115248782B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116627849A (en) * | 2023-07-24 | 2023-08-22 | 中邮消费金融有限公司 | System test method, device, equipment and storage medium |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070083630A1 (en) * | 2005-09-27 | 2007-04-12 | Bea Systems, Inc. | System and method for performance testing framework |
CN108647142A (en) * | 2018-05-07 | 2018-10-12 | 杭州有赞科技有限公司 | A kind of Gatling pressure surveys script local precompile adjustment method and system |
CN111400198A (en) * | 2020-06-03 | 2020-07-10 | 中邮消费金融有限公司 | Self-adaptive software testing system |
CN111563014A (en) * | 2019-02-13 | 2020-08-21 | 北京京东尚科信息技术有限公司 | Interface service performance test method, device, equipment and storage medium |
CN111913889A (en) * | 2020-09-11 | 2020-11-10 | 中移(杭州)信息技术有限公司 | Test system building method and test system |
CN112000574A (en) * | 2020-08-18 | 2020-11-27 | 中国建设银行股份有限公司 | Pressure testing method, device, equipment and storage medium |
CN112395182A (en) * | 2019-08-14 | 2021-02-23 | 中国联合网络通信集团有限公司 | Automatic testing method, device, equipment and computer readable storage medium |
CN113138917A (en) * | 2021-04-14 | 2021-07-20 | 重庆长安汽车股份有限公司 | Performance test platform |
CN113254323A (en) * | 2021-07-05 | 2021-08-13 | 中邮消费金融有限公司 | Online full link voltage measurement method and device and computer equipment |
CN113360396A (en) * | 2021-06-28 | 2021-09-07 | 汇付天下有限公司 | Software performance pressure measurement method and device |
CN113965502A (en) * | 2021-10-20 | 2022-01-21 | 上海汇付数据服务有限公司 | Full link performance test method and system |
CN114942878A (en) * | 2022-03-28 | 2022-08-26 | 中国人寿保险股份有限公司 | Automatic performance testing method for internet application and related equipment |
-
2022
- 2022-09-22 CN CN202211156627.7A patent/CN115248782B/en active Active
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070083630A1 (en) * | 2005-09-27 | 2007-04-12 | Bea Systems, Inc. | System and method for performance testing framework |
CN108647142A (en) * | 2018-05-07 | 2018-10-12 | 杭州有赞科技有限公司 | A kind of Gatling pressure surveys script local precompile adjustment method and system |
CN111563014A (en) * | 2019-02-13 | 2020-08-21 | 北京京东尚科信息技术有限公司 | Interface service performance test method, device, equipment and storage medium |
CN112395182A (en) * | 2019-08-14 | 2021-02-23 | 中国联合网络通信集团有限公司 | Automatic testing method, device, equipment and computer readable storage medium |
CN111400198A (en) * | 2020-06-03 | 2020-07-10 | 中邮消费金融有限公司 | Self-adaptive software testing system |
CN112000574A (en) * | 2020-08-18 | 2020-11-27 | 中国建设银行股份有限公司 | Pressure testing method, device, equipment and storage medium |
CN111913889A (en) * | 2020-09-11 | 2020-11-10 | 中移(杭州)信息技术有限公司 | Test system building method and test system |
CN113138917A (en) * | 2021-04-14 | 2021-07-20 | 重庆长安汽车股份有限公司 | Performance test platform |
CN113360396A (en) * | 2021-06-28 | 2021-09-07 | 汇付天下有限公司 | Software performance pressure measurement method and device |
CN113254323A (en) * | 2021-07-05 | 2021-08-13 | 中邮消费金融有限公司 | Online full link voltage measurement method and device and computer equipment |
CN113965502A (en) * | 2021-10-20 | 2022-01-21 | 上海汇付数据服务有限公司 | Full link performance test method and system |
CN114942878A (en) * | 2022-03-28 | 2022-08-26 | 中国人寿保险股份有限公司 | Automatic performance testing method for internet application and related equipment |
Non-Patent Citations (1)
Title |
---|
宋巍等: "Web系统性能测试研究与实践", 《计算机应用与软件》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116627849A (en) * | 2023-07-24 | 2023-08-22 | 中邮消费金融有限公司 | System test method, device, equipment and storage medium |
CN116627849B (en) * | 2023-07-24 | 2024-01-26 | 中邮消费金融有限公司 | System test method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN115248782B (en) | 2022-12-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107341098B (en) | Software performance testing method, platform, equipment and storage medium | |
US10116534B2 (en) | Systems and methods for WebSphere MQ performance metrics analysis | |
CN107844424B (en) | Model-based testing system and method | |
EP2572294B1 (en) | System and method for sql performance assurance services | |
CN103532780B (en) | O&M for IT field monitors integral system and integrated monitoring method | |
CN103578568B (en) | The performance test methods of solid state hard disc and device | |
CN111563014B (en) | Interface service performance test method, device, equipment and storage medium | |
CN102143008A (en) | Method and device for diagnosing fault event in data center | |
CN110704277A (en) | Method for monitoring application performance, related equipment and storage medium | |
CN111522728A (en) | Method for generating automatic test case, electronic device and readable storage medium | |
CN112269697B (en) | Equipment storage performance testing method, system and related device | |
CN111190814B (en) | Method and device for generating software test case, storage medium and terminal | |
CN110647447A (en) | Abnormal instance detection method, apparatus, device and medium for distributed system | |
CN115248782B (en) | Automatic testing method and device and computer equipment | |
CN114880240A (en) | Automatic testing system and method for Internet of things equipment, storage medium and equipment | |
CN109857643A (en) | A kind of method and device of virtual platform performance automatic test | |
CN113656174A (en) | Resource allocation method, system, computer device and storage medium | |
CN115964272A (en) | Transaction data automatic testing method, device, equipment and readable storage medium | |
CN114996127A (en) | Intelligent test method and system for solid state disk firmware module | |
CN114610597A (en) | Pressure testing method, device, equipment and storage medium | |
CN104461832A (en) | Method and device for monitoring resources of application server | |
CN111258893A (en) | Mobile terminal application automatic testing device for randomly assembling transaction path | |
CN114090382B (en) | Health inspection method and device for super-converged cluster | |
CN115168124A (en) | Stability test method and device for concurrently executing multiple files on hard disk, computer equipment and medium | |
CN113535575A (en) | Benchmark testing method and device for basic environment of software and hardware product |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |