Pressure testing method, device and system

By using browser automation operation tools to simulate user behavior in stress testing methods, the problem of inaccurate simulation of user behavior in the prior art is solved, the credibility of stress testing results is improved, and a full-process stress testing system is built.

CN120216320APending Publication Date: 2025-06-27BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311786670.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-22
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

The existing stress testing methods cannot accurately simulate user behavior, resulting in low confidence in stress testing results.

Method used

By receiving pressure measurement instructions containing pressure measurement plan information, the local browser start-up quantity and web page creation quantity are determined, and a test request for the test action sequence indication is issued to the pressure measurement target based on the browser automation operation tool, and the test response data is received and reported to obtain pressure measurement results.

Benefits of technology

By accurately simulating user access behavior, the credibility of pressure measurement results is improved, and the problem of cumbersome time-consuming and inability to achieve high fidelity in system performance testing is solved, and a full-process pressure measurement system is built.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120216320A_ABST
    Figure CN120216320A_ABST
Patent Text Reader

Abstract

The invention discloses a pressure testing method, device and system, and relates to the technical field of computers. A specific embodiment of the method comprises the following steps: receiving a pressure measurement instruction containing pressure measurement plan information; determining the number of started local browsers and the number of created webpages of each browser according to the pressure measurement plan information, starting the browsers according to the determined number of started browsers, and creating webpages in the browsers according to the determined number of created webpages; sending a test request indicated by the test action sequence to a pressure test target indicated by the pressure test plan information based on the started browser and the created webpage; and receiving a test response returned by the pressure test target, and reporting at least one of data carried by the test request and data carried by the test response to obtain a pressure test result for the pressure test target. According to the embodiment, the credibility of the pressure measurement result can be improved by accurately simulating the access behavior of the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software testing, and particularly to a stress testing method, device and system. Background Art

[0002] Stress testing (referred to as pressure testing for short) is a software testing method, usually used to test the performance and stability of an application or system under high load and high pressure. Currently, there are mainly two common stress testing schemes. The first method is to determine the interfaces called by the system, splice in the input parameters, and use an interface pressure testing tool to simulate user access by setting the number of concurrences, so as to achieve the purpose of pressure testing. The second method is to record the requests of users within a period of time, and through the way of playback, replay this part of traffic to the pressure testing target, so as to achieve the purpose of pressure testing. Neither of these two methods can accurately simulate user behavior, so the credibility of the pressure testing results is relatively low. Summary of the Invention

[0003] In view of this, embodiments of the present invention provide a stress testing method, device and system, which can improve the credibility of the pressure testing results by accurately simulating user access behavior.

[0004] To achieve the above object, according to one aspect of the present invention, a stress testing method is provided.

[0005] The stress testing method of the embodiments of the present invention includes: receiving a pressure testing instruction containing pressure testing plan information; determining the number of browsers to be launched locally and the number of web pages to be created for each browser according to the pressure testing plan information, launching browsers according to the determined number of browsers to be launched, and creating web pages in the browsers according to the determined number of web pages to be created; based on the launched browsers and the created web pages, sending a test request indicated by the test action sequence to the pressure testing target indicated by the pressure testing plan information; receiving a test response returned by the pressure testing target, and reporting at least one of the data carried by the test request and the data carried by the test response to obtain a pressure testing result for the pressure testing target.

[0006] Optionally, the pressure testing plan information includes: a pressure testing target address, the number of simulated users, and a test action sequence; and, the determining the number of browsers to be launched locally and the number of web pages to be created for each browser according to the pressure testing plan information includes: determining the number of browsers to be launched locally and the number of web pages to be created for each browser according to the number of simulated users.

[0007] Optionally, the sending a test request indicated by the test action sequence to the pressure testing target indicated by the pressure testing plan information includes: sending a test request indicated by the test action sequence to the pressure testing target pointed to by the pressure testing target address.

[0008] Optionally, the data carried by the test request includes: the request time of each test request, and the data carried by the test response includes: the response time, response status, and call interface identifier of each test response.

[0009] Optionally, reporting at least one of the data carried by the test request and the data carried by the test response includes: sending the data carried by the test request and the data carried by the test response to a pre-set message queue; and, after the reported data is consumed in the message queue, it is used to determine the response duration index value and availability rate index value of each interface as the stress test result.

