Interface pressure testing method and device, equipment and storage medium

By using the target configuration file and interface identifier of the target use case combined with the preset interface library to generate the initial pressure test script, and calling the dispatching center for interface stress testing, the problem of cumbersome rewriting and operation in the existing technology is solved, and efficient, convenient and accurate interface stress testing is achieved.

CN120029834APending Publication Date: 2025-05-23SHENZHEN KEMAI TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411999645.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-23

AI Technical Summary

Technical Problem

The existing technology requires rewriting scripts when conducting interface stress testing for new scenarios, and the cluster interface stress testing operation is cumbersome.

Method used

By obtaining the target configuration file and target interface identifier of the target use case, combining the preset interface library to automatically generate the initial pressure test script, and calling the dispatch center for interface stress testing.

Benefits of technology

It avoids the cumbersomeness of rewriting pressure test scripts in new scenarios, simplifies the operation process of cluster interface stress testing, greatly improves testing efficiency, and ensures the accuracy and reliability of the test.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120029834A_ABST
    Figure CN120029834A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of testing, and provides an interface pressure testing method and device, equipment and a storage medium, and the method comprises the steps: generating an initial pressure testing script of a target use case according to each target interface identifier and a preset interface report library, and storing an interface message in the preset interface report library, the interface message is generated based on historical use case information corresponding to the interface function test; and calling a dispatching center, performing interface pressure testing on a target cluster corresponding to the target use case according to the target configuration file and the initial pressure testing script, and obtaining an interface pressure testing result. The pressure test script is automatically generated by multiplexing the interface message in the preset interface message library, so that the pressure test script does not need to be rewritten when an interface pressure test is performed for a new scene; by obtaining the target configuration file of the target use case and the corresponding target interface identifiers, the interface pressure test of the target cluster corresponding to the target use case is started by one key, and the operation is simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of testing technology, and in particular, relates to an interface pressure testing method, device, equipment and storage medium. Background Art

[0002] In order to improve the performance of the interface, it is necessary to fully stress test the interface. With the rapid iteration of software development, the demand for stress testing of the interface has increased dramatically. The current method of stress testing through the interface is: Step 1, the user first manually enters the request header information, server name, path and message body and other request data; Step 2 (optional step), add parameterized files, set and enter variable names and select loop mode; Step 3 (optional step), add the response extraction associated parameters in the logged-in interface, and name the variable name; Step 4 (optional step), add random variables and user definitions; Step 5, add response assertions to determine whether the expected results are consistent with the actual results during the execution process; Step 6, add the number of results to be viewed and the aggregate report; Step 7, the next interface needs to repeat steps 1, 5, and 6, and the others are selected according to the actual scenario. The corresponding value (parameter value) in the request body of the next interface is manually replaced with the variable name in step 3 or step 2 or step 4 of the login interface. If there are multiple values ​​that need to be replaced, they all need to be replaced manually. If there are other interfaces in the scenario, repeat this step.

[0003] This testing method has the following problems: when performing interface stress testing for new scenarios, the script needs to be rewritten. Summary of the invention

[0004] The embodiments of the present application provide an interface stress testing method, apparatus, device and storage medium, which can solve the technical problems of needing to rewrite scripts when performing interface stress testing for new scenarios and cumbersome operations when performing interface stress testing for a cluster.

[0005] In a first aspect, an embodiment of the present application provides an interface pressure testing method, comprising:

[0006] Get the target configuration file of the target use case and the corresponding target interface identifiers;

[0007] Generate an initial stress test script for the target use case according to each of the target interface identifiers and a preset interface message library, wherein the preset interface message library stores interface messages, and the interface messages are generated based on use case information corresponding to the historical interface function test;

[0008] The scheduling center is called to perform an interface stress test on the target cluster corresponding to the target use case according to the target configuration file and the initial stress test script, and obtain the interface stress test result.

[0009] In a possible implementation of the first aspect, the stress testing platform uses the target configuration file of the terminal target use case and the corresponding target interface identifiers. The stress testing platform first generates an initial stress testing script for the target use case based on each of the target interface identifiers and the preset interface message library, and then calls the scheduling center to perform an interface stress test on the target cluster corresponding to the target use case according to the target configuration file and the initial stress testing script, and obtains the interface stress test result. The stress testing script is automatically generated by reusing the interface messages in the preset interface message library, so that there is no need to rewrite the stress testing script when performing interface stress testing for new scenarios. By obtaining the target configuration file of the target use case and the corresponding target interface identifiers, the interface stress test of the target cluster corresponding to the target use case can be started with one click, which simplifies the operation.

[0010] In a second aspect, an embodiment of the present application provides an interface pressure testing device, comprising:

[0011] A data acquisition module is used to obtain a target configuration file of a target use case and corresponding target interface identifiers;

[0012] A script generation module, used to generate an initial stress testing script for the target use case according to each of the target interface identifiers and a preset interface message library, wherein the preset interface message library stores interface messages, and the interface messages are generated based on the use case information corresponding to the historical interface function test;

[0013] The interface stress test result determination module is used to call the scheduling center, perform an interface stress test on the target cluster corresponding to the target use case according to the target configuration file and the initial stress test script, and obtain the interface stress test result.

[0014] In a third aspect, an embodiment of the present application provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the interface stress testing method as described in any one of the first aspects when executing the computer program.

[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the interface stress testing method as described in any one of the first aspects is implemented.

[0016] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes the interface stress testing method described in any one of the above-mentioned first aspects.

[0017] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.

[0018] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0019] The present application can use the target configuration file and target interface identifier of the target use case in combination with the preset interface message library to quickly generate the initial stress test script, avoiding the tediousness of rewriting the script for the new scenario. At the same time, by calling the scheduling center to perform interface stress test on the target cluster according to the target configuration file and the initial stress test script, the operation process of cluster interface stress test is simplified, which not only greatly improves the test efficiency, but also ensures the accuracy and reliability of the test, and can timely and effectively discover the possible problems of the system in terms of interface stress, ensure the stability and quality of the system, and help to achieve efficient, convenient and accurate interface stress test. By using the interface message generated based on the historical use case information corresponding to the interface function test and storing it in the preset interface message library, the effective reuse of resources is realized. This reuse makes it possible to directly call the existing interface message in the preset interface message library when facing new interface stress test requirements, without repeatedly generating or collecting interface messages, which greatly improves the work efficiency and timeliness of the test. At the same time, the reuse of historical data also ensures the consistency and coherence of the test, and reduces the errors and uncertainties caused by data differences. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, 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 of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0021] Figure 1 It is a schematic diagram of an application scenario provided by an embodiment of the present application;

[0022] Figure 2 It is a flowchart of an interface pressure testing method provided by an embodiment of the present application;

[0023] Figure 3 is another flow chart of the interface pressure testing method provided by one embodiment of the present application;

[0024] Figure 4 is a structural schematic diagram of an interface pressure testing device provided in an embodiment of the present application;

[0025] Figure 5 is another structural schematic diagram of the interface pressure testing device provided in an embodiment of the present application;

[0026] Figure 6 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0028] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0029] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0030] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0031] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0032] The interface pressure testing method provided in the embodiment of the present application can be applied to Figure 1In the application environment, the application environment includes a terminal 11, a stress testing platform 12, a preset interface message library 13, a scheduling center 14, a resource pool 15, a target cluster 16, and Kafka 17. The resource pool 15 is provided with multiple nodes. The scheduling center 14 refers to a server that performs comprehensive scheduling on each node in the resource pool 15. Kafka is a high-throughput distributed publish-subscribe messaging system. Among them, the stress testing platform 12 can be regarded as an interface stress testing platform.

