Pressure testing methods, systems, devices, computer devices, and storage media
Patent Information
- Application Number
- CN202110365192.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-06
- Publication Date
- 2026-08-18
- Estimated Expiration
- 2041-04-06
AI Technical Summary
然而,压测资源申请不便且部署过程耗时多,降低了压测资源使用效率
[0047] The aforementioned stress testing method, system, apparatus, computer equipment, and storage medium, in response to a stress testing request for a test object, determine the stress testing parameters corresponding to the stress testing request, obtain the test instructions corresponding to the stress testing parameters based on the test script file stored in the test platform, retrieve the target execution device from multiple pre-set stress testing execution devices on the test platform, and send test instructions to the target execution device, instructing the target execution device to perform stress testing on the test object based on the test instructions. This achieves automatic application and deployment of stress testing execution devices, effectively improving the allocation and utilization efficiency of stress testing resources.
Smart Images

Figure CN115168116B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of stress testing technology, and in particular to a stress testing method, system, apparatus, computer equipment, and storage medium. Background Technology
[0002] With the development of computer technology, the number of users of application services is increasing daily. To ensure the performance and availability of services, stress tests can be performed on application services to determine the load they can withstand.
[0003] In existing technologies, users need to apply for load testing resources and deploy them before conducting load tests. However, applying for load testing resources is inconvenient and the deployment process is time-consuming, reducing the efficiency of load testing resource utilization. Summary of the Invention
[0004] Therefore, it is necessary to provide a stress testing method, system, apparatus, computer equipment, and storage medium to address the aforementioned technical problems.
[0005] A stress testing method, the method comprising:
[0006] In response to a stress test request for a test object, determine the stress test parameters corresponding to the stress test request;
[0007] Based on the test script files stored in the stress testing platform, obtain the test instructions corresponding to the stress testing parameters;
[0008] The target execution device is selected from multiple pre-set stress test execution devices of the stress test platform, and the test command is sent to the target execution device to instruct the target execution device to perform stress test on the test object based on the test command.
[0009] In one embodiment, retrieving the target execution device from a set of pre-set stress test execution devices on the stress test platform includes:
[0010] The test command is sent to the preset scheduling device of the stress test platform, and the scheduling device retrieves the target execution device from the multiple stress test execution devices according to the preset device scheduling rules.
[0011] In one embodiment, sending the test command to a preset scheduling device of the stress testing platform includes:
[0012] Obtain the scheduling order of each of the preset scheduling devices in the stress testing platform;
[0013] Based on the scheduling order of each scheduling device, the target scheduling device to be scheduled is determined from the multiple scheduling devices, and the test command is sent to the target scheduling device.
[0014] In one embodiment, the step of retrieving the target execution device from the plurality of stress test execution devices according to a preset device scheduling rule by the scheduling device includes:
[0015] The target scheduling device is used to obtain the execution order of each of the preset stress test execution devices in the stress test platform;
[0016] The target scheduling device selects the target execution device from multiple stress test execution devices according to the execution order corresponding to each stress test execution device.
[0017] In one embodiment, it further includes:
[0018] The scheduling device receives the test file returned by the target execution device; the test file includes a process file recording the stress test process and / or a test result report corresponding to the stress test;
[0019] The test files are stored in the storage volume of the stress testing platform;
[0020] When a user requests access to the test results of the stress test, the test file is retrieved from the storage volume and displayed on the stress test platform.
[0021] In one embodiment, displaying the test file in the stress testing platform includes:
[0022] Obtain the file size corresponding to the test file;
[0023] When the file size of the test file exceeds a preset threshold, a preset plugin is used to parse the test file to obtain the parsed test file.
[0024] The parsed test file is displayed on the front-end page of the stress testing platform.
[0025] In one embodiment, obtaining the test instructions corresponding to the stress test parameters based on the test script file stored in the stress test platform includes:
[0026] From multiple test script files stored on the stress testing platform, identify the target script file that matches the stress testing parameters;
[0027] Script instructions are generated based on the target script file and used as test instructions.
[0028] In one embodiment, the stress test parameters include a target scenario type and a target concurrency parameter. The step of determining the test script file matching the stress test parameters from multiple test script files stored on the stress test platform includes:
[0029] Obtain the scene type corresponding to each of the multiple preset test script files, and determine the test script file whose corresponding scene type matches the target scene type as the target script file;
[0030] The step of generating script instructions based on the target script file as test instructions includes:
[0031] Based on the target concurrency parameters, update the thread group parameters in the target script file to obtain the updated script file;
[0032] Script instructions are generated based on the updated script file and used as test instructions.
[0033] In one embodiment, it further includes:
[0034] Upon receiving a monitoring request for the stress testing process of the test object, determine whether the test object is configured with a platform monitoring module;
[0035] When the test object is configured with the platform monitoring module, the network address corresponding to the test object is obtained through the platform monitoring module;
[0036] Redirecting to the page corresponding to the network address, and displaying the page on the monitoring interface of the stress testing platform.
[0037] A stress testing platform includes a main platform application, storage volumes, scheduling devices, and multiple stress test execution devices;
[0038] The main application of the platform is used to respond to stress test requests for the test object, determine the stress test parameters corresponding to the stress test request, obtain the test instructions corresponding to the stress test parameters based on the test script files stored in the stress test platform, and send the test instructions to the scheduling device.
[0039] The scheduling device is used to select a target execution device from multiple stress test execution devices and send the test command to the target execution device;
[0040] The stress test execution device is used to perform stress tests on the test object based on the test instructions when a test instruction is received.
[0041] A pressure testing device, the device comprising:
[0042] The stress test parameter acquisition module is used to determine the stress test parameters corresponding to the stress test request in response to a stress test request for a test object.
[0043] The test instruction acquisition module is used to acquire the test instructions corresponding to the stress test parameters based on the test script files stored in the stress test platform.
[0044] The execution device determination module is used to retrieve the target execution device from a set of multiple pre-set stress test execution devices of the stress test platform, and send the test command to the target execution device to instruct the target execution device to perform stress test on the test object based on the test command.
[0045] A computer device includes a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps of the method as described in any of the preceding claims.
[0046] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method as described in any of the preceding claims.
[0047] The aforementioned stress testing method, system, apparatus, computer equipment, and storage medium, in response to a stress testing request for a test object, determine the stress testing parameters corresponding to the stress testing request, obtain the test instructions corresponding to the stress testing parameters based on the test script file stored in the test platform, retrieve the target execution device from multiple pre-set stress testing execution devices on the test platform, and send test instructions to the target execution device, instructing the target execution device to perform stress testing on the test object based on the test instructions. This achieves automatic application and deployment of stress testing execution devices, effectively improving the allocation and utilization efficiency of stress testing resources. Attached Figure Description
[0048] Figure 1 This is a diagram illustrating the application environment of a stress testing method in one embodiment.
[0049] Figure 2 This is a flowchart illustrating a stress testing method in one embodiment;
[0050] Figure 3 This is a structural block diagram of a pressure testing system in one embodiment;
[0051] Figure 4 This is a data processing diagram of a stress testing system in one embodiment;
[0052] Figure 5 This is a structural block diagram of a pressure testing device in one embodiment;
[0053] Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0054] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0055] This application provides a stress testing method that can be applied to, for example... Figure 1 In the application environment shown, the main application 102 of the stress testing platform can communicate with the stress testing execution device 104, which can be configured with stress testing tools. The main application 102 of the stress testing platform can send test commands to the stress testing execution device 104, and the stress testing execution device 104 performs stress tests on the test object through its configured stress testing tools. The main application 102 can be implemented using a standalone server, a server cluster consisting of multiple servers, or a system composed of terminals and servers.
[0056] In one embodiment, such as Figure 2 As shown, a stress testing method is provided, which is applied to... Figure 1 Taking the main application 102 of the platform as an example, the explanation includes the following steps:
[0057] Step 201: In response to a stress test request for the test object, determine the stress test parameters corresponding to the stress test request.
[0058] As an example, the test object can be the object to be stress tested, such as a software application, service program, static file, script, Java object, database, server, etc. The stress test parameters can be parameters used to control the stress test method.
[0059] In practical applications, load testing users can generate load testing requests for the test object and send them to the platform's main application. Upon receiving the load testing request, the platform's main application responds by obtaining the corresponding load testing parameters.
[0060] Step 202: Based on the test script file stored in the stress testing platform, obtain the test instructions corresponding to the stress test parameters.
[0061] In practice, upon receiving a stress test request, a pre-stored test script file can be retrieved from the stress test platform, and test instructions corresponding to the stress test parameters can be obtained based on the test script file.
[0062] Step 203: Select the target execution device from the multiple pre-set stress test execution devices of the stress test platform, and send the test command to the target execution device to instruct the target execution device to perform stress test on the test object based on the test command.
[0063] As an example, a stress test execution device, also known as a stress tester, is a virtual device used to perform stress tests on a test object. This virtual device can integrate Java-based stress testing tools, such as JMeter.
[0064] Specifically, when simulating a large number of concurrent requests and placing a significant load on the test object, multiple stress test execution devices can be pre-configured in the stress testing platform to avoid insufficient execution devices. Upon receiving a stress test request, the target execution device for initiating the stress test on the test object can be selected from the multiple execution devices, and test instructions can be sent to the target execution device. After receiving the test instructions, the target execution device can perform the stress test on the test object according to the instructions.
[0065] In this embodiment, by responding to a stress test request for a test object, the stress test parameters corresponding to the stress test request are determined. Based on the test script file stored in the test platform, the test instructions corresponding to the stress test parameters are obtained. The target execution device is retrieved from multiple stress test execution devices preset in the test platform, and the test instructions are sent to the target execution device, instructing the target execution device to perform stress testing on the test object based on the test instructions. This realizes the automatic application and deployment of stress test execution devices, effectively improving the allocation and utilization efficiency of stress test resources.
[0066] In one embodiment, retrieving the target execution device from a set of pre-set stress test execution devices in the stress test platform may include the following steps:
[0067] The test command is sent to the preset scheduling device of the stress test platform, and the scheduling device retrieves the target execution device from the multiple stress test execution devices according to the preset device scheduling rules.
[0068] As an example, a scheduling device can be used to request and retrieve a target execution device.
[0069] In practical implementation, the stress testing platform can be pre-configured with scheduling devices and device scheduling rules. Upon receiving a test command, the test command can be sent to the scheduling device, which will then apply for and retrieve the stress test execution device according to the preset device scheduling rules, selecting the target execution device from multiple stress test execution devices.
[0070] In this embodiment, the target execution device can be selected from multiple stress test execution devices by the scheduling device, avoiding the need for the user to apply for stress test resources. Furthermore, by having the scheduling device apply for stress test resources based on device scheduling rules, the stress test resources can be reasonably allocated, avoiding waste of stress test resources.
[0071] In one embodiment, sending the test command to the pre-set scheduling device of the stress testing platform may include the following steps:
[0072] Obtain the scheduling order of each of the preset scheduling devices in the stress testing platform; determine the target scheduling device to be scheduled from the multiple scheduling devices according to the scheduling order of each scheduling device, and send the test command to the target scheduling device.
[0073] In practical implementation, the stress testing platform can be pre-configured with multiple scheduling devices, which together form a scheduling device resource pool (also known as a scheduling machine resource pool) within the stress testing platform. Upon receiving a stress test request, the platform can obtain the scheduling order of each of the multiple scheduling devices, and based on that order, sequentially select the target scheduling device to be scheduled, and then send the test command to the target scheduling machine.
[0074] In this embodiment, a target scheduling device can be selected from the scheduling device resource pool according to the scheduling order of each scheduling device, so as to realize the reasonable allocation of scheduling device resources and effectively improve the configuration efficiency of stress testing resources.
[0075] In one embodiment, the step of retrieving the target execution device from the plurality of stress test execution devices according to preset device scheduling rules by the scheduling device includes:
[0076] The target scheduling device obtains the execution order of each of the preset stress test execution devices in the stress test platform; the target scheduling device then selects the target execution device from the multiple stress test execution devices according to the execution order of each stress test execution device.
[0077] Specifically, the multiple pre-set stress test execution devices in the stress testing platform can collectively form an execution device resource pool (also known as an execution machine resource pool) within the stress testing platform. Once the target scheduling device is determined, the execution order of each of the multiple stress test execution devices in the stress testing platform can be obtained through the target scheduling device. Then, based on the scheduling order of each stress test execution device, the target execution device can be sequentially selected from among the multiple stress test execution devices.
[0078] In this embodiment, the target scheduling device can be selected from the scheduling device resource pool according to the scheduling order of each stress test execution device, which can both prevent stress test resource shortage and achieve reasonable allocation of stress test resources.
[0079] In one embodiment, after the stress test is completed, the target execution device and the target scheduling device can be reclaimed. Specifically, the platform's main application can reclaim the usage rights of the target execution device and the target scheduling device. When a stress test is required again in the future, the target execution device and the target scheduling device can be re-determined, so as to realize the use and timely reclamation of stress test resources, improve the configuration efficiency of stress test resources, and realize the rational utilization of stress test resources.
[0080] In one embodiment, the method may further include the following steps:
[0081] The scheduling device receives the test file returned by the target execution device; the test file includes a process file recording the stress test process and / or a test result report corresponding to the stress test; the test file is stored in the storage volume of the stress test platform; when a user requests access to the test results of the stress test is received, the test file is retrieved from the storage volume and displayed in the stress test platform.
[0082] Specifically, during stress testing of the test object, the target execution device can receive the stress test response information corresponding to the test object and obtain the process file recording the corresponding test process. When the stress test ends, the target execution device can also obtain the test result report corresponding to the stress test. Furthermore, the target execution device can obtain the test file based on the process file or the test result report and send the test file back to the scheduling device.
[0083] The stress testing platform can be configured with scalable storage volumes, which can exchange data with the platform's main application's front-end, back-end, and scheduling devices. After receiving test files from the target execution device, the scheduling device can store the test files in the storage volume.
[0084] In practice, users can obtain the test files corresponding to the stress test through the front end of the stress testing platform. Specifically, users can perform user operations related to viewing the test files in the front-end interface. In response to user operations, the main platform application can receive the user's request to access the test results of the stress test, and then retrieve the data through the back end of the main platform application, obtain the test files from the storage volume, and display the test files in the stress testing platform.
[0085] In this embodiment, when a user requests access to the test results of a stress test, the test file can be retrieved from the storage volume and displayed on the stress test platform. This achieves automatic generation of the test file, eliminating the need for the user to organize and save it, thus improving file organization efficiency.
[0086] In one embodiment, displaying the test file in the stress testing platform includes:
[0087] Obtain the file size corresponding to the test file; when the file size corresponding to the test file exceeds a preset threshold, use a preset plugin to parse the test file to obtain the parsed test file; display the parsed test file on the front-end page of the stress testing platform.
[0088] In practical applications, after retrieving the test file corresponding to the test result access request from the storage volume, the file size of the test file can be obtained, and it can be determined whether the file size exceeds a preset threshold. If the file size exceeds the preset threshold, a preset plugin can be used to parse the test file, and the parsed test file can be displayed on the front-end page of the stress testing platform. If the file size does not exceed the preset threshold, it can be directly displayed on the stress testing platform.
[0089] In this embodiment, when the file size corresponding to the test file exceeds a preset threshold, a preset plugin is used to parse the test file, which can achieve fast parsing, reduce resource consumption, and quickly obtain the test file corresponding to the stress test.
[0090] In one embodiment, obtaining the test instructions corresponding to the stress test parameters based on the test script files stored in the stress test platform may include the following steps:
[0091] From multiple test script files stored on the stress testing platform, a target script file matching the stress testing parameters is identified; script instructions are generated based on the target script file as test instructions.
[0092] In practical implementation, multiple test script files can be pre-stored in the stress testing platform. For example, the test script files can be stored in a storage volume, and different test script files can correspond to different stress test parameters. After obtaining the stress test parameters, a target script file that matches the stress test parameters can be determined from the multiple test script files, and script instructions can be generated based on the target script file as test instructions.
[0093] In this embodiment, multiple test script files can be pre-stored in the stress testing platform. By identifying the target script file that matches the stress testing parameters, script instructions are generated based on the target script file as test instructions. This provides a data basis for the division of labor between scheduling equipment and stress testing execution equipment, effectively improving the stress testing resource allocation effect. Furthermore, through the accumulation and retention of test script data, it can be used multiple times after the initial preparation, which is conducive to the cyclical use of test script files.
[0094] In one embodiment, the stress test parameters may include a target scenario type and a target concurrency parameter. The step of determining the test script file matching the stress test parameters from multiple test script files stored on the stress test platform may include:
[0095] Obtain the scene type corresponding to each of the multiple preset test script files, and determine the test script file whose scene type matches the target scene type as the target script file.
[0096] Specifically, the correspondence between test script files and scenario types can be pre-defined. When a stress test request is received, the scenario types corresponding to multiple test script files can be obtained, and the test script file that matches the target scenario type can be identified as the target script file, such as a test script file with the same scenario type.
[0097] The step of generating script instructions based on the target script file as test instructions may include:
[0098] Based on the target concurrency parameters, update the thread group parameters in the target script file to obtain the updated script file; generate script instructions based on the updated script file as test instructions.
[0099] In practical applications, stress test parameters may include target concurrency parameters. When the target concurrency parameters do not match the thread group parameters in the target script file, the thread group parameters in the target script file can be updated according to the target concurrency parameters to obtain an updated script file. Then, script instructions as test instructions can be generated based on the updated script file.
[0100] In this embodiment, the test script file that matches the target scenario type is identified as the target script file. Based on the target concurrency parameters, the thread group parameters in the target script file are updated to obtain the updated script file. Script instructions are then generated based on the updated script file, which effectively improves the efficiency of parameter modification in the same test scenario and improves the efficiency of stress testing with different concurrencies in the same scenario.
[0101] In one embodiment, the method may further include the following steps:
[0102] Upon receiving a monitoring request for the stress test process of the test object, it is determined whether the test object is configured with a platform monitoring module; if the test object is configured with the platform monitoring module, the network address corresponding to the test object is obtained through the platform monitoring module; the user is redirected to the page corresponding to the network address, and the page is displayed on the monitoring interface of the stress test platform.
[0103] In practical applications, a platform monitoring module can be configured for the test object through a stress testing platform. Users can generate a stress testing process monitoring request for the test object to view its current status in real time during the stress testing process. Upon receiving a stress testing process monitoring request for the test object, the platform's main application can determine whether the test object is configured with a platform monitoring module, such as the Zabbix monitoring module.
[0104] Once the test object is configured with a platform monitoring module, the network address corresponding to the test object can be obtained through the platform control module. After obtaining the network address, the user can be redirected to the page corresponding to the network address and the page will be displayed in the monitoring interface of the stress testing platform, thereby realizing real-time monitoring of the stress testing process.
[0105] In this embodiment, the platform monitoring module in the test object can achieve real-time and automatic monitoring of the test object without requiring the user to apply for or deploy monitoring resources, thereby improving the efficiency of stress testing.
[0106] In one embodiment, after receiving a test instruction, the target execution device can initiate a stress test on the test object in an independent test system by simulating stress test traffic. This prevents the data of the test object from flowing to the downstream system, avoids mutual interference between systems, and effectively improves the accuracy and reliability of the stress test results.
[0107] In one embodiment, such as Figure 3 As shown, a stress testing platform is provided, including a main platform application, storage volumes, scheduling devices, and multiple stress test execution devices; wherein,
[0108] The main application 301 of the platform is used to respond to stress test requests for the test object, determine the stress test parameters corresponding to the stress test request, obtain the test instructions corresponding to the stress test parameters based on the test script file stored in the stress test platform, and send the test instructions to the scheduling device.
[0109] The scheduling device 302 is used to select a target execution device from multiple stress test execution devices and send the test command to the target execution device.
[0110] The stress test execution device 303 is used to perform stress tests on the test object based on the test command when a test command is received.
[0111] To enable those skilled in the art to better understand the above steps, the following example illustrates the embodiments of this application, but it should be understood that the embodiments of this application are not limited thereto.
[0112] like Figure 4 As shown, a stress testing system can include the platform's main application, the platform's stress testing terminal, and the testing system.
[0113] The platform's main application can be built using a pre-defined platform framework, such as the Sfopen framework. The built main application can include a front-end, back-end, and a separate platform monitoring service. The platform's load testing end can be configured with storage volumes, multiple schedulers (i.e., scheduling devices), and multiple execution machines (i.e., load test execution devices). The front-end, back-end, and schedulers in the load testing system can all exchange data with the storage volumes. Direct data exchange reduces the number of file transfers and improves the convenience of data reading and storage.
[0114] In the specific implementation, user roles with different access permissions can be set in the main platform application. Load testing users can log in through CAS (Central Authentication Service) on the front end of the main platform application.
[0115] After logging in, load testing users can input load testing parameters in the front-end interface, such as selecting the corresponding load testing scenario, and generating a load testing request for the test object. In one example, a load testing user can send a monitoring module configuration request for the test object. In response to the monitoring module configuration request, the load testing system can configure other monitoring modules for the test object.
[0116] When a user sends a stress test request, in response to the user's action, the platform's main application frontend can send the stress test parameters to the backend. The backend then retrieves the test script file corresponding to the stress test parameters from the storage volume, generates test instructions based on the test script file, and sequentially selects a scheduler from multiple schedulers. The backend then starts the JMeter service on the scheduler through script instructions (such as Linux instructions).
[0117] Upon receiving the script command, the selected scheduler can sequentially choose an executor from multiple executors, start the JMeter service on the executor via the script command, and send test commands to the executor. The executor can then, according to the test commands, simulate load testing traffic in a standalone test system in non-GUI mode to test the object (e.g., ...). Figure 4 The tested service A) is tested.
[0118] During testing, if the test object has a platform monitoring module installed, the application server's IP address is obtained through this module. Upon receiving a request from a load test user to view the test object's current status, the platform's main application configures this IP address and redirects the user to the corresponding page displayed on the monitoring platform. If the test object does not have a platform monitoring module installed, it can be monitored using other methods. Furthermore, the execution machine can acquire load test response information during the test process, record it as a process file, and send it back to the scheduler. The scheduler can then store this file in a storage volume.
[0119] After the stress test is completed, the executor can also send the stress test results back to the scheduler in the form of a test result report. The scheduler can then send the test result report to the storage volume for storage.
[0120] It should be understood that, although Figure 2 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2 At least some of the steps in the process may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but may be executed at different times. The execution order of these steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the steps or stages in other steps.
[0121] In one embodiment, such as Figure 5 As shown, a pressure testing device is provided, the device may include:
[0122] The stress test parameter acquisition module 501 is used to determine the stress test parameters corresponding to the stress test request in response to a stress test request for a test object.
[0123] The test instruction acquisition module 502 is used to acquire the test instructions corresponding to the stress test parameters based on the test script files stored in the stress test platform.
[0124] The execution device determination module 503 is used to retrieve the target execution device from a plurality of pre-set stress test execution devices of the stress test platform, and send the test instruction to the target execution device to instruct the target execution device to perform stress test on the test object based on the test instruction.
[0125] In one embodiment, the execution device determination module 503 includes:
[0126] The scheduling device determination submodule is used to send the test command to the preset scheduling device of the stress test platform, and the scheduling device retrieves the target execution device from the multiple stress test execution devices according to the preset device scheduling rules.
[0127] In one embodiment, the scheduling device determines a submodule, including:
[0128] The first scheduling order determination unit is used to obtain the scheduling order of each of the preset scheduling devices in the stress testing platform.
[0129] The test instruction sending unit is used to determine the target scheduling device to be scheduled from the multiple scheduling devices according to the scheduling order corresponding to each scheduling device, and send the test instruction to the target scheduling device.
[0130] In one embodiment, the scheduling device determines a submodule, including:
[0131] The second scheduling order determination unit is used to obtain the execution order of each of the preset multiple stress test execution devices in the stress test platform through the target scheduling device;
[0132] The target execution device acquisition unit is used by the target scheduling device to retrieve the target execution device from multiple stress test execution devices according to the execution order corresponding to each stress test execution device.
[0133] In one embodiment, the apparatus further includes:
[0134] The test file receiving module is used to receive the test file returned by the target execution device through the scheduling device; the test file includes a process file recording the stress test process and / or a test result report corresponding to the stress test;
[0135] A test file storage module is used to store the test files in the storage volume of the stress testing platform;
[0136] The test file display module is used to retrieve the test file from the storage volume and display the test file in the stress testing platform when a user requests access to the test results of the stress test.
[0137] In one embodiment, the test file display module includes:
[0138] The file size acquisition submodule is used to obtain the file size corresponding to the test file;
[0139] The parsing submodule is used to parse the test file using a preset plugin when the file size of the test file exceeds a preset threshold, so as to obtain the parsed test file.
[0140] The parsed file display submodule is used to display the parsed test files on the front-end page of the stress testing platform.
[0141] In one embodiment, the test instruction acquisition module 502 includes:
[0142] The target script file determination submodule is used to determine the target script file that matches the stress test parameters from multiple test script files stored in the stress test platform;
[0143] The script instruction generation submodule is used to generate script instructions based on the target script file, as test instructions.
[0144] In one embodiment, the stress test parameters include target scenario type and target concurrency parameters. The target script file determination submodule is specifically used to obtain the scenario type corresponding to each of the preset multiple test script files, and determine the test script file whose corresponding scenario type matches the target scenario type as the target script file.
[0145] The script instruction generation submodule is specifically used to update the thread group parameters in the target script file according to the target concurrency parameters, obtain the updated script file, and generate script instructions based on the updated script file as test instructions.
[0146] In one embodiment, the apparatus further includes:
[0147] The monitoring request receiving module is used to determine whether the test object is configured with a platform monitoring module when it receives a monitoring request for the stress testing process of the test object.
[0148] The network address acquisition module is used to acquire the network address corresponding to the test object through the platform monitoring module when the test object is configured with the platform monitoring module.
[0149] The redirection module is used to redirect to the page corresponding to the network address and display the page on the monitoring interface of the stress testing platform.
[0150] For specific limitations regarding a pressure testing device, please refer to the limitations regarding a pressure testing method described above, which will not be repeated here. Each module in the aforementioned pressure testing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0151] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 6 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores test script files and test files corresponding to stress tests. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements a stress testing method.
[0152] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0153] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0154] In response to a stress test request for a test object, determine the stress test parameters corresponding to the stress test request;
[0155] Based on the test script files stored in the stress testing platform, obtain the test instructions corresponding to the stress testing parameters;
[0156] The target execution device is selected from multiple pre-set stress test execution devices of the stress test platform, and the test command is sent to the target execution device to instruct the target execution device to perform stress test on the test object based on the test command.
[0157] In one embodiment, the processor also performs the steps described in the other embodiments when executing the computer program.
[0158] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0159] In response to a stress test request for a test object, determine the stress test parameters corresponding to the stress test request;
[0160] Based on the test script files stored in the stress testing platform, obtain the test instructions corresponding to the stress testing parameters;
[0161] The target execution device is selected from multiple pre-set stress test execution devices of the stress test platform, and the test command is sent to the target execution device to instruct the target execution device to perform stress test on the test object based on the test command.
[0162] In one embodiment, the computer program, when executed by a processor, also implements the steps described in the other embodiments above.
[0163] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0164] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0165] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A pressure testing method, characterized in that, The method includes: Pre-set the mapping between multiple test script files and scene types; Based on the scenario selected by the user in the main application front end of the stress testing platform, a stress test request is generated for the test object. In response to the stress test request, stress test parameters for controlling the stress test method are determined. The stress test parameters corresponding to the stress test request include the target scenario type and the target concurrency parameters. According to the correspondence, the test script file whose scene type matches the target scene type in the plurality of test script files is determined as the target script file. According to the target concurrency parameters, the thread group parameters in the target script file are updated to obtain the updated script file. Script instructions are generated based on the updated script file as test instructions. Based on the scheduling order of the scheduling devices and the execution order of multiple stress test execution devices in the stress testing platform, the target execution device is invoked through the target scheduling device, and the test instruction is sent to the target execution device to instruct the target execution device to perform stress testing on the test object based on the test instruction; wherein, the target execution device initiates stress testing on the test object by simulating stress test traffic in an independent test system; Upon receiving a load testing process monitoring request for the test object, obtain the network address corresponding to the test object; Redirecting to the page corresponding to the network address, and displaying the page on the monitoring interface of the stress testing platform; After the stress test is completed, the usage rights of the target execution device and the target scheduling device are revoked so that the target execution device and the target scheduling device can be re-determined when the stress test is conducted again.
2. The method according to claim 1, characterized in that, The target execution device is determined through the following steps: According to the scheduling order of the scheduling devices in the stress testing platform, the test instruction is sent to the target scheduling device of the stress testing platform. The target scheduling device then retrieves the target execution device from the multiple stress testing execution devices according to the preset device scheduling rules.
3. The method according to claim 2, characterized in that, The step of sending the test command to the target scheduling device of the stress testing platform according to the scheduling order of the scheduling devices in the stress testing platform includes: Obtain the scheduling order of each of the preset scheduling devices in the stress testing platform; Based on the scheduling order of each scheduling device, the target scheduling device to be scheduled is determined from the multiple scheduling devices, and the test command is sent to the target scheduling device.
4. The method according to claim 3, characterized in that, The step of retrieving a target execution device from the multiple stress test execution devices according to preset device scheduling rules via the target scheduling device includes: The target scheduling device is used to obtain the execution order of each of the preset stress test execution devices in the stress test platform; The target scheduling device selects the target execution device from multiple stress test execution devices according to the execution order corresponding to each stress test execution device.
5. The method according to claim 2, characterized in that, Also includes: The scheduling device receives the test file returned by the target execution device; The test file includes a process file that records the test process of the stress test, and / or a test result report corresponding to the stress test; The test files are stored in the storage volume of the stress testing platform; When a user requests access to the test results of the stress test, the test file is retrieved from the storage volume and displayed on the stress test platform.
6. The method according to claim 5, characterized in that, The process of displaying the test file on the stress testing platform includes: Obtain the file size corresponding to the test file; When the file size of the test file exceeds a preset threshold, a preset plugin is used to parse the test file to obtain the parsed test file. The parsed test file is displayed on the front-end page of the stress testing platform.
7. The method according to any one of claims 1 to 6, characterized in that, Upon receiving a load testing process monitoring request for the test object, obtaining the network address corresponding to the test object includes: Upon receiving a monitoring request for the stress testing process of the test object, determine whether the test object is configured with a platform monitoring module; When the test object is configured with the platform monitoring module, the network address corresponding to the test object is obtained through the platform monitoring module.
8. A pressure testing platform, characterized in that, This includes the platform's main application, storage volumes, scheduling devices, and multiple stress test execution devices; The platform's main application is used to pre-set the correspondence between multiple test script files and scenario types. Based on the scenario selected by the user in the main application's front end, it generates a stress test request for the test object, responds to the stress test request, determines the stress test parameters corresponding to the request to control the stress test method, identifies the multiple test script files stored on the stress test platform, and, based on the correspondence, determines the test script file whose scenario type matches the target scenario type as the target script file. Based on the target concurrency parameters, it updates the thread group parameters in the target script file to obtain an updated script file. Based on the updated script file, it generates script instructions as test instructions and sends these instructions to the scheduling device. The stress test parameters corresponding to the stress test request include the target scenario type and the target concurrency parameters; different test script files correspond to different stress test parameters. The scheduling device is used to retrieve the target execution device through the target scheduling device according to the scheduling order of the scheduling devices in the stress testing platform and the execution order of multiple stress testing execution devices, and send the test command to the target execution device. The stress test execution device is used to perform stress tests on the test object based on the test command when a test command is received; wherein, the target execution device initiates stress tests on the test object by simulating stress test traffic in an independent test system; The main application of the platform is also used to obtain the network address corresponding to the test object when it receives a monitoring request for the stress test process of the test object; jump to the page corresponding to the network address and display the page on the monitoring interface of the stress test platform; and after the stress test is completed, revoke the usage rights of the target execution device and the target scheduling device so that the target execution device and the target scheduling device can be re-determined when the stress test is performed again.
9. A pressure testing device, characterized in that, The device includes: The stress test parameter acquisition module is used to pre-set the correspondence between multiple test script files and scenario types. Based on the scenario corresponding to the stress test selected by the user in the main application front end of the stress test platform, it generates a stress test request for the test object. In response to the stress test request, it determines the stress test parameters corresponding to the stress test request for controlling the stress test method. The stress test parameters corresponding to the stress test request include the target scenario type and the target concurrency parameters. The test instruction acquisition module is used to determine the test script file whose scene type matches the target scene type in the plurality of test script files according to the correspondence relationship, and update the thread group parameters in the target script file according to the target concurrency parameters to obtain the updated script file. Based on the updated script file, script instructions are generated as test instructions; wherein, different test script files correspond to different stress test parameters. The execution device determination module is used to, according to the scheduling order of the scheduling devices in the stress testing platform and the execution order of multiple stress testing execution devices, retrieve the target execution device through the target scheduling device, and send the test instruction to the target execution device to instruct the target execution device to perform stress testing on the test object based on the test instruction; wherein, the target execution device initiates stress testing on the test object by simulating stress test traffic in an independent test system; The device is also used for: Upon receiving a load testing process monitoring request for the test object, obtain the network address corresponding to the test object; Redirecting to the page corresponding to the network address, and displaying the page on the monitoring interface of the stress testing platform; After the stress test is completed, the usage rights of the target execution device and the target scheduling device are revoked so that the target execution device and the target scheduling device can be re-determined when the stress test is conducted again.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Parameterized test script-based automatic test method and system
CN107943689A
System performance testing method and device, computer equipment and storage medium
CN108563544A
Pressure test method of gRPC interface, computer equipment and storage medium
CN111752820A