[0010] Optionally, the stress test target includes a website or a web page, and the method is executed by an automated test cluster based on a browser automation operation tool.

[0011] To achieve the above object, according to another aspect of the present invention, a stress test device is provided.

[0012] The stress test device according to the embodiment of the present invention may include: an instruction receiving unit, configured to receive a stress test instruction containing stress test plan information; a simulation access unit, configured to determine the number of browsers to be launched locally and the number of web pages to be created for each browser according to the stress test plan information, launch browsers according to the determined number of browsers to be launched, and create web pages in the browsers according to the determined number of web pages to be created; a simulation execution unit, configured to send a test request indicated by the test action sequence to the stress test target based on the launched browsers and the created web pages; a reporting unit, configured to receive a test response returned by the stress test target and report at least one of the data carried by the test request and the data carried by the test response to obtain a stress test result for the stress test target.

[0013] To achieve the above object, according to still another aspect of the present invention, a stress test system is provided.

[0014] The pressure testing system according to an embodiment of the present invention may include: an instruction distribution platform, an automated testing cluster, and a monitoring platform; wherein, the instruction distribution platform sends a pressure testing instruction containing pressure testing plan information to the automated testing cluster; after receiving the pressure testing instruction, the automated testing cluster determines the number of browsers to be launched locally and the number of web pages to be created for each browser according to the pressure testing plan information, launches browsers according to the determined number of browsers to be launched, and creates web pages in the browsers according to the determined number of web pages to be created; based on the launched browsers and the created web pages, the automated testing cluster sends a test request indicated by the test action sequence to the pressure testing target indicated by the pressure testing plan information; the automated testing cluster receives the test response returned by the pressure testing target, and reports at least one of the data carried by the test request and the data carried by the test response to the monitoring platform to obtain the pressure testing result for the pressure testing target.

[0015] Optionally, the pressure testing plan information includes: a pressure testing target address, the number of simulated users, and a test action sequence; and, after receiving the pressure testing instruction, the automated testing cluster determines the number of browsers to be launched locally and the number of web pages to be created for each browser according to the number of simulated users; and sends a test request indicated by the test action sequence to the pressure testing target pointed to by the pressure testing target address.

[0016] Optionally, the data carried by the test request includes: the request time of each test request, and the data carried by the test response includes: the response time, response status, and called interface identifier of each test response; the pressure testing target is a website or a web page, and the automated testing cluster is established based on a browser automation operation tool.

[0017] Optionally, the monitoring platform further includes: a message queue, a big data processing platform, and a visualization platform; wherein, the automated testing cluster sends the data carried by the test request and the data carried by the test response to the message queue; after the big data processing platform obtains the data carried by the test request and the data carried by the test response from the message queue, it determines the response duration index value of each interface according to the request time and response time of each interface of the pressure testing target in the data, and determines the availability rate index value of each interface according to the response status of each interface of the pressure testing target in the reported data; the response duration index value and availability rate index value of each interface are used as the pressure testing result of the pressure testing target; the visualization platform performs visual output on the pressure testing result of the pressure testing target.

[0018] To achieve the above object, according to another aspect of the present invention, an electronic device is provided.

[0019] An electronic device according to the present invention includes: one or more processors; a storage device for storing one or more programs, which when executed by the one or more processors, cause the one or more processors to implement the stress testing method provided by the present invention.

[0020] To achieve the above object, according to another aspect of the present invention, there is provided a computer-readable storage medium.

[0021] A computer-readable storage medium of the present invention stores a computer program thereon, and when the program is executed by a processor, it implements the stress testing method provided by the present invention.

[0022] According to the technical solution of the present invention, the embodiments in the above invention have the following advantages or beneficial effects:

[0023] After receiving a stress testing instruction containing a stress testing target address, the number of simulated users, and a test action sequence, an automated testing cluster based on a browser automation operation tool (such as Playwright) determines the number of browsers to be launched locally and the number of web pages to be created for each browser according to the number of simulated users. Then, it launches browsers according to the determined number of browsers to be launched and creates web pages in the browsers according to the determined number of web pages to be created. After that, based on the launched browsers and the created web pages, the automated testing cluster sends test requests indicated by the test action sequence to the stress testing target pointed to by the stress testing target address, receives test responses returned by the stress testing target, and reports the data in the test requests and test responses to obtain stress testing results for the stress testing target. In this way, the credibility of the stress testing results is improved by accurately simulating user access behaviors, solving the problems of being cumbersome and time-consuming in the system performance testing process and the inability to achieve high-fidelity (i.e., accurately simulate user behaviors) of the stress testing results, and constructing a full-process stress testing system based on an instruction distribution platform, an automated testing cluster, and a monitoring platform.