[0033] Optionally, each node in the resource pool 15 that is scheduled is used as the target cluster 16 .

[0034] Optionally, the application environment also includes an interface automation testing platform. It should be noted that the interface automation testing platform is used to perform interface function testing on the interface to be tested, wherein use case information for the interface function testing of the interface to be tested, such as URL (Uniform Resource Locator, a character sequence used to identify and locate resources on the Internet), domain name, request body, request header, parameter associations and assertions, is assembled to generate interface messages, and the interface messages are stored in a preset interface message library.

[0035] The preset interface message library is used to store the corresponding data or associated data of the interface identifier and the interface message. Optionally, the preset interface message library can be stored in the interface automation test platform, and the stress testing platform 12 obtains the interface message of the preset interface message library from the interface automation test platform. It can be understood that the interface message in the preset interface message library is generated based on the historical use case information corresponding to the interface function test.

[0036] Optionally, when the preset interface message library is stored in the interface automation test platform, the interface identifier and interface message of the test interface corresponding to each test case that has been tested for interface function in the interface automation test platform can be obtained, and an initial stress test script that can be used for the stress test platform 12 to perform interface stress testing is generated according to the interface identifier of the test interface corresponding to each test case and the interface message corresponding to each interface identifier, wherein one test case corresponds to one initial stress test script, and each test case that performs interface function testing in the interface automation test platform includes a target case. The interface identifier of the test interface includes the target interface identifier.

[0037] Optionally, the preset interface message library may also be stored in the storage space on the stress testing platform 12, or may be stored in other terminals other than the stress testing platform 12. The stress testing platform 12 obtains the interface message data in the preset interface message library from other terminals 11.

[0038] Optionally, the target configuration file can be stored in the stress testing platform 12 in advance, and the stress testing platform 12 can obtain the target configuration file of the target use case and the corresponding target interface identifiers from the storage space of the stress testing platform 12, or obtain the target configuration file of the target use case and the corresponding target interface identifiers through the terminal 11. The stress testing platform 12 first generates an initial stress testing script for the target use case according to each of the target interface identifiers and the preset interface message library, wherein the preset interface message library stores interface messages, and the interface messages are generated based on the use case information corresponding to the historical interface function test; the scheduling center 14 is called to perform an interface stress test on the target cluster 16 corresponding to the target use case according to the target configuration file and the initial stress testing script, and obtain the interface stress test result. By reusing the interface messages in the preset interface message library to automatically generate the initial stress testing script, there is no need to rewrite the stress testing script when performing interface stress testing for new scenarios. By obtaining the target configuration file corresponding to the target use case and the corresponding initial stress testing script, based on the target cluster, one-click startup of the interface stress test of the test interface corresponding to each target interface identifier in the target use case is achieved, thereby simplifying the operation.

[0039] In a possible implementation, the target configuration file of the target use case may be pre-stored in the storage space of the stress testing platform 12 .

[0040] The scheduling center 14 is used to: based on the resource pool 15, according to the target configuration file and the initial stress test script, perform interface stress testing on the target cluster 16 corresponding to the target use case, obtain the interface stress test result based on the interface stress test, and each node in the resource pool 15 is provided with a JMeter-core engine. By performing interface stress testing on the test interface corresponding to each target interface identifier in the target use case based on the target cluster 16, it is possible to find the performance bottleneck points that may appear in the test interface corresponding to each target interface identifier under high concurrency conditions, so as to optimize them in a targeted manner. After the interface stress test of the test interface corresponding to each target interface identifier is qualified, it means that it is verified that the test interface corresponding to each target interface identifier can run stably under greater pressure, reducing the risk of failure of the test interface corresponding to each target interface identifier after going online.

[0041] In a distributed system, the target cluster is a whole composed of multiple nodes. Nodes are the basic components of a cluster, and they work together to implement the functions and tasks of the cluster. Nodes have different roles and responsibilities in the cluster, such as processing data, providing services, storing information, etc. Many nodes communicate and collaborate with each other, so that the entire cluster can run efficiently, with stronger processing capabilities, fault tolerance and scalability.

[0042] JMeter is an open source stress testing tool used to simulate application performance testing under various load conditions.

[0043] JMeter-core engine, an engine built based on JMeter's Java (object-oriented programming language) package. In a possible implementation, the scheduling center 14 starts the JMeter-core engine of the node in the resource pool 15, performs an interface stress test on the target cluster, obtains the test log data, and sends the test log data to kafka17. At this time, the stress testing platform 12 obtains all the test log data corresponding to the target configuration file from kafka17 for report generation, and uses the generated report as the interface stress test result.

[0044] In a possible implementation, the target cluster corresponding to the node in the resource pool 15 performs an interface stress test on the test interface corresponding to each target interface identifier in the target use case, obtains test log data, and sends the test log data to the stress testing platform 12. This is beneficial for the stress testing platform 12 to uniformly manage and analyze a large amount of test data and fully understand the test situation. The stress testing platform 12 can monitor the test log data generated during the test in real time, evaluate the performance and health status of the test interface corresponding to each target interface identifier in the target use case, help quickly locate problems and anomalies that occur in the interface stress test, and retain complete data records for subsequent review, comparison, and further research. After sending the test log data to the stress testing platform 12, the test results and data trends can be displayed in an intuitive manner on the stress testing platform 12, which is convenient for relevant personnel to understand and grasp the situation.

[0045] The terminal 11 includes but is not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The stress testing platform 12 can be implemented with an independent server or a server cluster consisting of multiple servers. The preset interface message library 13 is a database for storing interface messages. The present invention is described in detail below through specific embodiments.

[0046] Figure 2 A schematic flowchart of the interface stress testing method provided in the present application is shown. As an example but not a limitation, the method can be applied to the above-mentioned server.

[0047] S101: Obtain a target configuration file of a target use case and corresponding target interface identifiers;

[0048] Optionally, the target configuration file for the target use case may be obtained by the stress testing platform 12 directly obtaining a pre-stored target configuration file for the target use case; or the target configuration file for the target use case may be actively obtained from the terminal 11; or the target configuration file for the target use case sent by the terminal 11 may be received by the stress testing platform 12, and this embodiment does not limit this.

[0049] The target use case is the use case that needs to be tested, wherein the use case may correspond to one or at least two test interfaces to be tested. The use case is an operation requirement in a certain application scenario. For example, if the use case is to purchase product A, the test interfaces that need to be tested include: account login verification interface, face recognition interface, product display interface, product purchase interface, payment interface, and logistics information interface. Among them, there is an association between the use case and the test interface corresponding to the use case or the interface identifier corresponding to the test interface. The target configuration file is the configuration file used for interface stress testing this time. The configuration file is parameterized data, and the interface identifier and parameter value are recorded in the parameterized data. Among them, the interface identifier corresponding to the target use case includes the target interface identifier. The target interface identifier is the interface identifier of the test interface that needs to be tested in the target use case. The interface identifier can be a unique identifier such as an interface name or an interface ID. The corresponding test interface can be determined by the interface identifier. The parameter value is the specific data related to the interface. For example, for an interface that queries user information, the parameter value may include specific numerical values ​​or strings such as user ID and query conditions. These parameter values ​​are used to clarify the specific operation details and data requirements when the interface is executed to ensure that the interface can accurately execute the corresponding function and return appropriate results.

