Automatic performance testing method and device and electronic equipment
Through automated performance testing methods, the test objects are determined based on production calls, obtaining key information and generating test scripts, solving the problem of low interface performance test efficiency in existing technologies, realizing automated testing, improving efficiency and reducing costs.
Patent Information
- Application Number
- CN202411505305.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-01-24
AI Technical Summary
In the prior art, interface performance testing requires manual writing and running test scripts, which are inefficient and cannot be automated.
Based on the production call volume, the test object is determined, the key information is obtained, the performance test script is generated, and the script is run for performance testing, and the performance indicators are automated.
The automation of the interface performance test is achieved, the test efficiency is improved, and the cost is reduced without manual participation.
Smart Images

Figure CN119357016A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of testing technology, and in particular to an automated performance testing method, device and electronic equipment. Background Art
[0002] Interface testing is a test of the interfaces between system components. It is mainly used to test the interfaces between the system and other external systems, as well as the interfaces between various sub-modules within the system. Interface performance testing usually refers to verifying the performance of the interface under a specific load, such as stability under high concurrency or large data volumes. Through these tests, potential performance bottlenecks can be effectively discovered and resolved, and the system architecture and code can be optimized, thereby improving the stability of the entire system and user experience.
[0003] Currently, the performance test of the interface can test various performance indicators of the interface, such as response time and throughput, by simulating a variety of normal, peak and abnormal load conditions. However, the test process needs to be completed by manually writing and running performance test scripts, which requires high manual participation, low efficiency, and cannot be automated. Summary of the invention
[0004] The purpose of the embodiments of the present invention is to provide an automated performance testing method, device and electronic equipment to solve the problems in the prior art.
[0005] To solve the above technical problems, the embodiments of the present invention are implemented as follows: In a first aspect, an embodiment of the present invention provides an automated performance testing method, comprising: Determine a test object for performance testing based on a production call volume, wherein the production call volume reflects a situation in which an interface is called, and the test object includes an interface and / or a database associated with the interface; Obtaining key information of the test object; Generate a control for performance testing based on the key information to obtain a performance testing script; Run the performance test script to perform performance testing and obtain the performance indicators of the test object.
[0006] In a second aspect, an embodiment of the present invention provides an automated performance testing device, comprising: A determination module, configured to determine a test object for performance testing based on a production call volume, wherein the production call volume reflects a situation in which an interface is called, and the test object includes an interface and / or a database associated with the interface; An acquisition module, used to acquire key information of the test object; A script module, used to generate a control for performance testing based on the key information to obtain a performance testing script; The test module is used to run the performance test script to perform performance testing and obtain the performance indicators of the test object.
[0007] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the above-mentioned automated performance testing method when executed by the processor.
[0008] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned automated performance testing method are implemented.
[0009] In a fifth aspect, an embodiment of the present invention provides a computer program product, including a computer program, which implements the steps of the above-mentioned automated performance testing method when executed by a processor.
[0010] It can be seen from the technical solution provided by the above embodiments of the present invention that the test object for performance testing is determined based on the production call volume, the production call volume reflects the situation of the interface being called, the test object includes the interface and / or a database associated with the interface, key information of the test object is obtained, controls for performance testing are generated based on the key information, a performance test script is obtained, the performance test script is run to perform performance testing, and performance indicators of the test object are obtained, thereby realizing the automation of performance testing without human participation, greatly improving testing efficiency and reducing costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0012] Figure 1 A schematic diagram of a flow chart of an automated performance testing method provided by an embodiment of the present invention; Figure 2 A flowchart of another automated performance testing method provided by an embodiment of the present invention; Figure 3 A flowchart of another automated performance testing method provided by an embodiment of the present invention; Figure 4 A schematic diagram of a flow chart of an interface and database synchronization performance test provided by an embodiment of the present invention; Figure 5A schematic diagram of the structure of an automated performance testing device provided by an embodiment of the present invention; Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0013] The embodiments of the present invention provide an automated performance testing method, device and electronic equipment.
[0014] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0015] The automated performance testing method and device provided in the embodiments of the present invention can be applied to an electronic device, which can be a terminal device or a server. The server can be an independent server, or a server cluster composed of multiple servers, or a cloud server capable of cloud computing, which is not specifically limited. The terminal device can be a device such as a personal computer, or a mobile terminal device such as a mobile phone or a tablet computer, or a smart wearable device, a vehicle-mounted terminal, etc., which is not specifically limited.
[0016] The application scenarios of the above method and device include the scenario of performing performance testing on the interface on the terminal device or server. Through the above method and device, the automation of performance testing can be realized without manual participation, which greatly improves the testing efficiency and reduces the cost.
[0017] like Figure 1 As shown, an embodiment of the present invention provides an automated performance testing method, which may include the following steps: S102: Determine a test object for performance testing based on the production call volume, where the production call volume reflects the situation in which the interface is called, and the test object includes the interface and / or a database associated with the interface.
[0018] In the embodiment of the present invention, there may be multiple calls corresponding to the interface, including but not limited to at least one of the following: calls between systems; calls from upper-layer services to lower-layer services within the same system. The system may refer to a device or an application, without specific limitation.
[0019] For example, an interface may be an interface provided by an APP that can be called by other APPs, or an interface may exist between the presentation layer, business layer, and data layer in an APP that can call each other.
[0020] In the embodiment of the present invention, the test object may include only the interface, that is, only the performance test is performed on the interface. Alternatively, the test object may include only the data block associated with the interface, that is, only the performance test is performed on the database associated with the interface, thereby understanding the performance of the interface. Alternatively, the test object includes the interface and the data block associated with the interface, that is, both are subjected to performance testing, thereby understanding the performance of the interface more comprehensively.
[0021] Whether you are performing performance testing on the interface only, the database associated with the interface only, or both the interface and the database associated with the interface, you can evaluate the performance indicators of the interface under a specific load. For example, by simulating multiple users accessing the interface at the same time, you can evaluate the interface's processing power, response time, throughput, and error rate, etc., to ensure that the interface can meet performance requirements in a production environment.
[0022] In the embodiment of the present invention, the above step S102 may include: Sort multiple interfaces from high to low according to the production call volume; Select the specified number of interfaces that are ranked first; The selected interface and / or a database associated with the selected interface is used as a test object of the performance test.
[0023] The above production call volume may be the number of times the interface is called in a historical period.
[0024] Of course, in an embodiment of the present invention, multiple interfaces can also be sorted from low to high according to the production call volume, and a specified number of interfaces in the latter order can be selected, and the selected interfaces and / or the database associated with the selected interfaces can be used as test objects for performance testing. The results obtained in this way are the same as those obtained by the above-mentioned reverse sorting method. Any method can be selected as needed without specific limitation.
[0025] S104: Obtain key information of the test object.
[0026] In the embodiment of the present invention, the key information of the test object refers to relevant information that can reflect the properties of the test object, including but not limited to at least one of the following: address, name, data type, input parameter, output parameter, programming language, etc.
[0027] In the embodiment of the present invention, the above step S104 may include: Get the interface description document; Use the pre-generated interface code format library to extract key information of the test object from the interface description document.
[0028] The interface code format library is used to extract key information of the test object according to the specification of the interface code writing format.
[0029] S106: Generate controls for performance testing based on the key information to obtain a performance testing script.
[0030] The generated controls may be one or more, usually multiple, and the multiple generated controls constitute a performance test script. Some of the multiple generated controls may have an associated relationship.
[0031] For example, the generated control includes at least one of the following: a loop control, a judgment control, a test control, a call control, etc.
[0032] In an embodiment of the present invention, a script template can be obtained from a pre-generated performance test script format library, a control for performance testing can be generated using the script template, and a request parameter of the control can be set to the above key information to obtain a performance test script.
[0033] In one implementation, the above step S106 may include: In the case where the test object is an interface, obtaining a first script template from a pre-generated interface performance test script format library, wherein the first script template is generated based on a function of the interface; A control for interface performance testing is generated using the first script template, and a request parameter of the control is set as key information to obtain a performance testing script.
[0034] In another implementation, the above step S106 may include: In the case where the test object is a database associated with an interface, obtaining a second script template from a pre-generated database performance test script format library, wherein the second script template is generated based on a database operation language associated with the interface; The second script template is used to generate a control for database performance testing, and the request parameters of the control are set as key information to obtain a performance testing script.
[0035] S108: Run the performance test script to perform performance testing and obtain performance indicators of the test object.
[0036] The performance index of the test object may be one or more, usually multiple. The more performance indexes there are, the more comprehensive the performance results of the test object obtained will be.
[0037] For example, the performance indicator of the test object may include at least one of the following: response time, throughput, number of concurrent users, success rate, error rate, etc.
[0038] In the embodiment of the present invention, the above step S108 may include: Run performance test scripts to perform performance tests and monitor system operation status; Compare the system operating status with the preset threshold value; If the system operating status is lower than the threshold, the performance test pressure is increased and the performance test is continued until the system operating status reaches the threshold, and the performance test is stopped. The performance index of the test object obtained by the test is obtained as the performance upper limit value of the test object.
[0039] In the embodiment of the present invention, the system operation status refers to the resource usage and / or processing response of the device performing the performance test. The resource usage includes at least one of the following: CPU occupancy, memory occupancy, etc. The processing response includes at least one of the following: throughput, average response time, etc.
[0040] In the embodiment of the present invention, each interface has different consumption on the system, so whether it is necessary to increase the pressure of the performance test and how many times the pressure of the performance test needs to be increased will be different for different interfaces. For example, the threshold of the CPU occupancy rate is 80%, and the interface A is called one thousand times per second, and the corresponding CPU occupancy rate is 40%, which does not reach the threshold, so it is necessary to increase the pressure of the performance test. However, if the interface B is called one thousand times per second, the corresponding CPU occupancy rate is 80%, which can reach the threshold, so there is no need to increase the pressure of the performance test.
[0041] The parameter corresponding to the system operation state may be one or more parameters. If there are multiple parameters, each parameter has a corresponding threshold value. In this case, the condition for stopping the performance test is that multiple parameters have reached the corresponding threshold value, indicating that the system has reached the limit state.
[0042] For example, the system operation status includes CPU occupancy and throughput, so a CPU occupancy threshold and a throughput threshold are preset. When the CPU occupancy reaches the corresponding threshold and the throughput reaches the corresponding threshold, the pressure of the performance test is no longer increased and the performance test is stopped.
[0043] The above method provided by the embodiment of the present invention determines the test object for performance testing based on the production call volume, the production call volume reflects the situation of the interface being called, the test object includes the interface and / or the database associated with the interface, obtains the key information of the test object, generates the control for performance testing based on the key information, obtains the performance test script, runs the performance test script to perform performance testing, obtains the performance index of the test object, realizes the automation of performance testing, does not require human participation, greatly improves the test efficiency, and reduces the cost. In addition, the method of automatically increasing the performance test pressure can be continuously adjusted until the performance upper limit value of the test object is found. The method is more flexible, quick and easy, and further improves the test efficiency on the basis of automated performance testing.
[0044] like Figure 2As shown, an embodiment of the present invention provides another automated performance testing method, which is described by taking the test object including an interface as an example. The method may include the following steps: S202: Determine a test object for performance testing based on the production call volume.
[0045] Wherein, the test object is an interface, and the production call volume can reflect the situation of the interface being called. Specifically, the production call volume can be the number of times the interface is called in a historical period. Accordingly, the above step S202 can specifically include: Sort multiple interfaces from high to low according to the production call volume, and select a specified number of interfaces at the top of the sort as test objects for performance testing.
[0046] The specified number can be set as needed, and the specific value is not limited.
[0047] For example, if there are 100 interfaces to be sorted, the specified number can be set to 20, 50, or 80.
[0048] In the embodiment of the present invention, the above-mentioned production call volume can be obtained using a third-party monitoring tool. There can be multiple third-party tools, including but not limited to one of the following: Tiandan, Prometheus, Zabbix, etc.
[0049] S204: Obtain an interface description document, and use a pre-generated interface code format library to extract key information of the test object from the interface description document.
[0050] In the embodiment of the present invention, the interface description document is a document including various information of the interface. Through the interface description document, key information such as the function of the interface, various parameter information, programming language, and request method can be understood.
[0051] The interface code format library is used to extract key information of the test object according to the specification of the interface code writing format. The specification of the interface code encoding format refers to the writing specification of the code in the programming language used by the interface. The interface code can be written in different programming languages. After determining the programming language used by the interface, the key information of the test object can be extracted according to the specification of the programming language.
[0052] S206: Obtain a first script template from a pre-generated interface performance test script format library.
[0053] In the embodiment of the present invention, the first script template can be generated based on the function of the interface. The interface performance test script format library is a pre-established format library composed of multiple first script templates, wherein the first script template is used to generate the interface performance test script.
[0054] Since the performance test of an interface can include multiple different performance indicators, the content of the test will also vary depending on the selection of the performance indicator. Therefore, the interface performance test script format library can generate different first script templates for different performance indicator combinations, and select the appropriate first script template as needed in actual applications. The above-mentioned first script template can be one or more, and is not specifically limited.
[0055] S208: Generate a control for interface performance testing using the first script template, set the request parameter of the control as key information, and obtain a performance testing script.
[0056] In an embodiment of the present invention, a test tool can be used to generate an interface performance test script. There are many test tools, such as Jmeter tools. The Jmeter tool can be used to generate a first script template to obtain an interface performance test script format library, and the first script template can be used to generate a control for interface performance testing. After setting the request parameter of the control as the key information of the test object, the interface performance test script can be obtained.
[0057] S210: Run the performance test script to perform a performance test, monitor the system operation status, and compare the system operation status with a preset threshold.
[0058] S212: If the system operating status is lower than the threshold, increase the pressure of the performance test and continue the performance test until the system operating status reaches the threshold and stops the performance test.
[0059] In the embodiment of the present invention, the system operation status refers to the resource usage and / or processing response of the device performing the performance test. The resource usage includes at least one of the following: CPU occupancy, memory occupancy, etc. The processing response includes at least one of the following: throughput, average response time, etc.
[0060] The parameter corresponding to the system operation state may be one or more parameters. If there are multiple parameters, each parameter has a corresponding threshold value. In this case, the condition for stopping the performance test is that multiple parameters have reached the corresponding threshold value, indicating that the system has reached the limit state.
[0061] For example, the system operation status includes CPU occupancy and throughput, so a CPU occupancy threshold and a throughput threshold are preset. When the CPU occupancy reaches the corresponding threshold and the throughput reaches the corresponding threshold, the pressure of the performance test is no longer increased and the performance test is stopped.
[0062] In the embodiment of the present invention, the pressure of the performance test can be increased in a fixed step size, for example, increasing the number of concurrency by 5% each time, etc., and the specific steps are not limited. Repeatedly increasing the pressure of the performance test can make the system operation status continue to rise until the threshold is reached.
[0063] The above mentioned increase in the pressure of performance testing can also be achieved by using tools. For example, using the Jmeter tool to continuously increase the pressure of performance testing. This method can simulate a huge load on the test object, test their strength under different pressure categories and analyze the overall performance.
[0064] S214: Acquire the performance index of the test object obtained through the test as the upper limit value of the performance of the test object.
[0065] In the embodiment of the present invention, the test result can be expressed in various forms, such as generating a performance script report. The test result usually includes various performance indicators, reflecting different functions of the test object. For example, the performance indicator of the test object may include at least one of the following: response time, throughput, number of concurrent users, success rate, error rate, etc.
[0066] Since the system operating status has reached the threshold when the performance test is stopped, the test result obtained at this time represents the performance index of the interface under the maximum pressure, that is, the performance index in the test result represents the performance upper limit value of the test object.
[0067] The above method provided by the embodiment of the present invention determines the test object for performance testing based on the production call volume, where the test object is an interface, obtains an interface description document, uses a pre-generated interface code format library, extracts key information of the test object from the interface description document, obtains a first script template in the pre-generated interface performance test script format library, uses the first script template to generate a control for interface performance testing, sets the request parameters of the control as key information, obtains a performance test script, runs the performance test script to perform a performance test, and monitors the system operating status, compares the system operating status with a preset threshold, and if the system operating status is lower than the threshold, increases the pressure of the performance test to continue the performance test until the system operating status reaches the threshold, stops the performance test, and obtains the performance indicator of the test object obtained by the test as the upper limit of the performance of the test object, thereby realizing the automation of performance testing without human participation, greatly improving testing efficiency, and reducing costs.
[0068] like Figure 3 As shown, an embodiment of the present invention provides another automated performance testing method, which is described by taking a database associated with an interface as an example of a test object. The method may include the following steps: S302: Determine a test object for performance testing based on the production call volume.
[0069] The test object is a database associated with the interface, and the production call volume can reflect the situation of the interface being called. Specifically, the production call volume can be the number of times the interface is called in a historical period. Accordingly, the above step S302 can specifically include: A plurality of interfaces are sorted from high to low according to the production call volume, a specified number of interfaces at the top of the sort are selected, and the selected interfaces and / or databases associated with the selected interfaces are used as test objects of the performance test.
[0070] The specified number can be set as needed, and the specific value is not limited.
[0071] In the embodiment of the present invention, the above-mentioned production call volume can be obtained using a third-party monitoring tool. There can be multiple third-party tools, including but not limited to one of the following: Tiandan, Prometheus, Zabbix, etc.
[0072] S304: Obtain an interface description document, and use a pre-generated interface code format library to extract key information of the test object from the interface description document.
[0073] In the embodiment of the present invention, the interface description document is a document including various information of the interface. Through the interface description document, key information such as the function of the interface, various parameter information, programming language, and request method can be understood.
[0074] The interface code format library is used to extract key information of the test object according to the specification of the interface code writing format. The specification of the interface code encoding format refers to the writing specification of the code in the programming language used by the interface. The interface code can be written in different programming languages. After determining the programming language used by the interface, the key information of the test object can be extracted according to the specification of the programming language.
[0075] S306: Obtain a second script template from a pre-generated database performance test script format library.
[0076] Usually, the operations involved in an interface include operations related to the database. Therefore, once the interface is determined, the database operation language related to the interface can be determined.
[0077] In the embodiment of the present invention, the second script template can be generated based on the database operation language associated with the interface. Specifically, the database operation language associated with the interface can be obtained by calling an interface.
[0078] For example, a query interface is used to query results based on keywords input by a user. The query interface involves operations for querying a database. Then, the operation language for querying the corresponding database can be obtained by calling the query interface.
[0079] In the embodiment of the present invention, a third-party tool can also be used to obtain the database operation language. For example, the Pinpoint tool is used, which is a full-link analysis tool that provides non-intrusive call chain monitoring, method execution details viewing and other functions. The Pinpoint tool can be used to obtain the database operation language included in the interface.
[0080] In an embodiment of the present invention, the database performance test script format library is a pre-established format library composed of multiple second script templates, wherein the second script template is used to generate a database performance test script. Since the performance test of a database may include multiple different performance indicators, the content of the test will also vary according to the selection of the performance indicator. Therefore, the database performance test script format library can be set to generate different second script templates for different performance indicator combinations, and the appropriate second script template can be selected as needed in actual applications. Among them, the above-mentioned second script template can be one or more, and is not specifically limited.
[0081] S308: Generate a control for database performance testing using the second script template, set the request parameter of the control as key information, and obtain a performance testing script.
[0082] In the embodiment of the present invention, a test tool can be used to generate a database performance test script. There are many test tools, such as Jmeter tools. The Jmeter tool can be used to generate a second script template to obtain a database performance test script format library, and the second script template can be used to generate a control for database performance testing. After setting the request parameter of the control as the key information of the test object, the database performance test script can be obtained.
[0083] S310: Run the performance test script to perform performance testing, monitor the system operating status, and compare the system operating status with a preset threshold.
[0084] S312: If the system operating status is lower than the threshold, increase the pressure of the performance test and continue the performance test until the system operating status reaches the threshold and stops the performance test.
[0085] In the embodiment of the present invention, the system operation status refers to the resource usage and / or processing response of the device performing the performance test. The resource usage includes at least one of the following: CPU occupancy, memory occupancy, etc. The processing response includes at least one of the following: throughput, average response time, etc.
[0086] The parameter corresponding to the system operation state may be one or more parameters. If there are multiple parameters, each parameter has a corresponding threshold value. In this case, the condition for stopping the performance test is that multiple parameters have reached the corresponding threshold value, indicating that the system has reached the limit state.
[0087] For example, the system operation status includes CPU occupancy and throughput, so a CPU occupancy threshold and a throughput threshold are preset. When the CPU occupancy reaches the corresponding threshold and the throughput reaches the corresponding threshold, the pressure of the performance test is no longer increased and the performance test is stopped.
[0088] In the embodiment of the present invention, the pressure of the performance test can be increased in a fixed step size, for example, increasing the number of concurrency by 5% each time, etc., and the specific steps are not limited. Repeatedly increasing the pressure of the performance test can make the system operation status continue to rise until the threshold is reached.
[0089] The above mentioned increase in the pressure of performance testing can also be achieved by using tools. For example, using the Jmeter tool to continuously increase the pressure of performance testing. This method can simulate a huge load on the test object, test their strength under different pressure categories and analyze the overall performance.
[0090] S314: Acquire the performance index of the test object obtained through the test as the upper limit value of the performance of the test object.
[0091] In the embodiment of the present invention, the test result can be expressed in various forms, such as generating a performance script report. The test result usually includes various performance indicators, reflecting different functions of the test object. For example, the performance indicator of the test object may include at least one of the following: response time, throughput, number of concurrent users, success rate, error rate, etc.
[0092] Since the system operating status has reached the threshold when the performance test is stopped, the test result obtained at this time represents the performance index of the interface under the maximum pressure, that is, the performance index in the test result represents the performance upper limit value of the test object.
[0093] The above method provided by the embodiment of the present invention determines the test object for performance testing based on the production call volume, where the test object is a database associated with an interface, obtains an interface description document, uses a pre-generated interface code format library, extracts key information of the test object from the interface description document, obtains a second script template in the pre-generated database performance test script format library, uses the second script template to generate a control for database performance testing, sets the request parameters of the control as key information, obtains a performance test script, runs the performance test script for performance testing, and monitors the system operating status, compares the system operating status with a preset threshold, and if the system operating status is lower than the threshold, increases the pressure of the performance test to continue the performance test until the system operating status reaches the threshold, stops the performance test, and obtains the performance index of the test object obtained by the test as the upper limit of the performance of the test object, thereby realizing the automation of performance testing without human participation, greatly improving testing efficiency, and reducing costs.
[0094] It is worth mentioning that in the embodiment of the present invention, performance testing can be performed on both the interface and the database associated with the interface. The two can be performed simultaneously or in sequence. The order of precedence can be set as needed and is not specifically limited.
[0095] Figure 4 A flow chart of the interface and database synchronization performance test provided by the embodiment of the present invention. Figure 4 , and simultaneously perform performance tests on the interface and the database associated with the interface. In this scenario, the stopping condition of the performance test is that the system operation status reaches the threshold. If the threshold is not reached, the pressure on the interface performance test and the pressure on the database performance test can be increased respectively until the system operation status reaches the threshold. The performance indicators of the test object obtained at this time are used as the performance upper limit value of the test object. For example, after the test, the interface performance script report and the database performance script report are obtained, which are used as the performance upper limit value of the interface and the performance upper limit value of the database respectively.
[0096] The above is an automated performance testing method provided by an embodiment of the present invention. Based on the same idea, an embodiment of the present invention also provides an automated performance testing device, such as Figure 5 As shown, this may include: A determination module 501 is used to determine a test object for performance testing based on a production call volume, where the production call volume reflects a situation where an interface is called, and the test object includes an interface and / or a database associated with the interface; An acquisition module 502 is used to acquire key information of a test object; The script module 503 is used to generate a control for performance testing based on key information to obtain a performance testing script; The testing module 504 is used to run the performance testing script to perform performance testing and obtain the performance indicators of the test object.
[0097] In the embodiment of the present invention, the determination module may be used to: Sort multiple interfaces from high to low according to the production call volume, where the production call volume is the number of times the interface is called in a historical period; Select the specified number of interfaces that are ranked first; The selected interface and / or a database associated with the selected interface is used as a test object of the performance test.
[0098] In the embodiment of the present invention, the acquisition module can be used to: Get the interface description document; Use the pre-generated interface code format library to extract key information of the test object from the interface description document. The interface code format library is used to extract key information of the test object according to the specification of the interface code writing format.
[0099] In one implementation, the script module may be used to: In the case where the test object is an interface, obtaining a first script template from a pre-generated interface performance test script format library, wherein the first script template is generated based on a function of the interface; A control for interface performance testing is generated using the first script template, and a request parameter of the control is set as key information to obtain a performance testing script.
[0100] In another implementation, the script module can be used to: In the case where the test object is a database associated with an interface, obtaining a second script template from a pre-generated database performance test script format library, wherein the second script template is generated based on a database operation language associated with the interface; The second script template is used to generate a control for database performance testing, and the request parameters of the control are set as key information to obtain a performance testing script.
[0101] In the embodiment of the present invention, the test module can be used for: Run performance test scripts to perform performance tests and monitor system operation status; Compare the system operating status with the preset threshold value; If the system operating status is lower than the threshold, the performance test pressure is increased and the performance test is continued until the system operating status reaches the threshold, and the performance test is stopped. The performance index of the test object obtained by the test is obtained as the performance upper limit value of the test object.
[0102] The above-mentioned device provided by the embodiment of the present invention can execute the method provided by any of the above-mentioned method embodiments. For detailed processes, please refer to the description in the method embodiments, which will not be repeated here.
[0103] The above-mentioned device provided by the embodiment of the present invention determines the test object for performance testing based on the production call volume, the production call volume reflects the situation of the interface being called, the test object includes the interface and / or the database associated with the interface, obtains the key information of the test object, generates the control for performance testing based on the key information, obtains the performance test script, runs the performance test script to perform performance testing, and obtains the performance indicators of the test object, thereby realizing the automation of performance testing without human participation, greatly improving the testing efficiency and reducing the cost.
[0104] Figure 6 The hardware structure diagram of an electronic device for implementing various embodiments of the present invention is shown in FIG. The electronic device 600 includes but is not limited to: a radio frequency unit 601, a network module 602, an audio output unit 603, an input unit 604, a sensor 605, a display unit 606, a user input unit 607, an interface unit 608, a memory 609, a processor 610, and a power supply 611. Those skilled in the art will appreciate that Figure 6 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. In the embodiments of the present invention, the electronic device includes but is not limited to a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted terminal, a wearable device, and a pedometer.
[0105] Among them, processor 610 is used to determine the test object for performance testing based on the production call volume, the production call volume reflects the situation of the interface being called, and the test object includes the interface and / or the database associated with the interface; obtain key information of the test object; generate controls for performance testing based on the key information to obtain a performance test script; run the performance test script to perform performance testing and obtain performance indicators of the test object.
[0106] An embodiment of the present invention provides an electronic device, which determines a test object for performance testing based on a production call volume, wherein the production call volume reflects a situation in which an interface is called, and the test object includes an interface and / or a database associated with the interface, obtains key information of the test object, generates a control for performance testing based on the key information, obtains a performance test script, runs the performance test script to perform performance testing, and obtains performance indicators of the test object, thereby realizing automation of performance testing without manual intervention, greatly improving test efficiency, and reducing costs.
[0107] It should be understood that in the embodiment of the present invention, the radio frequency unit 601 can be used for receiving and sending signals during information transmission or communication. Specifically, after receiving downlink data from the base station, it is sent to the processor 610 for processing; in addition, uplink data is sent to the base station. Generally, the radio frequency unit 601 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 601 can also communicate with the network and other electronic devices through a wireless communication system.
[0108] The electronic device provides users with wireless broadband Internet access through the network module 602, such as helping users to send and receive emails, browse web pages, and access streaming media.
[0109] The audio output unit 603 can convert the audio data received by the RF unit 601 or the network module 602 or stored in the memory 609 into an audio signal and output it as sound. Moreover, the audio output unit 603 can also provide audio output related to a specific function performed by the electronic device 600 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 603 includes a speaker, a buzzer, a receiver, etc.
[0110] The input unit 604 is used to receive audio or video signals. The input unit 604 may include a graphics processor (GPU) 6041 and a microphone 6042. The graphics processor 6041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 606. The image frame processed by the graphics processor 6041 can be stored in the memory 609 (or other storage medium) or sent via the radio frequency unit 601 or the network module 602. The microphone 6042 can receive sound and can process such sound into audio data. The processed audio data can be converted into a format output that can be sent to a mobile communication base station via the radio frequency unit 601 in the case of a telephone call mode.
[0111] The electronic device 600 also includes at least one sensor 605, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 6061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 6061 and / or the backlight when the electronic device 600 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used to identify the posture of the electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 605 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be repeated here.
[0112] The display unit 606 is used to display information input by the user or information provided to the user. The display unit 606 may include a display panel 6061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0113] The user input unit 607 can be used to receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device. Specifically, the user input unit 607 includes a touch panel 6071 and other input devices 6072. The touch panel 6071, also known as a touch screen, can collect user touch operations on or near it (such as operations performed by users using fingers, styluses, or any other suitable objects or accessories on or near the touch panel 6071). The touch panel 6071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact point coordinates, and then sends it to the processor 610, receives the command sent by the processor 610 and executes it. In addition, the touch panel 6071 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 6071, the user input unit 607 may also include other input devices 6072. Specifically, other input devices 6072 may include but are not limited to a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.
[0114] Furthermore, the touch panel 6071 may be overlaid on the display panel 6061. When the touch panel 6071 detects a touch operation on or near it, it is transmitted to the processor 610 to determine the type of touch event. Then, the processor 610 provides corresponding visual output on the display panel 6061 according to the type of touch event. Figure 6 In the figure, the touch panel 6071 and the display panel 6061 are used as two independent components to realize the input and output functions of the electronic device. However, in some embodiments, the touch panel 6071 and the display panel 6061 can be integrated to realize the input and output functions of the electronic device, which is not limited here.
[0115] The interface unit 608 is an interface for connecting an external device to the electronic device 600. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 608 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic device 600 or may be used to transmit data between the electronic device 600 and an external device.
[0116] The memory 609 can be used to store software programs and various data. The memory 609 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 609 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0117] The processor 610 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 609 and calling data stored in the memory 609, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. The processor 610 may include one or more processing units; preferably, the processor 610 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 610.
[0118] The electronic device 600 may also include a power supply 611 (such as a battery) for supplying power to various components. Preferably, the power supply 611 may be logically connected to the processor 610 via a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.
[0119] Preferably, an embodiment of the present invention further provides an electronic device, comprising a processor 610, a memory 609, and a computer program stored in the memory 609 and executable on the processor 610. When the computer program is executed by the processor 610, the various processes of the above-mentioned method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0120] An embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the various processes of the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0121] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0122] The above-mentioned computer-readable storage medium provided by an embodiment of the present invention determines the test object for performance testing based on the production call volume, the production call volume reflects the situation of the interface being called, the test object includes the interface and / or a database associated with the interface, obtains key information of the test object, generates controls for performance testing based on the key information, obtains a performance test script, runs the performance test script to perform performance testing, and obtains performance indicators of the test object, thereby realizing the automation of performance testing without human participation, greatly improving testing efficiency and reducing costs.
[0123] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0124] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0125] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0126] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0127] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0128] Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0129] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. According to the definition in this article, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0130] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0131] The above description is only an embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.
Claims
1. An automated performance testing method, characterized in that: The method comprises: Determine a test object for performance testing based on a production call volume, wherein the production call volume reflects a situation in which an interface is called, and the test object includes an interface and / or a database associated with the interface; Obtaining key information of the test object; Generate a control for performance testing based on the key information to obtain a performance testing script; Run the performance test script to perform performance testing and obtain the performance indicators of the test object.
2. The method according to claim 1, characterized in that The step of determining the test object for performance testing based on the production call volume includes: Sort the multiple interfaces from high to low according to the production call volume, wherein the production call volume is the number of times the interface is called in a historical period; Select the specified number of interfaces that are ranked first; The selected interface and / or a database associated with the selected interface is used as a test object of the performance test.
3. The method according to claim 1, characterized in that The obtaining of key information of the test object includes: Get the interface description document; Using a pre-generated interface code format library, extracting key information of the test object from the interface description document; The interface code format library is used to extract key information of the test object according to the specification of the interface code writing format.
4. The method according to claim 1, characterized in that The generating of the control for performance testing based on the key information to obtain the performance testing script includes: In the case where the test object is an interface, obtaining a first script template from a pre-generated interface performance test script format library; Generate a control for interface performance testing using the first script template, set a request parameter of the control as the key information, and obtain a performance testing script; Wherein, the first script template is generated based on the function of the interface.
5. The method according to claim 1, characterized in that The generating of the control for performance testing based on the key information to obtain the performance testing script includes: In the case where the test object is a database associated with an interface, obtaining a second script template from a pre-generated database performance test script format library; Using the second script template to generate a control for database performance testing, setting a request parameter of the control to the key information, and obtaining a performance testing script; The second script template is generated based on a database operation language associated with the interface.
6. The method according to claim 1, characterized in that The step of running the performance test script to perform a performance test and obtaining a performance indicator of the test object includes: Run the performance test script to perform performance testing and monitor the system operation status; Compare the system operating status with the preset threshold value; If the system operating status is lower than the threshold, the performance test pressure is increased to continue the performance test until the system operating status reaches the threshold, and the performance test is stopped. The performance index of the test object obtained by the test is obtained as the performance upper limit value of the test object.
7. An automated performance testing device, characterized in that: The device comprises: A determination module, configured to determine a test object for performance testing based on a production call volume, wherein the production call volume reflects a situation in which an interface is called, and the test object includes an interface and / or a database associated with the interface; An acquisition module, used to acquire key information of the test object; A script module, used to generate a control for performance testing based on the key information to obtain a performance testing script; The test module is used to run the performance test script to perform performance testing and obtain the performance indicators of the test object.
8. An electronic device, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the automated performance testing method as claimed in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the automated performance testing method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the steps of the automated performance testing method according to any one of claims 1 to 6.