[0024] The further effects of the above non-conventional optional methods will be described in conjunction with specific embodiments below. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The drawings are used to better understand the present invention and do not constitute an improper limitation to the present invention. Among them:

[0026] Figure 1 is a schematic diagram of the main steps of the stress testing method in an embodiment of the present invention;

[0027] Figure 2 is a schematic diagram of the execution architecture of the stress testing method in an embodiment of the present invention;

[0028] Figure 3 is a schematic diagram of the specific process of the stress testing method in an embodiment of the present invention;

[0029] Figure 4 It is a schematic diagram of the components of the pressure testing device in the embodiments of the present invention;

[0030] Figure 5 It is an exemplary system architecture diagram to which the embodiments of the present invention can be applied;

[0031] Figure 6 It is a schematic diagram of the structure of an electronic device for implementing the pressure testing method in the embodiments of the present invention. Detailed implementation manners

[0032] The following describes exemplary embodiments of the present invention with reference to the accompanying drawings. Various details of the embodiments of the present invention are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0033] It should be noted that, without conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.

[0034] Figure 1 It is a schematic diagram of the main steps of the pressure testing method according to the embodiments of the present invention. The pressure testing method can be executed by an automated testing cluster, and the above automated testing cluster can be established based on browser automation operation tools. The above browser automation operation tools can be Playwright, Selenium, etc., and preferably Playwright. The following takes Playwright as an example for illustration. Playwright is a powerful Python library that can automatically execute automated operations on various mainstream browsers with only one application programming interface (API), and supports running in headless mode and headed mode. The embodiments of the present invention use Playwright to imitate user access behaviors during the pressure testing process.

[0035] As Figure 1 shown, the pressure testing method of the embodiments of the present invention can be specifically executed according to the following steps:

[0036] Step S101: Receive a pressure testing instruction containing pressure testing plan information.

[0037] In this step, the automated testing cluster receives a stress testing instruction, which contains stress testing plan information reflecting data related to stress testing operations. Specifically, the stress testing plan information may include the stress testing target address, the number of simulated users, and the test action sequence. The above stress testing target can be a web page or a website. The above stress testing target address can be the network address URL of the stress testing target. The above test action sequence may include one or more actions such as opening a web page, refreshing a web page, clicking a button, and querying keywords. In practical applications, the above stress testing instruction may also contain commands such as starting stress testing and ending stress testing, as well as setting items such as adjusting the number of simulated users.

[0038] Step S102: Determine the number of browsers to be launched locally and the number of web pages to be created for each browser according to the stress testing plan information. Launch browsers according to the determined number of browsers to be launched, and create web pages in the browsers according to the determined number of web pages to be created.

[0039] In this step, the automated testing cluster can determine the browsers to be simulatedly opened and the web pages therein according to the number of simulated users in the stress testing plan information. Exemplarily, one web page can be regarded as one user. Then, if the number of simulated users is 100, 10 browsers can be launched, and each browser creates 10 web pages for the stress testing target; or 20 browsers can be launched, and each browser creates 5 web pages for the stress testing target.

[0040] Step S103: Based on the launched browsers and the created web pages, send test requests indicated by the test action sequence to the stress testing target indicated by the stress testing plan information.

[0041] In this step, operations can be performed in the web pages of the browsers to send test requests for the stress testing target. The relevant operations can be performed according to the test action sequence in the stress testing instruction, and the stress testing target can be determined by the stress testing target address in the stress testing plan information.

[0042] Step S104: Receive the test response returned by the stress testing target, and report at least one of the data carried by the test request and the data carried by the test response to obtain the stress testing result for the stress testing target.