[0050] The target use case usually specifies the specific scenarios, operation procedures, and expected results required, while the target configuration file contains the specific parameters and settings required to implement the target use case. The target use case can be associated and matched with the target configuration file through naming conventions or identifier matching to make clear association definitions, so that when the target use case is executed, the corresponding target configuration file can be accurately found and loaded according to the association definition, thereby ensuring that the correct parameters and configurations can be obtained when the target use case is executed, thereby ensuring that the target use case can be run and tested as expected.

[0051] In addition, based on the association relationship between the use case and the test interface corresponding to the use case, when the target use case is clear, the interface identifiers of each test interface corresponding to the target use case, that is, each target interface identifier, can be obtained based on the association relationship between the use case and the test interface corresponding to the use case.

[0052] S102: Generate an initial stress testing script for the target use case according to each of the target interface identifiers and the preset interface message library;

[0053] Among them, the interface message stored in the preset interface message library is generated based on the use case information used for interface function testing in history, and the initial stress test script is generated based on the interface message stored in the preset interface message library. In essence, the initial stress test script can also be understood as being generated based on the use case information used for interface function testing in history.

[0054] Optionally, the interface messages stored in the preset interface message library may be that all the interface messages in the preset interface message library are generated based on historical use case information used for interface function testing, or that some of the interface messages in the preset interface message library are generated based on historical use case information used for interface function testing, and there is no limitation on this.

[0055] It should be noted that interface function testing is mainly to verify whether the interface functions correctly and whether specific business logic and operations are implemented in accordance with design requirements. Interface function testing focuses on checking whether the interface's response to various inputs is as expected, including correct processing results, returned status codes, etc., to ensure the accuracy and stability of the interface in terms of functionality. Interface stress testing focuses on the performance of the interface under stress conditions such as high concurrency and high traffic. Interface stress testing mainly examines the interface's processing capabilities, response time, resource utilization, system stability, etc. when it is subjected to a large number of requests, with the aim of discovering performance bottlenecks and potential problems that may occur when the interface is under high load.

[0056] Optionally, in a specific embodiment, generating an initial stress testing script based on each target interface identifier and a preset interface message library in a target configuration file may be that the stress testing platform retrieves the interface message corresponding to each target interface identifier from the preset interface message library, automatically assembles the stress testing script based on each interface message retrieved, and uses the assembled stress testing script as the initial stress testing script. It should be noted that the initial stress testing script is based on historical use case information for interface function testing, and interface messages are generated by assembling the use case information, and are automatically assembled based on the interface messages. The generation of the initial stress testing script realizes the reuse of historical use case information for interface testing, reduces testing costs, and shortens testing cycles.

[0057] Optionally, in a specific embodiment, the stress testing platform can obtain an initial stress testing script for performing interface stress testing on the test interface corresponding to each target interface identifier in the target use case through the interface automation testing platform, that is, the initial stress testing script is directly generated on the interface automation testing platform based on the use case information used for interface function testing in history. By reusing the initial stress testing script, the efficiency of the interface stress testing is improved, the time and computing resources for assembling the initial stress testing script are saved, and duplication of work is reduced.

[0058] S103: calling the scheduling center to perform an interface stress test on the target cluster corresponding to the target use case according to the target configuration file and the initial stress test script, and obtaining an interface stress test result.

[0059] The target use case is a means of testing and verifying the test interfaces corresponding to each target interface identifier corresponding to the target use case based on the target cluster. By executing the target use case, the function, performance, etc. of the test interfaces corresponding to each target interface identifier can be verified in various scenarios and conditions corresponding to the target use case to determine whether the test interfaces corresponding to each target interface identifier meet the requirements and standards corresponding to the target use case. The target use case is designed and executed for the test interfaces corresponding to each target interface identifier corresponding to a certain application scenario or a certain functional module or a certain business module, and is used to evaluate the status and quality of the test interfaces corresponding to each target interface identifier, such as knowing the performance of the test interface under pressure.

[0060] It can be understood that the target cluster corresponding to the target use case can be determined by the traffic distribution strategy in the stress testing strategy corresponding to the target use case, that is, the allocated nodes of the resource pool and the task allocation results corresponding to the nodes.

[0061] It should be noted that, according to the target configuration file and the initial stress testing script, the interface stress test is performed on the target cluster corresponding to the target use case. It can be understood that, according to the target configuration file and the initial stress testing script, the initial stress testing script is executed based on the target cluster corresponding to the target use case, the parameter assignment of the initial stress testing script is replaced through the target configuration file, and the interface stress test is performed on the test interface corresponding to each target interface identifier in the target use case based on the preset or customized stress testing strategy.

[0062] Optionally, the stress testing platform can send a test start instruction to the scheduling center according to the target configuration file and the initial stress testing script. In an optional implementation, when the scheduling center receives the test start instruction, based on the scheduling center's own pre-configured scheduling rules, it calls some or all nodes in the resource pool, performs interface stress testing on the target cluster according to the target configuration file and the initial stress testing script, and obtains the test log data generated by each node.

[0063] First, parse the target configuration file, and obtain information about the required number of nodes, specific node characteristics, etc. based on the results of the analysis. Then, screen and match in the resource pool based on this information to determine the nodes that meet the requirements. Next, use the pre-set scheduling mechanism or interface to send instructions to the selected nodes to start or allocate the number of test tasks for the selected nodes to perform interface stress testing. In this process, it may be necessary to determine the specific requirements and parameters based on the target configuration file and the initial stress test script, obtain the target script for each node, and configure and adjust the selected nodes accordingly through the target script to ensure that the selected nodes can correctly perform the interface stress test operations. In this way, accurate resource allocation can be achieved, and suitable nodes can be found according to needs; according to the pre-set scheduling mechanism or interface, the instructions can be ensured to be accurate and timely, so that the nodes can respond quickly to execution; according to the target configuration file and the initial stress test script, the target script of each node is determined, and the accuracy and consistency can be obtained, and reliable test log data can be obtained.

[0064] In an optional implementation, upon receiving the test start instruction, the scheduling center 14 calls the node corresponding to the target script in the resource pool according to the target script according to the pre-configured scheduling rules of the scheduling center 14 itself, performs an interface stress test on the target cluster, and obtains the test log data generated by the node corresponding to the target script. Among them, each target script is a stress test script obtained by replacing the parameters of the initial stress test script according to the parameter values ​​in the target configuration file. According to the parameter values ​​in the target configuration file, the initial stress test script is replaced by parameter assignment to obtain the target script of each node, so that the stress test script can adapt to different nodes or environment settings. By customizing the script of each node according to the specific parameter values ​​in the configuration file, the stress conditions in different scenarios can be simulated more accurately to ensure the accuracy and pertinence of the interface stress test.

[0065] For example, there is a line of code in the initial stress testing script: thread_count = 50 (indicating that the number of threads is 50), and the parameter value for node A in the target configuration file indicates thread_count = 80. After the parameter assignment is replaced, this line in the initial stress testing script for node A becomes thread_count = 80, and then the initial stress testing script after the parameter assignment is replaced for node A is used as the target script.

[0066] For example, if the initial stress test script has timeout = 10 (indicating a timeout of 10 seconds), and the target configuration file shows timeout = 15 for the parameter of node B, then the target script of node B will have timeout = 15. In this way, the stress test script of each node can flexibly adjust parameters according to the specific configuration to adapt to the characteristics and environmental requirements of different nodes.

[0067] The test log data includes the result data of the interface stress test and the log data generated during the test. The result data of the interface stress test includes but is not limited to: response time, throughput, number of transactions completed in 1 second, error rate, success rate and total number of requests.

[0068] Optionally, the output method of the interface stress test result can be directly displayed and output through the stress testing platform, or can be sent to a terminal and indirectly displayed and output through the terminal, and there is no limitation on this.

[0069] It is understandable that the present application does not need to rewrite scripts for new scenarios, but only needs to reuse the interface messages in the preset interface message library. The new scenario refers to the scenario of stress testing the test interface. The new scenario does not need to be rewritten because the original interface automation testing platform has written various test cases, and based on each test case, the interface function test is performed on the test interface corresponding to the test case. The subsequent interface stress test is performed on the test interface corresponding to each test case, which can be regarded as a new scenario. In the new scenario, there is no need to rewrite the test script, and the stress testing script can be automatically generated by reusing the interface messages in the preset interface message library.

[0070] Exemplarily, a new scenario can be a high-concurrency, high-traffic stress test of one or at least two test interfaces corresponding to each functional module (corresponding to a test case); or the test interfaces corresponding to each target interface identifier in the target case need to cope with ultra-high traffic impacts in a specific time period (such as a shopping festival), which is also a new scenario; or the test interfaces corresponding to each target interface identifier in the target case are connected to a new third-party system, and the relevant interfaces are stress tested to evaluate the performance in the new interaction scenario, which also belongs to a new scenario. For example, stress testing of interfaces under special circumstances such as different data levels and different request mode combinations (such as a large number of concurrent requests of multiple types) can be regarded as new scenarios.

[0071] This embodiment can use the target configuration file and target interface identifier of the target use case in combination with the preset interface message library to quickly generate the initial stress test script, avoiding the tediousness of rewriting the script for the new scenario. At the same time, by calling the scheduling center to perform interface stress test on the target cluster according to the target configuration file and the initial stress test script, the operation process of cluster interface stress test is simplified, which not only greatly improves the test efficiency, but also ensures the accuracy and reliability of the test, and can timely and effectively discover the possible problems of the system in terms of interface stress, ensure the stability and quality of the system, and help to achieve efficient, convenient and accurate interface stress test. By using the interface message generated based on the historical use case information corresponding to the interface function test and storing it in the preset interface message library, the effective reuse of resources is realized. This reuse makes it possible to directly call the existing interface message in the preset interface message library when facing new interface stress test requirements, without repeatedly generating or collecting interface messages, which greatly improves the work efficiency and timeliness of the test. At the same time, the reuse of historical data also ensures the consistency and coherence of the test, and reduces the errors and uncertainties caused by data differences.

[0072] It is understandable that under normal circumstances, it is necessary to manually write stress testing scripts, such as manually entering various request parameters such as request header information, server name, path, and message body one by one. However, this application uses JMeter as a stress testing tool. What makes this solution different is that it automatically generates stress testing scripts based on interface messages. The interface messages here are not artificially constructed, but are generated based on historical use case information corresponding to interface function testing. In this way, there is no need to manually write stress testing scripts, which greatly improves efficiency and convenience, and can perform stress testing more quickly and accurately, while also reducing errors and uncertainties that may be caused by human operations.

[0073] See also Figure 3 In a possible implementation, before the step of generating the initial stress testing script of the target use case according to each of the target interface identifiers and the preset interface message library, the step includes:

[0074] S1011: Acquire each test interface corresponding to the test case and use case interface information of each test interface, wherein the test case includes the target use case, and the use case interface information is use case information corresponding to the interface function test historically used for the test interface;

[0075] Specifically, the various test interfaces corresponding to the test cases in the original interface automation testing platform and the use case interface information of each of the test interfaces can be obtained. The various test interfaces corresponding to the test cases input by the user through the client and the use case interface information of each of the test interfaces can also be obtained. The various test interfaces corresponding to the test cases and the use case interface information of each of the test interfaces can also be obtained from the preset storage space. The various test interfaces corresponding to the test cases and the use case interface information of each of the test interfaces can also be obtained from third-party applications.

[0076] It can be understood that each test interface includes an interface corresponding to the target interface identifier.

[0077] S1012: Assembling interface messages according to the use case interface information and a preset interface message assembly rule to obtain an interface message of each test interface;

[0078] Optionally, the interface message is a text in Json format. Json (JavaScript Object Notation) format refers to a lightweight data exchange format.

[0079] Specifically, parse the use case interface information to extract key parameters, such as request method, path, parameter name and value, etc.; clarify the structure of the interface message according to the preset interface message assembly rules, such as JSON, XML, etc.; based on the preset interface message assembly rules, that is, based on the structure of the interface message, build the basic framework of the message in the format; embed the extracted key parameters into the corresponding positions of the basic framework of the message according to the rules, and finally output the interface message.

[0080] S1013: Store the interface identifier of each test interface and the interface message as associated data in the preset interface message library.

[0081] Specifically, the interface identifier of each test interface is associated with the interface message to obtain associated data, and the associated data is stored in the preset interface message library.

[0082] This embodiment obtains the test case including the test interfaces and their use case interface information corresponding to the target use case, and assembles this information according to the preset interface message assembly rules to obtain the interface message, and then stores the interface identifier of the test interface and the corresponding interface message as associated data in the preset interface message library, thereby realizing the effective integration and management of the test interface related information, realizing the effective reuse of resources through the preset interface message library, and providing an accurate and complete data basis for the subsequent generation of the initial stress testing script, which can carry out stress testing work more efficiently and accurately, improve the test efficiency and quality, and ensure that the performance and stability of the test interface under different stress conditions can be accurately evaluated.

[0083] In a possible implementation, the step of generating an initial stress testing script for the target use case according to each of the target interface identifiers and the preset interface message library includes:

[0084] S1021: Acquire the interface message corresponding to each of the target interface identifiers from the preset interface message library;

[0085] Specifically, based on the association relationship between the interface identifier and the interface message in the preset interface message library, the interface message corresponding to each target interface identifier can be obtained from the preset interface message library.

[0086] S1022: taking the interface messages corresponding to the target interface identifiers as messages to be processed;

[0087] Specifically, S1021 obtains the interface messages corresponding to the target interface identifiers as messages to be processed.

[0088] S1023: Generate the initial stress testing script of the target use case according to the message to be processed and a preset script generation method.

[0089] Specifically, a preset format script is generated according to the message to be processed according to a preset script generation method. Optionally, the preset format script is a jmx format script, and the jmx format script is used as an initial stress testing script.

[0090] JMX format is the test plan file format of Apache JMeter, and its full name is "JMeter XML". JMX files are in XML (Extensible Markup Language) format, which means it is structured data stored in text form, which is easy for humans and machines to read.