[0043] In this step, the data carried by the test request may include: the request time of each test request, and the data carried by the test response may include: the response time of each test response, the response status (including successful response and failed response), and the call interface identifier. In practical applications, the automated test cluster may send the reported data in the test request and test response (i.e., the data carried by the test request and the data carried by the test response) to a preset message queue. After the reported data is consumed in the message queue, it can be used to determine the response duration metric values and availability metric values of each interface as the stress test results. It can be understood that in practical applications, the response durations of each interface may be aggregated first to obtain multiple response durations of each interface; thereafter, for the same interface, statistical values such as the average value, median value, 90th percentile, or 99th percentile of each response duration are determined as the response duration metric value of the interface. The availability metric value of each interface is obtained by dividing the number of successful responses of each interface by the total number of requests.

[0044] In the technical solution of the embodiment of the present invention, after receiving a stress test instruction containing the stress test target address, the number of simulated users, and the test action sequence, the automated test cluster based on a browser automation operation tool (such as Playwright) determines the number of browsers to be launched locally and the number of web pages to be created for each browser according to the number of simulated users, launches the browsers according to the determined number of browsers to be launched, and creates web pages in the browsers according to the determined number of web pages to be created. Thereafter, based on the launched browsers and the created web pages, the automated test cluster sends a test request indicated by the test action sequence to the stress test target pointed to by the stress test target address, receives the test response returned by the stress test target, and reports at least one of the data carried by the test request and the data carried by the test response to obtain the stress test results for the stress test target. In this way, the credibility of the stress test results is improved by accurately simulating the user access behavior, the problems of being cumbersome and time-consuming in the system performance test process and the inability to achieve high fidelity of the stress test results (i.e., accurately simulating user behavior) are solved, and a full-process stress test system based on an instruction distribution platform, an automated test cluster, and a monitoring platform is constructed.

[0045] The following describes a specific embodiment of the present invention. Refer to Figure 2 and Figure 3 。

[0046] There are the following several current system stress test solutions. First, sort out the interfaces called by the system, splice the input parameters, and use an interface stress test tool, such as Jmeter, to simulate user access by setting the number of concurrent users, so as to achieve the purpose of stress testing the interfaces. Second, record the requests of users within a period of time, and replay this part of the traffic to the service to be stress tested, so as to achieve the purpose of stress testing the system to be tested.

[0047] The method of manually splicing parameters for stress testing the interfaces called by the system is relatively primitive and cumbersome. It is necessary to understand the input parameter formats of each interface and estimate the proportion of traffic received by each interface in a complete scenario. In actual applications, it is impossible to diversify when splicing input parameters, and fields such as request headers and cookies are often under-transmitted or over-transmitted. If the input parameter contains a signature, it will be even more complex and requires a specific algorithm to generate the signature. At the same time, the stress testing ratio (i.e., the proportion of the process for performing stress testing) is not easy to estimate, and different ratios often produce different stress testing results, thus reducing the credibility of the stress testing results.

[0048] Recording and playback is a relatively popular stress testing method at present. This method simplifies the process of splicing parameters, but there are still problems. For example, the recorded requests contain login states and signatures, and such requests cannot be directly replayed. If processed during playback, it is easy to increase the stress testing difficulty. Moreover, a specific plugin needs to be installed on the production machine during recording, which may affect normal operations.

[0049] Currently, no mature stress testing solution has been found that can truly achieve high fidelity, and the objects of stress testing are all interfaces, making it impossible to accurately simulate user access. In view of the above disadvantages and deficiencies, the high-fidelity performance stress testing solution based on pages in this embodiment is proposed. The overall architecture is as follows. See Figure 2 .

[0050] The system includes 4 modules: an instruction distribution platform, a Playwright automated testing cluster, a stress testing target, and a monitoring platform.

[0051] Among them, the instruction distribution platform is a set of instruction distribution systems that can distribute stress testing instructions containing the URL of the stress testing target, the set of operation scenarios (including the test action sequences for each scenario), the number of simulated users, start stress testing, stop stress testing, increase concurrency, and decrease concurrency to the automated testing cluster, so as to control the local browser to operate on the stress testing target through the PlayWright engine. The Playwright automated testing cluster is a set of interface automation testing devices that will actually open the computer browser or use a headless browser to simulate user access to the stress testing system. In actual applications, the scenarios can be refined to determine the corresponding test action sequences. For example, for stress testing of a data dashboard, only the opening and refreshing of the data dashboard need to be simulated. If the dashboard has its own refresh function, only the page opening needs to be simulated. The monitoring platform includes a message queue, a big data processing platform, and a visualization platform. The content of each browser request will be listened and captured by the automated testing cluster and sent to the big data processing platform such as Clickhouse through a message queue such as Kafka. In actual applications, the big data processing platform can statistically analyze the information of the interface calls in real time to obtain the response duration index value and availability rate index value of each interface, and finally the visualization platform performs visualization output.