[0091] It can be understood that in the embodiment, there is the following corresponding relationship: when there are at least two test interfaces corresponding to a target use case, correspondingly, a test interface corresponds to an interface identifier, a use case interface information and an interface message, at least two test interfaces, respectively corresponding to at least two target interface identifiers, at least two interface messages, at least two interface messages form a to-be-processed message, and the to-be-processed message generates an initial stress test script for the target use case according to a preset script generation method. Multiple Json format texts (i.e., interface messages) correspond to a jmx format script, and a Json format text corresponds to a test test interface. Generally, stress testing (i.e., interface stress testing) requires stress testing of multiple test interfaces in series, so a jmx format script is finally generated; the interface call execution order in the interface automation test platform is the same as the interface call execution order in the jmx format script, that is, in the interface automation test platform, for example, what is the order of 3 interfaces, then the jmx format script generated by merging is also stress tested in this order. These corresponding relationships in the interface automation test platform need to be configured during the use case test, and this corresponding relationship is automatically maintained when the jmx format script file is generated.

[0092] Optionally, the step of generating the initial stress testing script of the target use case according to the message to be processed in accordance with a preset script generation method specifically includes:

[0093] S10231: Encapsulate each interface message in the message to be processed into a HashTree object as a target object;

[0094] The HashTree object is an object in a hash tree. In computer science, a hash tree, also known as a Merkle Tree, is a persistent data structure that can be used to implement sets and mappings, and is intended to replace hash tables in pure functional programming.

[0095] Specifically, based on the encapsulation rule of the object in the hash tree, the message to be processed is encapsulated into a HashTree object, and the encapsulated HashTree object is used as the target object.

[0096] S10232: Call SaveService.saveTree as the entry method;

[0097] SaveService.saveTree is a method in JMeter.

[0098] S10233: performing preset format conversion according to the target object, the entry method and the preset saving service configuration template file to obtain a script to be processed;

[0099] Save the service configuration template file, which is the configuration template file used to save the service. Save the service, which is SaveService.properties in JMeter.

[0100] Optionally, the preset format is a file in jmx format, also called a jmx file. A jmx file is generally used to save the description information of an MBean and its relationship with other MBeans, and can also save various attributes of the MBean and their values. A jmx file is usually in XML format, so it is highly readable and can be easily used, edited and managed on multiple different platforms and systems.

[0101] According to the target object and the entry method, the preset save service configuration template file is updated, and the updated preset save service configuration template file is converted into a preset format, and the converted file is used as a script to be processed.

[0102] Specifically, S10234: taking the target interface identifier and the script to be processed as associated data to obtain first data;

[0103] Specifically, the target interface identifier is associated with the script to be processed, and associated data obtained by the association is used as the first data.

[0104] S10235: Jump to the step of encapsulating each interface message in the message to be processed into a HashTree object and re-execute it as the target object until each interface message in the message to be processed is converted into a script to be processed;

[0105] Specifically, jump to the step of encapsulating each interface message in the message to be processed into a HashTree object and re-execute it as the target object, that is, jump to step S10231 and re-execute step S10235. In other words, each target interface identifier in the target configuration file executes steps S10231 to S10235, which means that the stress testing script has been generated.

[0106] S10236: Combine the scripts to be processed to obtain the initial stress testing script.

[0107] Specifically, according to the generation order of the scripts to be processed, the scripts to be processed are combined into one script, and the combined script is used as the initial stress testing script.

[0108] This embodiment reuses the interface messages in the preset interface message library and automatically generates a stress testing script according to each target interface identifier in the target configuration file, so that there is no need to rewrite the stress testing script when performing interface stress testing for a new scenario.

[0109] In a possible implementation, the calling scheduling center performs an interface stress test on the target cluster corresponding to the target use case according to the target configuration file and the initial stress test script, and before obtaining the interface stress test result, the method further includes:

[0110] S41: Obtaining a stress testing strategy corresponding to the target use case;

[0111] The stress testing strategy can be a preset default stress testing strategy or a customized one. For different use cases, the stress testing strategies can be different, the same, or partially the same.

[0112] Stress testing strategies include: concurrent user number strategy, request frequency strategy, stress testing duration strategy, request type strategy, traffic distribution strategy (that is, the nodes allocated to the resource pool and the task allocation results corresponding to the nodes), performance indicator monitoring strategy, fault tolerance strategy, and mixed scenario strategy. Stress testing strategies also include pressure increase strategy: gradually increase the amplitude and speed of pressure to observe the performance of the system under different pressure levels. It is understandable that different stress testing strategies can be used to simulate different levels of pressure.

[0113] Concurrent user number strategy: Determine the number of concurrent users of different orders of magnitude for testing. Stress test duration strategy: Set the duration of the test to evaluate the stability of the system under long-term pressure. Request type strategy: Develop strategies for different request types (such as read, write, query, etc.). Traffic distribution strategy: Simulate different traffic distribution situations, such as uniform distribution or concentrated distribution in a specific time period. Performance indicator monitoring strategy: Clarify the key performance indicators that need to be monitored, such as response time, throughput, resource utilization, etc., and set corresponding thresholds and alarm mechanisms. Fault-tolerant strategy: Test the system's ability to recover and continue to operate in the face of partial failures or errors. Mixed scenario strategy: Create a stress test plan that includes a combination of multiple business scenarios to more realistically simulate the actual business environment.

[0114] S42: determining each target node and a task allocation result corresponding to the target node from a resource pool according to the stress testing strategy, wherein each target node forms the target cluster;

[0115] Specifically, first, according to the resource requirements in the stress testing strategy, such as the required computing power, storage capacity, etc., eligible nodes are screened out in the resource pool, and these nodes become target nodes. Then, for each target node, according to its performance characteristics and the task allocation rules in the stress testing strategy, such as allocating tasks according to the processing capacity ratio of the node, or allocating different types of tasks according to specific business logic, etc., the specific tasks that the target node needs to undertake, as well as the number and priority of tasks, are determined to form a task allocation result. In the determination process, factors such as the current load of the node and the network connection status may be comprehensively considered to ensure the rationality and efficiency of task allocation.

[0116] The calling scheduling center performs an interface stress test on the target cluster corresponding to the target use case according to the target configuration file and the initial stress test script, and obtains the interface stress test result, including:

[0117] S1031: The calling scheduling center is used to respond to the test start instruction, perform an interface stress test on the target cluster according to the task allocation result, the stress test strategy, the target configuration file and the initial stress test script, and obtain the interface stress test result.

[0118] Optionally, the test start instruction is received by the test start instruction (such as triggered by clicking a test start button). This improves the convenience and ease of use of the test operation, allowing the user to easily start the test process without complicated operation steps and professional knowledge.

[0119] Optionally, the test start instruction is triggered automatically at a scheduled time or preset time interval. Scheduled or automatically triggered at a preset time interval reduces the need for manual operation, improves the automation of the test, and saves manpower and time costs; it can ensure that the test is carried out according to a fixed rhythm, which is convenient for continuous monitoring and evaluation of system performance; this method can collect data from different time periods more systematically, which helps to discover potential performance fluctuation patterns or problems, and provide a more comprehensive basis for optimization and adjustment.

[0120] Optionally, the test start instruction is automatically triggered after the target configuration file and the initial stress test script are successfully uploaded. This realizes the automation and intelligence of the process, reduces the steps of manual intervention and possible errors; it is automatically triggered after the target configuration file and the initial stress test script are successfully uploaded, which improves the efficiency and timeliness of the test, and there is no need to wait for manual operation to start the test; it ensures the accuracy and consistency of the test, and avoids incomplete or inaccurate tests caused by human negligence; it can quickly conduct continuous testing, which is conducive to timely discovery of problems and adjustment and optimization.

[0121] Specifically, the dispatch center responds to the test start instruction, and according to the task allocation result, the stress test strategy, the target configuration file and the initial stress test script, starts the JMeter-core engine of the node in the resource pool, performs interface stress test on the target cluster, obtains test log data, and sends the test log data to kafka17; monitors whether there is test log data in kafka17 through the parsing engine, and if so, parses the test log data to obtain the interface stress test result, and stores the interface stress test result in the database; the stress test platform 12 obtains the interface stress test result from the database for display, or sends the interface stress test result to the terminal for output. In the actual application process, the interface stress test result is output while the stress test is being performed.

[0122] The parsing engine is developed based on Java (object-oriented programming language).

[0123] Optionally, the target cluster is subjected to an interface stress test according to the task assignment result, the stress testing strategy, the target configuration file and the initial stress testing script. The target configuration file and the initial stress testing script may be sent to each target node in the target cluster through the scheduling center. The target node performs an interface stress test on the test interface corresponding to each target interface identifier corresponding to the target use case based on the corresponding task assignment result, stress testing strategy, target configuration file and initial stress testing script.

[0124] To facilitate understanding of S42 and S1031, an example is given below.

[0125] For example, based on the traffic distribution strategy in the stress testing strategy corresponding to the target use case, two target nodes are determined, namely the first target node: 192.168.242.173 and the second target node 192.168.242.174, wherein the task allocation result assigned to the first target node is that the task accounts for 40%, and the task allocation result assigned to the second target node accounts for 60%. Assuming that the test interface in the target use case includes a login verification login interface, when receiving the test start instruction, during the execution of the stress test, the login verification login interface needs to parameterize the real value (value) corresponding to the account name (name) through the target configuration file. When the stress test task is executed on the target node, that is, when the initial stress test script is executed, the value is automatically replaced with ${name} in the request body, and ${name} is automatically obtained. The actual values ​​of Zhang San, Li Si, and Wang Wu corresponding to the variable name name in the target configuration file need to be parameterized. Assume that the target configuration file contains 10,000 actual values ​​of name parameterization corresponding to name, that is, the total number of test tasks for stress testing the login verification interface is 10,000. At this time, based on the total number of test tasks, the task allocation result allocated to the first target node is 40%, that is, 4,000 tasks, and the task allocation result allocated to the second target node is 60%, that is, 6,000 tasks. Then, each target node executes the initial stress testing script, replaces the parameters of the initial stress testing script through the target configuration file, and performs interface stress testing on the test interface corresponding to each target interface identifier in the target use case based on the concurrent user number strategy, request frequency strategy, and stress testing duration strategy in the stress testing strategy.

[0126] This embodiment accurately determines each target node and the corresponding task allocation results from the resource pool according to the stress testing strategy corresponding to the target use case, and these target nodes then form the target cluster. By calling the scheduling center, after receiving the test start instruction, it can automatically carry out efficient and comprehensive interface stress testing on the test interface corresponding to each target interface identifier in the target use case in combination with the task allocation results, stress testing strategy, target configuration file and initial stress testing script, and finally obtain accurate and reliable interface stress testing results, thereby realizing the reasonable allocation and utilization of resources, improving the efficiency and accuracy of interface stress testing, and being able to timely and comprehensively reflect the performance of the test interface corresponding to each target interface identifier in the target use case in terms of interface stress.

[0127] In a possible implementation, the performing an interface stress test on the target cluster according to the task allocation result, the stress test strategy, the target configuration file, and the initial stress test script, and obtaining the interface stress test result also includes:

[0128] S10311: storing the target configuration file and the initial stress testing script as associated data in the target database;

[0129] It is understandable that the associated data in the target library can be associated through the target file identifier.

[0130] The performing an interface stress test on the target cluster according to the task allocation result, the stress test strategy, the target configuration file, and the initial stress test script, and obtaining the interface stress test result includes:

[0131] S10312: Call the JMeter-core engine in the target node, and replace the parameters of the initial stress testing script associated with the target configuration file in the target library according to the target configuration file to obtain the target script, and based on the target script and the task allocation result corresponding to the target node, perform interface stress testing on the test interfaces corresponding to each target interface identifier in the target use case to obtain test log data, and send the test log data to Kafka, wherein the interface stress test result is a test report generated based on each test log data in Kafka.

[0132] Specifically, create a Java program (that is, a parsing engine), connect to the Kafka cluster, and specify the Kafka topic (kafka17) to be monitored. Use Kafka's consumer API (interface) to subscribe to the topic and continuously monitor whether there is new data. When new test log data is detected, the test log data is extracted. Use the pre-defined parsing logic to process and analyze the test log data, and extract information related to the interface stress test through the parsing logic, such as the number of requests, response time and other key indicators, and combine this information in a preset format to obtain the interface stress test results. In the implementation process, it is necessary to configure the connection parameters of Kafka to ensure that the parsing engine can interact with Kafka correctly, and design appropriate parsing logic according to the actual test log data format and requirements. Through the parsing engine, the test log data in Kafka17 can be monitored in real time and efficiently. Once the test log data is found, it is quickly parsed to accurately obtain the interface stress test results, thereby greatly improving the efficiency and accuracy of data processing and analysis.

[0133] This embodiment stores the target configuration file and the initial stress test script as associated data in the target library, ensuring the uniformity and manageability of the data and facilitating subsequent calls and processing; the target script is obtained by calling the JMeter-core engine to perform parameter assignment and replacement, which improves the flexibility and pertinence of the test and allows customized testing according to specific needs; based on the target script and task allocation results, the target interface is stress tested and test log data is generated, achieving precise control and comprehensive recording of the test process; the test log data is sent to Kafka to generate a test report, achieving centralized processing and analysis of data.

[0134] In a possible implementation, the step of calling the scheduling center to perform an interface stress test on the target cluster corresponding to the target use case according to the target configuration file and the initial stress test script further includes:

[0135] S10321: Generate a target file identifier according to the use case name of the target use case and the generation time of the initial stress testing script;

[0136] Specifically, according to the file identifier generation rule of the stress testing script, a file identifier is generated according to the use case name of the target use case and the generation time of the initial stress testing script, and the generated file identifier is used as the target file identifier.

[0137] S10322: Using a preset division rule, the target configuration file is divided to obtain various configuration sub-files;

[0138] Specifically, the target configuration file is divided using a preset division rule, each group of divided data is stored separately as a file, and the stored file is used as a configuration sub-file.

[0139] S10323: According to each of the configuration sub-files, perform parameter assignment replacement on the initial stress testing script to obtain a target script, and determine the file identifier of the target script according to the target file identifier and the division order of the configuration sub-files;

[0140] Specifically, when generating the initial stress testing script, the file identifier of the initial stress testing script is preset first; according to the parameter value in each of the configuration sub-files, each parameter assignment position in the initial stress testing script is replaced with a parameter assignment, and each initial stress testing script that has completed the parameter assignment replacement is taken as a target script, and the target file identifier and the serial number of the division order of the configuration sub-file are spliced, and the spliced ​​data is used as the file identifier of the file where the target script is located.

[0141] S10324: storing the target file identifier and each target script as associated data in a target library;

[0142] S10325: Calling the scheduling center to perform an interface stress test on the target cluster corresponding to the target use case according to the target file identifier and the target library.