[0052] The execution process of this embodiment is as follows. Refer to Figure 3 . First, clarify the stress test target, record the stress test target URL, subdivide the stress test scenarios, evaluate the system access volume, and formulate a stress test plan. Next, use the instruction distribution platform to enter the stress test target address, scenario set, and simulated access volume, and send out the stress test instruction. The press (i.e., the server in the automated test cluster) that receives the stress test instruction will manipulate the local browser to execute the predetermined scenario and send requests. During the execution process, multiple browsers will be opened, and each browser will open multiple pages, and each page will execute the corresponding scenario, making full use of the resources of the press in this way. While the browser executes specific instructions, the automated test cluster intercepts page requests and responses, records parameters such as request time, response time, and response status, and sends each message to Kafka. The big data processing platform consumes messages from Kafka, processes the data, calculates the performance metrics and availability metrics of each interface, and visualizes and displays them through the visualization platform.

[0053] This embodiment leverages the capabilities of Playwright automated testing to pioneer a brand-new stress testing method based on page stress testing, fully simulating user behavior, automatically identifying and collecting the interfaces to be stress tested, which is significantly different from the traditional stress testing method that only stress tests interfaces, forming an important supplement to traditional stress testing, and having advantages such as high fidelity and easy implementation.

[0054] It should be noted that in the technical solution of the present invention, aspects such as the collection, collection, update, analysis, processing, use, transmission, and storage of user personal information that may be involved all comply with the provisions of relevant laws and regulations, are used for legal purposes, and do not violate public order and good customs. Necessary measures are taken for user personal information to prevent illegal access to user personal information data, and to safeguard the security of user personal information, network security, and national security.

[0055] For the foregoing method embodiments, for the sake of description, they are expressed as a series of action combinations. However, those skilled in the art should know that the present invention is not limited by the described action sequence. In fact, some steps can be carried out in other sequences or simultaneously. In addition, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential for implementing the present invention.

[0056] To facilitate better implementation of the above solutions of the embodiments of the present invention, the following also provides related devices for implementing the above solutions.

[0057] Please refer to Figure 4 As shown, the stress testing device 400 provided by the embodiment of the present invention may include: an instruction receiving unit 401, a simulated access unit 402, a simulated execution unit 403, and a reporting unit 404.

[0058] Among them, the instruction receiving unit 401 can be used to receive a stress test instruction containing stress test plan information; the simulated access unit 402 can be used to: determine the number of browsers to be launched locally and the number of web pages to be created for each browser according to the stress test plan information, launch browsers according to the determined number of browsers to be launched, and create web pages in the browsers according to the determined number of web pages to be created; the simulated execution unit 403 can be used to: based on the launched browsers and the created web pages, send a test request indicated by the test action sequence to the stress test target indicated by the stress test plan information; the reporting unit 404 can be used to receive a test response returned by the stress test target, and report at least one of the data carried by the test request and the data carried by the test response to obtain a stress test result for the stress test target.

[0059] In an embodiment of the present invention, the stress test plan information includes: a stress test target address, the number of simulated users, and a test action sequence; and, the simulated access unit 402 can be further used to: determine the number of browsers to be launched locally and the number of web pages to be created for each browser according to the number of simulated users.

[0060] In a specific application, the simulated execution unit 403 can be further used to: send a test request indicated by the test action sequence to the stress test target pointed to by the stress test target address.

[0061] In an actual application, the data carried by the test request includes: the request time of each test request, and the data carried by the test response includes: the response time, response status, and call interface identifier of each test response.

[0062] Preferably, the reporting unit 404 can be further used to: send the data carried by the test request and the data carried by the test response to a preset message queue; and, after the reported data is consumed in the message queue, it is used to determine the response duration index value and availability rate index value of each interface as the stress test result.

[0063] In addition, in an embodiment of the present invention, the stress test target includes a website or a web page, and the method is executed by an automated test cluster based on a browser automation operation tool.

[0064] In the technical solution of the embodiment of the present invention, after the automated test cluster based on browser automation operation tools such as Playwright receives a stress test instruction containing a stress test target address, the number of simulated users, and a test action sequence, it determines the number of browsers to be launched locally and the number of web pages to be created for each browser according to the number of simulated users, launches the browsers according to the determined number of browsers to be launched, and creates web pages in the browsers according to the determined number of web pages to be created. Thereafter, based on the launched browsers and the created web pages, the automated test cluster sends a test request indicated by the test action sequence to the stress test target pointed to by the stress test target address, receives a test response returned by the stress test target, and reports the data in the test request and the test response to obtain a stress test result for the stress test target. In this way, the credibility of the stress test result is improved by accurately simulating user access behaviors, the problems of being cumbersome and time-consuming in the system performance test process and the inability to achieve high-fidelity (i.e., accurately simulate user behaviors) of the stress test result are solved, and a full-process stress test system based on an instruction distribution platform, an automated test cluster, and a monitoring platform is constructed.

[0065] An embodiment of the present invention provides a stress test system. Refer to Figure 2 . The stress test system includes: an instruction distribution platform, an automated test cluster, and a monitoring platform; wherein, the instruction distribution platform sends a stress test instruction containing stress test plan information to the automated test cluster; after receiving the stress test instruction, the automated test cluster determines the number of browsers to be launched locally and the number of web pages to be created for each browser according to the stress test plan information, launches the browsers according to the determined number of browsers to be launched, and creates web pages in the browsers according to the determined number of web pages to be created; the automated test cluster sends a test request indicated by the test action sequence to the stress test target indicated by the stress test plan information based on the launched browsers and the created web pages; the automated test cluster receives a test response returned by the stress test target, and reports at least one of the data carried by the test request and the data carried by the test response to the monitoring platform to obtain a stress test result for the stress test target.

[0066] As a preferred solution, the stress test plan information includes: a stress test target address, the number of simulated users, and a test action sequence; and, after receiving the stress test instruction, the automated test cluster determines the number of browsers to be launched locally and the number of web pages to be created for each browser according to the number of simulated users; and sends a test request indicated by the test action sequence to the stress test target pointed to by the stress test target address.

[0067] In one embodiment, the data carried by the test request includes: the request time of each test request, and the data carried by the test response includes: the response time, response status, and called interface identifier of each test response; the stress testing target is a website or a web page, and the automated testing cluster is established based on a browser automation operation tool.

[0068] In addition, in the embodiment of the present invention, the monitoring platform may further include: a message queue (such as Kafka), a big data processing platform (such as Clickhouse), and a visualization platform; wherein, the automated testing cluster sends the reported data in the test request and the test response to the message queue; after the big data processing platform obtains the reported data from the message queue, it determines the response duration index value of each interface according to the request time and response time of each interface of the stress testing target in the reported data, and determines the availability rate index value of each interface according to the response status of each interface of the stress testing target in the reported data; the response duration index value and availability rate index value of each interface are used as the stress testing result of the stress testing target; the visualization platform performs visual output on the stress testing result of the stress testing target.

[0069] According to the technical solution of the embodiment of the present invention, after the automated testing cluster based on a browser automation operation tool (such as Playwright) receives a stress testing instruction containing the stress testing target address, the number of simulated users, and the test action sequence, it determines the number of browsers to be launched locally and the number of web pages to be created for each browser according to the number of simulated users, launches the browsers according to the determined number of browsers to be launched, and creates web pages in the browsers according to the determined number of web pages to be created. Thereafter, the automated testing cluster sends test requests indicated by the test action sequence to the stress testing target pointed to by the stress testing target address based on the launched browsers and the created web pages, receives the test responses returned by the stress testing target, and reports the data in the test requests and test responses to obtain the stress testing result for the stress testing target. In this way, the credibility of the stress testing result is improved by accurately simulating the user access behavior, the problems of being cumbersome and time-consuming in the system performance testing process and the inability to achieve high fidelity (i.e., accurately simulate user behavior) of the stress testing result are solved, and a full-process stress testing system based on an instruction distribution platform, an automated testing cluster, and a monitoring platform is constructed.

[0070] Figure 5 FIG. 500 shows an exemplary system architecture to which the stress testing method or stress testing device according to the embodiment of the present invention can be applied.