[0143] Specifically, the scheduling center is used to: filter nodes and assign tasks from the resource pool according to the preset screening strategy and each target script corresponding to the target file identifier in the target library, and obtain each target node and the task assignment result corresponding to each target node. It can be understood that each task assignment result can correspond to one or more tasks corresponding to the target script.

[0144] Call the JMeter-core engine in the target node, use the target scripts corresponding to the target node, perform interface stress testing on the interfaces corresponding to the task allocation results corresponding to the target node in the target cluster, obtain test log data, and send the test log data to kafka.

[0145] This embodiment realizes the division of the target configuration file and the generation of the target script before calling the scheduling center, reducing the consumption of computing resources by the JMeter-core engine; by dividing the target configuration file, a basis is provided for fast screening of nodes.

[0146] In a possible implementation, the target configuration file is in CSV format.

[0147] CSV format, CSV stands for Comma-Separated Values, is a comma-separated value format file, a plain text format file used to store data. CSV files consist of any number of records, separated by some kind of line break; each record consists of fields, and the separator between fields is other characters or strings.

[0148] It is understandable that the target configuration file may also be in other file formats, such as a txt file.

[0149] Txt format is a plain text file format. It is a universal text file format that can be used to store text data and information.

[0150] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0151] Corresponding to the interface pressure testing method described in the above embodiment, Figure 4A structural block diagram of an interface pressure testing device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.

[0152] Reference Figure 4 , the device comprises:

[0153] The data acquisition module 601 is used to acquire the target configuration file of the target use case and the corresponding target interface identifiers;

[0154] The script generation module 602 is used to generate an initial stress testing script for the target use case according to each of the target interface identifiers and a preset interface message library, wherein the preset interface message library stores interface messages, and the interface messages are generated based on the use case information corresponding to the historical interface function test;

[0155] The interface stress test result determination module 603 is used to call the scheduling center to perform an interface stress test on the target cluster corresponding to the target use case according to the target configuration file and the initial stress test script, and obtain the interface stress test result.

[0156] This embodiment can use the target configuration file and target interface identifier of the target use case in combination with the preset interface message library to quickly generate the initial stress test script, avoiding the tediousness of rewriting the script for the new scenario. At the same time, by calling the scheduling center to perform interface stress test on the target cluster according to the target configuration file and the initial stress test script, the operation process of cluster interface stress test is simplified, which not only greatly improves the test efficiency, but also ensures the accuracy and reliability of the test, and can timely and effectively discover the possible problems of the system in terms of interface stress, ensure the stability and quality of the system, and help to achieve efficient, convenient and accurate interface stress test. By using the interface message generated based on the historical use case information corresponding to the interface function test and storing it in the preset interface message library, the effective reuse of resources is realized. This reuse makes it possible to directly call the existing interface message in the preset interface message library when facing new interface stress test requirements, without repeatedly generating or collecting interface messages, which greatly improves the work efficiency and timeliness of the test. At the same time, the reuse of historical data also ensures the consistency and coherence of the test, and reduces the errors and uncertainties caused by data differences.

[0157] In a possible implementation, before the step of generating the initial stress testing script of the target use case according to each of the target interface identifiers and the preset interface message library, the step includes:

[0158] Acquire each test interface corresponding to the test case and the use case interface information of each test interface, wherein the test case includes the target use case, and the use case interface information is the use case information corresponding to the interface function test historically used for the test interface;

[0159] Assembling interface messages according to the use case interface information and the preset interface message assembly rules to obtain the interface message of each test interface;

[0160] The interface identifier of each test interface and the interface message are taken as associated data and stored in the preset interface message library.

[0161] In a possible implementation, the step of generating an initial stress testing script for the target use case according to each of the target interface identifiers and the preset interface message library includes:

[0162] Acquire the interface message corresponding to each of the target interface identifiers from the preset interface message library;

[0163] Using the interface messages corresponding to the target interface identifiers as messages to be processed;

[0164] The initial stress testing script of the target use case is generated according to the message to be processed and a preset script generation method.

[0165] In a possible implementation, the calling scheduling center performs an interface stress test on the target cluster corresponding to the target use case according to the target configuration file and the initial stress test script, and before obtaining the interface stress test result, the method further includes:

[0166] Obtain the stress testing strategy corresponding to the target use case;

[0167] Determine each target node and a task allocation result corresponding to the target node from a resource pool according to the stress testing strategy, wherein each target node forms the target cluster;

[0168] The calling scheduling center performs an interface stress test on the target cluster corresponding to the target use case according to the target configuration file and the initial stress test script, and obtains the interface stress test result, including:

[0169] The calling scheduling center is used to respond to the test start instruction, perform an interface stress test on the target cluster according to the task allocation result, the stress test strategy, the target configuration file and the initial stress test script, and obtain the interface stress test result.

[0170] In a possible implementation, the performing an interface stress test on the target cluster according to the task allocation result, the stress test strategy, the target configuration file, and the initial stress test script, and obtaining the interface stress test result also includes:

[0171] The target configuration file and the initial stress testing script are stored in the target database as associated data;

[0172] The performing an interface stress test on the target cluster according to the task allocation result, the stress test strategy, the target configuration file, and the initial stress test script, and obtaining the interface stress test result includes:

[0173] Call the JMeter-core engine in the target node, and according to the target configuration file, replace the parameters of the initial stress testing script associated with the target configuration file in the target library to obtain the target script, and based on the target script and the task allocation result corresponding to the target node, perform interface stress testing on the test interface corresponding to each target interface identifier in the target use case to obtain test log data, and send the test log data to kafka, wherein the interface stress test result is a test report generated based on each test log data in the kafka.

[0174] In a possible implementation, the step of calling the scheduling center to perform an interface stress test on the target cluster corresponding to the target use case according to the target configuration file and the initial stress test script further includes:

[0175] Generate a target file identifier according to the use case name of the target use case and the generation time of the initial stress testing script;

[0176] Using a preset division rule, the target configuration file is divided to obtain various configuration sub-files;

[0177] According to each of the configuration sub-files, the initial stress testing script is assigned and replaced with parameters to obtain a target script, and the file identifier of the target script is determined according to the target file identifier and the division order of the configuration sub-files; the target file identifier and each of the target scripts are stored as associated data in a target library;

[0178] The scheduling center is called to perform an interface stress test on the target cluster corresponding to the target use case according to the target file identifier and the target library.

[0179] In a possible implementation, the target configuration file is in CSV format.

[0180] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0181] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0182] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, it implements the functions or steps of the service side of an interface stress testing method.

[0183] An embodiment of the present application also provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps in any of the above-mentioned method embodiments can be implemented.

[0184] This embodiment can use the target configuration file and target interface identifier of the target use case in combination with the preset interface message library to quickly generate the initial stress test script, avoiding the tediousness of rewriting the script for the new scenario. At the same time, by calling the scheduling center to perform interface stress test on the target cluster according to the target configuration file and the initial stress test script, the operation process of cluster interface stress test is simplified, which not only greatly improves the test efficiency, but also ensures the accuracy and reliability of the test, and can timely and effectively discover the possible problems of the system in terms of interface stress, ensure the stability and quality of the system, and help to achieve efficient, convenient and accurate interface stress test. By using the interface message generated based on the historical use case information corresponding to the interface function test and storing it in the preset interface message library, the effective reuse of resources is realized. This reuse makes it possible to directly call the existing interface message in the preset interface message library when facing new interface stress test requirements, without repeatedly generating or collecting interface messages, which greatly improves the work efficiency and timeliness of the test. At the same time, the reuse of historical data also ensures the consistency and coherence of the test, and reduces the errors and uncertainties caused by data differences.