[0071] As Figure 5As shown, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505 (this architecture is merely an example, and the components included in the specific architecture can be adjusted according to the specific situation of the application). The network 504 is used to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0072] Users can use the terminal devices 501, 502, 503 to interact with the server 505 through the network 504 to receive or send messages, etc. Various client applications, such as a stress test application (only an example), may be installed on the terminal devices 501, 502, 503.

[0073] The terminal devices 501, 502, 503 may be various electronic devices with a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop computers, and desktop computers, etc.

[0074] The server 505 may be a server that provides various services, such as a background server that supports the stress test application operated by the user using the terminal devices 501, 502, 503 (only an example). The background server can process the received test requests and feedback the processing results (such as test results - only an example) to the terminal devices 501, 502, 503.

[0075] It should be noted that the stress test method provided by the embodiments of the present invention is generally executed by the server 505. Correspondingly, the stress test device is generally arranged in the server 505.

[0076] It should be understood that Figure 5 the numbers of the terminal devices, the network, and the server in

[0077] The present invention also provides an electronic device. The electronic device according to the embodiments of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the stress test method provided by the present invention.

[0078] Next, refer to Figure 6 , which shows a schematic structural diagram of a computer system 600 of an electronic device suitable for implementing the embodiments of the present invention. Figure 6 The shown electronic device is merely an example and should not impose any limitation on the functions and usage scope of the embodiments of the present invention.

[0079] AsFigure 6 As shown in Figure 6 , computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 602 or programs loaded from a storage section 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the computer system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0080] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed so that a computer program read therefrom is installed into the storage section 608 as needed.

[0081] Specifically, according to the embodiments disclosed in the present invention, the process described in the above main step diagram can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program codes for performing the method shown in the main step diagram. In the above embodiment, the computer program can be downloaded and installed from a network via the communication section 609, and installed from the removable medium 611. When the computer program is executed by the central processing unit 601, the above functions defined in the system of the present invention are executed.

[0082] It should be noted that the computer-readable medium shown in the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device. In the present invention, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, in which computer-readable program code is carried. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0083] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, as well as the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0084] The units involved in the embodiments of the present invention can be implemented in software or in hardware. The described units can also be provided in a processor. For example, it can be described as: a processor includes an instruction receiving unit, an analog access unit, an analog execution unit, and a reporting unit. Among them, the names of these units do not constitute a limitation to the unit itself in some cases. For example, the instruction receiving unit can also be described as "the unit that provides the data in the stress test instruction to the analog access unit".

[0085] As another aspect, the present invention also provides a computer-readable medium, which can be included in the device described in the above embodiments; or it can exist alone without being assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by the device, the steps executed by the device include: receiving a stress test instruction containing stress test plan information; determining the number of browsers to be launched locally and the number of web pages to be created for each browser according to the stress test plan information, launching browsers according to the determined number of browsers to be launched, and creating web pages in the browsers according to the determined number of web pages to be created; based on the launched browsers and the created web pages, sending a test request indicated by the test action sequence to the stress test target indicated by the stress test plan information; receiving a test response returned by the stress test target, and reporting at least one of the data carried by the test request and the data carried by the test response to obtain a stress test result for the stress test target.

[0086] In the technical solution of the embodiments of the present invention, after an automated test cluster based on a browser automation operation tool (such as Playwright) receives a stress test instruction containing a stress test target address, the number of simulated users, and a test action sequence, it determines the number of browsers to be launched locally and the number of web pages to be created for each browser according to the number of simulated users, launches browsers according to the determined number of browsers to be launched, and creates web pages in the browsers according to the determined number of web pages to be created. Thereafter, the automated test cluster sends a test request indicated by the test action sequence to the stress test target pointed to by the stress test target address based on the launched browsers and the created web pages, and receives a test response returned by the stress test target, and reports the data in the test request and the test response to obtain a stress test result for the stress test target. In this way, the credibility of the stress test result is improved by accurately simulating user access behaviors, the problems of cumbersome and time-consuming in the system performance test process and the inability to achieve high fidelity (i.e., accurately simulate user behaviors) of the stress test result are solved, and a full-process stress test system based on an instruction distribution platform, an automated test cluster, and a monitoring platform is constructed.