[0185] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0186] This embodiment can use the target configuration file and target interface identifier of the target use case in combination with the preset interface message library to quickly generate the initial stress test script, avoiding the tediousness of rewriting the script for the new scenario. At the same time, by calling the scheduling center to perform interface stress test on the target cluster according to the target configuration file and the initial stress test script, the operation process of cluster interface stress test is simplified, which not only greatly improves the test efficiency, but also ensures the accuracy and reliability of the test, and can timely and effectively discover the possible problems of the system in terms of interface stress, ensure the stability and quality of the system, and help to achieve efficient, convenient and accurate interface stress test. By using the interface message generated based on the historical use case information corresponding to the interface function test and storing it in the preset interface message library, the effective reuse of resources is realized. This reuse makes it possible to directly call the existing interface message in the preset interface message library when facing new interface stress test requirements, without repeatedly generating or collecting interface messages, which greatly improves the work efficiency and timeliness of the test. At the same time, the reuse of historical data also ensures the consistency and coherence of the test, and reduces the errors and uncertainties caused by data differences.

[0187] An embodiment of the present application provides a computer program product. When the computer program product runs on a terminal device, the terminal device can implement the steps in the above-mentioned method embodiments when executing the computer program product.

[0188] This embodiment can use the target configuration file and target interface identifier of the target use case in combination with the preset interface message library to quickly generate the initial stress test script, avoiding the tediousness of rewriting the script for the new scenario. At the same time, by calling the scheduling center to perform interface stress test on the target cluster according to the target configuration file and the initial stress test script, the operation process of cluster interface stress test is simplified, which not only greatly improves the test efficiency, but also ensures the accuracy and reliability of the test, and can timely and effectively discover the possible problems of the system in terms of interface stress, ensure the stability and quality of the system, and help to achieve efficient, convenient and accurate interface stress test. By using the interface message generated based on the historical use case information corresponding to the interface function test and storing it in the preset interface message library, the effective reuse of resources is realized. This reuse makes it possible to directly call the existing interface message in the preset interface message library when facing new interface stress test requirements, without repeatedly generating or collecting interface messages, which greatly improves the work efficiency and timeliness of the test. At the same time, the reuse of historical data also ensures the consistency and coherence of the test, and reduces the errors and uncertainties caused by data differences.

[0189] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0190] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0191] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0192] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0193] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0194] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. An interface pressure testing method, characterized in that: The method comprises: Get the target configuration file of the target use case and the corresponding target interface identifiers; Generate an initial stress testing script for the target use case according to each of the target interface identifiers and a preset interface message library, wherein the preset interface message library stores interface messages, and the interface messages are generated based on use case information corresponding to the historical interface function test; The scheduling center is called to perform an interface stress test on the target cluster corresponding to the target use case according to the target configuration file and the initial stress test script, and obtain the interface stress test result.

2. The interface pressure testing method according to claim 1, characterized in that: Before the step of generating the initial stress testing script of the target use case according to each of the target interface identifiers and the preset interface message library, the method includes: Acquire each test interface corresponding to the test case and the use case interface information of each test interface, wherein the test case includes the target use case, and the use case interface information is the use case information corresponding to the interface function test historically used for the test interface; Assembling interface messages according to the use case interface information and the preset interface message assembly rules to obtain the interface message of each test interface; The interface identifier of each test interface and the interface message are taken as associated data and stored in the preset interface message library.

3. The interface pressure testing method according to claim 1, characterized in that: The step of generating an initial stress testing script for the target use case according to each of the target interface identifiers and the preset interface message library comprises: Acquire the interface message corresponding to each of the target interface identifiers from the preset interface message library; Using the interface messages corresponding to the target interface identifiers as messages to be processed; The initial stress testing script of the target use case is generated according to the message to be processed and a preset script generation method.

4. The interface pressure testing method according to claim 1, characterized in that: The calling scheduling center, performing an interface stress test on the target cluster corresponding to the target use case according to the target configuration file and the initial stress test script, and obtaining the interface stress test result also includes: Obtain the stress testing strategy corresponding to the target use case; Determine each target node and a task allocation result corresponding to the target node from a resource pool according to the stress testing strategy, wherein each target node forms the target cluster; The calling scheduling center performs an interface stress test on the target cluster corresponding to the target use case according to the target configuration file and the initial stress test script, and obtains the interface stress test result, including: The calling scheduling center is used to respond to the test start instruction, perform an interface stress test on the target cluster according to the task allocation result, the stress test strategy, the target configuration file and the initial stress test script, and obtain the interface stress test result.

5. The interface pressure testing method according to claim 4, characterized in that: The method further includes performing an interface stress test on the target cluster according to the task allocation result, the stress test strategy, the target configuration file, and the initial stress test script, and obtaining the interface stress test result: The target configuration file and the initial stress testing script are stored in the target database as associated data; The performing an interface stress test on the target cluster according to the task allocation result, the stress test strategy, the target configuration file, and the initial stress test script, and obtaining the interface stress test result includes: Call the JMeter-core engine in the target node, and according to the target configuration file, replace the parameters of the initial stress testing script associated with the target configuration file in the target library to obtain the target script, and based on the target script and the task allocation result corresponding to the target node, perform interface stress testing on the test interface corresponding to each target interface identifier in the target use case to obtain test log data, and send the test log data to kafka, wherein the interface stress test result is a test report generated based on each test log data in the kafka.

6. The interface pressure testing method according to claim 1, characterized in that: The step of calling the scheduling center to perform an interface stress test on the target cluster corresponding to the target use case according to the target configuration file and the initial stress test script also includes: Generate a target file identifier according to the use case name of the target use case and the generation time of the initial stress testing script; Using a preset division rule, the target configuration file is divided to obtain various configuration sub-files; According to each of the configuration sub-files, the initial stress testing script is assigned and replaced with parameters to obtain a target script, and the file identifier of the target script is determined according to the target file identifier and the division order of the configuration sub-files; storing the target file identifier and each of the target scripts as associated data in a target library; The scheduling center is called to perform an interface stress test on the target cluster corresponding to the target use case according to the target file identifier and the target library.

7. The interface pressure testing method according to claim 4, characterized in that: The test start instruction may be triggered based on at least one of the following methods: Triggered based on test button click; Automatically triggered according to the timing method; Automatically trigger at preset time intervals; and It is automatically triggered after the target configuration file and the initial stress testing script are successfully uploaded.

8. An interface pressure testing device, characterized in that: The device comprises: A data acquisition module is used to obtain a target configuration file of a target use case and corresponding target interface identifiers; A script generation module, used to generate an initial stress testing script for the target use case according to each of the target interface identifiers and a preset interface message library, wherein the preset interface message library stores interface messages, and the interface messages are generated based on historical use case information corresponding to the interface function test; The interface stress test result determination module is used to call the scheduling center to perform an interface stress test on the target cluster corresponding to the target use case according to the target configuration file and the initial stress test script, and obtain the interface stress test result.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the interface pressure testing method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the interface pressure testing method according to any one of claims 1 to 7 is implemented.