[0087] The above specific embodiments do not constitute a limitation to the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub - combinations and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A pressure testing method, characterized in that, It includes: Receiving a stress test instruction containing stress test plan information; Determining the number of browsers to be launched locally and the number of web pages to be created for each browser according to the stress test plan information, launching browsers based on the determined number of browsers to be launched, and creating web pages in the browsers according to the determined number of web pages to be created; Based on the launched browsers and the created web pages, sending a test request indicated by the test action sequence to the stress test target indicated by the stress test plan information; Receiving a test response returned by the stress test target, and reporting at least one of the data carried by the test request and the data carried by the test response to obtain a stress test result for the stress test target.

2. The method according to claim 1, wherein The stress test plan information includes: a stress test target address, the number of simulated users, and a test action sequence; and, the determining the number of browsers to be launched locally and the number of web pages to be created for each browser according to the stress test plan information includes: Determining the number of browsers to be launched locally and the number of web pages to be created for each browser according to the number of simulated users.

3. The method according to claim 2, wherein The sending a test request indicated by the test action sequence to the stress test target indicated by the stress test plan information includes: Sending a test request indicated by the test action sequence to the stress test target pointed to by the stress test target address.

4. The method according to claim 1, wherein The data carried by the test request includes: the request time of each test request, and the data carried by the test response includes: the response time, response status, and call interface identifier of each test response.

5. The method according to claim 4, wherein The reporting at least one of the data carried by the test request and the data carried by the test response includes: Sending the data carried by the test request and the data carried by the test response to a pre-set message queue; and, after the reported data is consumed in the message queue, it is used to determine the response duration index value and availability rate index value of each interface as the stress test result.

6. The method according to claim 1, characterized in that The stress test target includes a website or a web page, and the method is executed by an automated test cluster based on a browser automation operation tool.

7. A pressure testing device, characterized in that, It includes: An instruction receiving unit, configured to receive a stress test instruction containing stress test plan information; A simulation access unit, configured to determine the number of browsers to be launched locally and the number of web pages to be created for each browser according to the stress test plan information, launch browsers based on the determined number of browsers to be launched, and create web pages in the browsers according to the determined number of web pages to be created; A simulation execution unit, configured to send a test request indicated by the test action sequence to the stress test target indicated by the stress test plan information based on the launched browsers and the created web pages; A reporting unit, configured to receive a test response returned by the stress test target, and report at least one of the data carried by the test request and the data carried by the test response to obtain a stress test result for the stress test target.

8. A pressure test system, characterized in that, It includes: An instruction distribution platform, an automated test cluster, and a monitoring platform; wherein, The instruction distribution platform sends a stress test instruction containing stress test plan information to the automated test cluster; After receiving the stress test instruction, the automated test cluster determines the number of browsers to be launched locally and the number of web pages to be created by each browser according to the stress test plan information, launches browsers according to the determined number of browsers to be launched, and creates web pages in the browsers according to the determined number of web pages to be created; Based on the launched browsers and the created web pages, the automated test cluster sends a test request indicated by the test action sequence to the stress test target indicated by the stress test plan information; The automated test cluster receives the test response returned by the stress test target, and reports at least one of the data carried by the test request and the data carried by the test response to the monitoring platform to obtain the stress test result for the stress test target.

9. The system according to claim 8, characterized in that, The stress test plan information includes: a stress test target address, the number of simulated users, and a test action sequence; and, After receiving the stress test instruction, the automated test cluster determines the number of browsers to be launched locally and the number of web pages to be created by each browser according to the number of simulated users; and sends a test request indicated by the test action sequence to the stress test target pointed to by the stress test target address.

10. The system according to claim 8, wherein The data carried by the test request includes: the request time of each test request, and the data carried by the test response includes: the response time, response status, and called interface identifier of each test response; The stress test target is a website or a web page, and the automated test cluster is established based on a browser automation operation tool.

11. The system according to claim 10, wherein The monitoring platform further includes: a message queue, a big data processing platform, and a visualization platform; wherein, The automated test cluster sends the data carried by the test request and the data carried by the test response to the message queue; After the big data processing platform obtains the data carried by the test request and the data carried by the test response from the message queue, it determines the response duration index value of each interface according to the request time and response time of each interface of the stress test target in the data, and determines the availability rate index value of each interface according to the response status of each interface of the stress test target in the reported data; the response duration index value and availability rate index value of each interface are used as the stress test result of the stress test target; The visualization platform performs visual output on the stress test result of the stress test target.

12. An electronic device, characterized in that, Including: One or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-6.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method according to any one of claims 1-6.