CN118312440A - Automated stress testing method, device, equipment, and readable storage medium - Google Patents
Automated stress testing method, device, equipment, and readable storage medium Download PDFInfo
- Publication number
- CN118312440A CN118312440A CN202410725663.3A CN202410725663A CN118312440A CN 118312440 A CN118312440 A CN 118312440A CN 202410725663 A CN202410725663 A CN 202410725663A CN 118312440 A CN118312440 A CN 118312440A
- Authority
- CN
- China
- Prior art keywords
- test
- stress
- execution module
- module
- automated
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims description 52
- 238000009662 stress testing Methods 0.000 title claims description 36
- 238000012360 testing method Methods 0.000 claims abstract description 261
- 238000004590 computer program Methods 0.000 claims description 19
- 238000010586 diagram Methods 0.000 description 13
- 230000006870 function Effects 0.000 description 13
- 238000012545 processing Methods 0.000 description 12
- 238000004891 communication Methods 0.000 description 7
- 230000008569 process Effects 0.000 description 7
- 230000003287 optical effect Effects 0.000 description 5
- 230000007246 mechanism Effects 0.000 description 3
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 2
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 2
- 101100012902 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) FIG2 gene Proteins 0.000 description 2
- 230000001133 acceleration Effects 0.000 description 2
- 230000006399 behavior Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 239000013307 optical fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 230000033764 rhythmic process Effects 0.000 description 2
- 238000013515 script Methods 0.000 description 2
- 238000004088 simulation Methods 0.000 description 2
- 101000827703 Homo sapiens Polyphosphoinositide phosphatase Proteins 0.000 description 1
- 102100023591 Polyphosphoinositide phosphatase Human genes 0.000 description 1
- 101100233916 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) KAR5 gene Proteins 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 230000003247 decreasing effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000977 initiatory effect Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000003032 molecular docking Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
Description
技术领域Technical Field
本公开涉及项目测试领域,尤其涉及一种自动化压力测试方法、装置、设备、可读存储介质。The present disclosure relates to the field of project testing, and in particular to an automated stress testing method, device, equipment, and readable storage medium.
背景技术Background technique
在现代软件开发中,确保应用程序或在线服务能够承受高流量是至关重要的。特别是对于一些实时交互系统,需要解决有时限要求的WEB服务的大规模压力测试问题,能否处理大量并发请求直接关系到用户体验和服务的稳定性。因此,进行压力测试以模拟真实的用户负载成为了一个重要的步骤。传统的压力测试方法往往需要测试人员的干预来调整测试参数,这不仅耗时而且效率低下。随着人工智能和自动化技术的发展,亟需创造一个更智能、更高效的压力测试方法、系统等。In modern software development, it is crucial to ensure that applications or online services can withstand high traffic. Especially for some real-time interactive systems, it is necessary to solve the problem of large-scale stress testing of WEB services with time limits. Whether a large number of concurrent requests can be handled is directly related to user experience and service stability. Therefore, conducting stress testing to simulate real user load has become an important step. Traditional stress testing methods often require the intervention of testers to adjust test parameters, which is not only time-consuming but also inefficient. With the development of artificial intelligence and automation technology, there is an urgent need to create a smarter and more efficient stress testing method, system, etc.
现有技术中存在的上述技术问题极大地影响了用户体验。The above technical problems existing in the prior art have greatly affected the user experience.
发明内容Summary of the invention
本公开正是为了解决上述课题而完成,其目的在于提供一种实现完成自动化压力测试需求的自动化压力测试方法、装置、设备、可读存储介质。The present disclosure is completed to solve the above-mentioned problems, and its purpose is to provide an automated stress testing method, device, equipment, and readable storage medium that can realize the automated stress testing requirements.
本公开提供该发明内容部分以便以简要的形式介绍构思,这些构思将在后面的具体实施方式部分被详细描述。该发明内容部分并不旨在标识要求保护的技术方案的关键特征或必要特征,也不旨在用于限制所要求的保护的技术方案的范围。The present disclosure provides this invention summary section to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. This invention summary section is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to be used to limit the scope of the technical solution claimed for protection.
为了解决上述技术问题,本公开实施例提供一种自动化压力测试方法,采用了如下所述的技术方案,包括:In order to solve the above technical problems, the present disclosure provides an automated stress testing method, which adopts the following technical solutions, including:
启动测试管理模块,配置所述测试管理模块中压力测试所需要的测试参数;Start the test management module and configure the test parameters required for the stress test in the test management module;
根据所述测试参数确定测试执行模块,并向所述测试执行模块分配压力测试任务;Determine a test execution module according to the test parameters, and assign a stress test task to the test execution module;
所述测试执行模块执行所述压力测试任务并返回执行结果;The test execution module executes the stress test task and returns the execution result;
根据所述执行结果与预设期望返回结果确定所述测试执行模块的性能。The performance of the test execution module is determined according to the execution result and the preset expected return result.
为了解决上述技术问题,本公开实施例还提供一种自动化压力测试装置,用于实现如上所述的方法,采用了如下所述的技术方案,包括:In order to solve the above technical problems, the embodiment of the present disclosure further provides an automated pressure testing device, which is used to implement the above method and adopts the following technical solutions, including:
测试管理模块,用于配置所述压力测试所需要的测试参数,并根据所述测试参数确定测试执行模块,并向所述测试执行模块分配压力测试任务;A test management module, used to configure the test parameters required for the stress test, determine the test execution module according to the test parameters, and assign the stress test task to the test execution module;
测试执行模块,用于执行所述压力测试任务并返回执行结果,The test execution module is used to execute the stress test task and return the execution result.
所述测试管理模块还用于根据所述执行结果与预设期望返回结果确定所述测试执行模块的性能。The test management module is also used to determine the performance of the test execution module according to the execution result and the preset expected return result.
为了解决上述技术问题,本公开实施例还提供一种计算机设备,采用了如下所述的技术方案,包括:存储器和处理器,所述存储器中存储有计算机程序,所述处理器执行所述计算机程序时实现如前任一项所述的方法。In order to solve the above technical problems, the embodiments of the present disclosure further provide a computer device, which adopts the technical solution described below, including: a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method described in any of the preceding items is implemented.
为了解决上述技术问题,本公开实施例还提供一种计算机可读存储介质,采用了如下所述的技术方案,包括:所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如前任一项所述的方法。In order to solve the above technical problems, the embodiment of the present disclosure also provides a computer-readable storage medium, which adopts the technical solution described below, including: a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, it implements the method described in any of the previous items.
根据本公开所公开的技术方案,与现有技术相比,通过多方对接消息服务,实时接收待压力测试服务的压力测试需求指令,自动完成预设的大规模压力测试需求,特别是有时限要求的WEB服务,提升了用户体验。According to the technical solution disclosed in the present invention, compared with the existing technology, through multi-party docking message services, stress test demand instructions for the services to be stress tested are received in real time, and preset large-scale stress testing demands are automatically completed, especially WEB services with time limits, thereby improving user experience.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1是根据本公开的系统架构的一个实施例的示意图;FIG1 is a schematic diagram of an embodiment of a system architecture according to the present disclosure;
图2是根据本公开的自动化压力测试方法的一个实施例的流程图;FIG2 is a flow chart of an embodiment of an automated stress testing method according to the present disclosure;
图3是根据本公开的压力测试管理后台的部分数据的示意图;FIG3 is a schematic diagram of part of the data of the stress test management background according to the present disclosure;
图4是根据本公开的压力测试管理后台的部分数据的示意图;FIG4 is a schematic diagram of part of the data of the stress test management background according to the present disclosure;
图5是根据本公开的压力测试管理后台的部分数据的示意图;FIG5 is a schematic diagram of part of the data of the stress test management background according to the present disclosure;
图6是根据本公开的自动化压力测试装置的一个实施例的示意图;FIG6 is a schematic diagram of an embodiment of an automated pressure testing device according to the present disclosure;
图7是根据本公开的计算机设备的一个实施例的示意图。FIG. 7 is a schematic diagram of one embodiment of a computer device according to the present disclosure.
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,元件和元素不一定按照比例绘制。The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.
具体实施方式Detailed ways
除非另有定义,本文所使用的所有的技术和科学术语与属于本公开的技术领域的技术人员通常理解的含义相同;本文中在申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本公开;本公开的说明书和权利要求书及上述附图说明中的术语“包括”和“具有”以及它们的任何变形,意图在于覆盖不排他的包含。本公开的说明书和权利要求书或上述附图中的术语“第一”、“第二”等是用于区别不同对象,而不是用于描述特定顺序。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present disclosure belongs; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present disclosure; the terms "including" and "having" and any variations thereof in the specification and claims of the present disclosure and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present disclosure or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本公开的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present disclosure. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
为了使本技术领域的人员更好地理解本公开方案,下面将结合附图,对本公开实施例中的技术方案进行清楚、完整地描述。In order to enable those skilled in the art to better understand the solution of the present disclosure, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
系统结构system structure
首先,说明本公开的一个实施例的系统的结构。如图1所示,系统结构100可以包括终端设备101、102、103、104,网络105和服务器106。网络105用以在终端设备101、102、103、104和服务器106之间提供通信链路的介质。First, the structure of a system of an embodiment of the present disclosure is described. As shown in FIG1 , the system structure 100 may include terminal devices 101, 102, 103, 104, a network 105, and a server 106. The network 105 is used to provide a medium for a communication link between the terminal devices 101, 102, 103, 104 and the server 106.
在本实施例中,方法运行于其上的电子设备(例如图1所示的终端设备101、102、103或104)可以通过网络105进行各种信息的传输。网络105可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。需要指出的是,上述无线连接方式可以包括但不限于3G/4G/5G连接、Wi-Fi连接、蓝牙连接、WiMAX连接、Zigbee连接、UWB连接、局域网(“LAN”)、广域网(“WAN”)、网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络)以及其他现在已知或将来开发的网络连接方式。网络105可以利用诸如HTTP(Hyper Text TransferProtocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。In this embodiment, the electronic device on which the method is run (e.g., the terminal device 101, 102, 103, or 104 shown in FIG. 1) can transmit various information through the network 105. The network 105 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc. It should be noted that the above-mentioned wireless connection methods may include, but are not limited to, 3G/4G/5G connections, Wi-Fi connections, Bluetooth connections, WiMAX connections, Zigbee connections, UWB connections, local area networks ("LAN"), wide area networks ("WAN"), Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks) and other network connection methods known now or developed in the future. The network 105 can communicate using any currently known or future developed network protocol such as HTTP (Hyper Text Transfer Protocol), and can be interconnected with digital data communications (e.g., communication networks) of any form or medium.
用户可以使用终端设备101、102、103、104通过网络105与服务器106交互,以接收或发送消息等。终端设备101、102、103或104上可以安装有各种客户端应用,例如视频直播与播放类应用、网页浏览器应用、购物类应用、搜索类应用、即时通信工具、邮箱客户端、社交平台软件等。The user can use the terminal devices 101, 102, 103, 104 to interact with the server 106 through the network 105 to receive or send messages, etc. Various client applications can be installed on the terminal devices 101, 102, 103 or 104, such as video live broadcast and playback applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
终端设备101、102、103或104可以是具有触摸显示屏和/或支持网页浏览的各种电子设备,包括但不限于智能手机、平板电脑、电子书阅读器、MP3(动态影像专家压缩标准音频层面3)播放器、MP4(动态影像专家压缩标准音频层面4)播放器、头戴式显示设备、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等。The terminal devices 101, 102, 103 or 104 can be various electronic devices with a touch display and/or support for web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 (Moving Picture Experts Compressed Standard Audio Layer 3) players, MP4 (Moving Picture Experts Compressed Standard Audio Layer 4) players, head-mounted display devices, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., as well as mobile terminals such as digital TVs, desktop computers, etc.
服务器106可以是提供各种服务的服务器,例如对终端设备101、102、103或104上显示的页面或传输的数据提供支持的后台服务器。The server 106 may be a server that provides various services, such as a background server that provides support for pages displayed on the terminal device 101 , 102 , 103 or 104 or data transmitted.
应该理解,图1中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。It should be understood that the number of terminal devices, networks and servers in Figure 1 is only illustrative. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
这里,终端设备可以独立或通过与其他电子终端设备配合运行各类操作系统例如安卓系统中的应用实现本公开的实施例方法,也可以运行其他操作系统中的应用实现本公开的实施例方法。Here, the terminal device can independently or in cooperation with other electronic terminal devices run various operating systems such as applications in the Android system to implement the embodiment method of the present disclosure, and can also run applications in other operating systems to implement the embodiment method of the present disclosure.
自动化压力测试方法Automated stress testing methods
参考图2,示出了根据本公开的自动化压力测试方法的一个实施例的流程图。所述自动化压力测试方法,包括:Referring to FIG2 , a flow chart of an embodiment of an automated stress testing method according to the present disclosure is shown. The automated stress testing method comprises:
S21,启动测试管理模块,配置测试管理模块中压力测试所需要的测试参数。S21, start the test management module, and configure the test parameters required for the stress test in the test management module.
在一个或多个实施例中,例如应用场景为程序员开发一个答题WEB服务。假设一场答题配置了10道题,每道题配置了3个可选项,题目发布后,用户有10s内的时间提交答案。在项目测试阶段,需要模拟50万登录用户在10s内提交不同答案的真实压力状态。In one or more embodiments, for example, the application scenario is that a programmer develops a quiz web service. Assume that a quiz session is configured with 10 questions, each with 3 options, and after the question is released, the user has 10 seconds to submit the answer. During the project testing phase, it is necessary to simulate the real pressure state of 500,000 logged-in users submitting different answers within 10 seconds.
这里,例如压力测试系统至少包含两部分:至少1个测试管理模块例如为测试管理WEB服务和n个测试执行模块例如为测试执行WEB服务。将测试执行WEB服务部署在n台服务器上,这里,压力测试系统需要在10s内对答题WEB服务发起50万个网络请求,单个服务器在一定时限内能够发起的网络I/O数是有限的,无法满足10s内发起50万个请求的需求。在开始压力测试前,程序员会根据备用服务器的系统负载性能粗略估算,部署至少一个测试执行WEB服务。Here, for example, the stress test system includes at least two parts: at least one test management module, such as a test management WEB service, and n test execution modules, such as a test execution WEB service. The test execution WEB service is deployed on n servers. Here, the stress test system needs to initiate 500,000 network requests to the question answering WEB service within 10 seconds. The number of network I/Os that a single server can initiate within a certain time limit is limited, and it cannot meet the requirement of initiating 500,000 requests within 10 seconds. Before starting the stress test, the programmer will roughly estimate the system load performance of the backup server and deploy at least one test execution WEB service.
在一个或多个实施例中,例如压力测试系统例如还包括消息模块例如为消息WEB服务,当然,消息模块也可以作为一个独立的服务,并不做限定。例如为用户提供服务的其他WEB服务可以作为生产者或者消费者与消息WEB服务进行长连接。作为生产者的其他WEB服务可以向消息WEB服务发送指定topic主题的消息数据。作为消费者的其他WEB服务可以向消息WEB服务订阅对应topic主题即可实时接收生产者已发送的消息数据。In one or more embodiments, for example, the stress testing system also includes a message module, such as a message WEB service. Of course, the message module can also be used as an independent service, and is not limited. For example, other WEB services that provide services to users can be long-connected with the message WEB service as producers or consumers. Other WEB services that act as producers can send message data of a specified topic to the message WEB service. Other WEB services that act as consumers can subscribe to the corresponding topic to the message WEB service to receive the message data sent by the producer in real time.
在一个或多个实施例中,例如测试管理WEB服务启动后,内部连接消息WEB服务并作为生产者(topic=A)。In one or more embodiments, for example, after the test management WEB service is started, it internally connects to the message WEB service and acts as a producer (topic=A).
在一个或多个实施例中,如图3所示,为压力测试管理后台的部分数据示意图,例如点击“初始化压测”按钮,该后台会展示本次压力测试编辑弹框,用于配置测试管理模块中压力测试所需要的测试参数,还包括:In one or more embodiments, as shown in FIG. 3, a partial data diagram of the stress test management background is shown. For example, when the "Initialize Stress Test" button is clicked, the background will display the current stress test editing pop-up window for configuring the test parameters required for the stress test in the test management module, and also includes:
可以根据需要点击“添加”按钮以添加测试参数,例如10道题一共要编辑10条测试参数,点击“确认提交”按钮以确认提交;You can click the "Add" button to add test parameters as needed. For example, if there are 10 questions, you need to edit 10 test parameters in total. Click the "Confirm Submission" button to confirm submission.
这里,测试参数至少包括执行标识、总执行数、待发起请求的接口、待发起请求的接口待选参数串、期望返回结果、期望最大返回时间之一。这里,执行标识AAA等例如为不可重复标识,总执行数例如为50万次,例如待发起请求的接口待选参数串包括至少一个,且每个待选参数串不重复,且每个待选参数串指定选中概率;另外,待选参数串的个数还可以根据实际被压力测试接口可选参数值的可选种类确定,例如当前场答题每题有3个待选答案,则有3个待选参数串。根据本公开的用户界面或配置文件,允许测试人员事先设置所有必要的参数和规则,一旦配置完成,压力测试就可以完全自动运行。Here, the test parameters include at least one of the execution identifier, the total number of executions, the interface to be requested, the parameter string to be selected for the interface to be requested, the expected return result, and the expected maximum return time. Here, the execution identifier AAA, etc., for example, is a non-repeatable identifier, and the total number of executions is, for example, 500,000 times. For example, the parameter string to be selected for the interface to be requested includes at least one, and each parameter string to be selected is not repeated, and each parameter string to be selected specifies the probability of being selected; in addition, the number of parameter strings to be selected can also be determined according to the optional types of optional parameter values of the actual stress-tested interface. For example, if each question in the current field has 3 answers to be selected, there are 3 parameter strings to be selected. According to the user interface or configuration file disclosed in the present invention, the tester is allowed to set all necessary parameters and rules in advance, and once the configuration is completed, the stress test can be run completely automatically.
在一个或多个实施例中,例如通过自动化测试脚本,在压力测试服务启动时自动执行,根据预设的测试计划和测试参数自动运行测试案例。测试执行WEB服务例如会在特定事件发生时(如达到某个性能阈值)自动触发压力测试的下一阶段,这里,事件可以是时间点(如每10秒检查一次),也可以是性能指标(如响应时间超过预定值),并且当监控工具检测到性能指标达到特定条件时,系统会自动通知压力测试服务调整测试节奏。In one or more embodiments, for example, through automated test scripts, the stress test service is automatically executed when it is started, and the test cases are automatically run according to the preset test plan and test parameters. The test execution WEB service, for example, automatically triggers the next stage of the stress test when a specific event occurs (such as reaching a certain performance threshold). Here, the event can be a time point (such as checking every 10 seconds) or a performance indicator (such as the response time exceeds a predetermined value), and when the monitoring tool detects that the performance indicator reaches a specific condition, the system will automatically notify the stress test service to adjust the test rhythm.
在一个或多个实施例中,例如建立一个反馈循环,使得压力测试服务能够根据实时性能数据自动调整测试负载。例如,如果服务器响应时间增加,系统会自动减少发送请求的频率。还可以通过设计状态机制,使得压力测试服务能够在不同的状态之间转换,如“启动”、“运行”、“调整”和“停止”,每个状态都有明确的入口和出口条件,确保测试按照预定流程自动进行。In one or more embodiments, for example, a feedback loop is established so that the stress testing service can automatically adjust the test load according to real-time performance data. For example, if the server response time increases, the system will automatically reduce the frequency of sending requests. It is also possible to design a state mechanism so that the stress testing service can switch between different states, such as "start", "run", "adjust" and "stop", and each state has clear entry and exit conditions to ensure that the test is automatically carried out according to the predetermined process.
S22,根据测试参数确定测试执行模块,并向测试执行模块分配压力测试任务。S22, determining a test execution module according to the test parameters, and assigning a stress test task to the test execution module.
在一个或多个实施例中,例如根据测试参数确定测试执行模块,并向测试执行模块分配压力测试任务,这里,例如,在测试执行WEB服务启动后,内部会连接消息WEB服务并作为消费者订阅特定的第一消息topic=A和第二消息topic=B。In one or more embodiments, for example, a test execution module is determined based on test parameters, and a stress test task is assigned to the test execution module. Here, for example, after the test execution WEB service is started, the message WEB service is internally connected and subscribes to a specific first message topic=A and a second message topic=B as a consumer.
测试管理模块向测试执行模块发送第一消息。例如测试管理WEB服务向消息WEB服务发送第一消息topic=A的[消息1]。[消息1]的内容例如为:各个测试执行WEB服务收到消息后立即请求测试管理WEB服务的签到接口。The test management module sends a first message to the test execution module. For example, the test management WEB service sends a first message [message 1] with topic=A to the message WEB service. The content of [message 1] is, for example: after receiving the message, each test execution WEB service immediately requests the sign-in interface of the test management WEB service.
测试执行模块接收第一消息后请求测试管理模块的签到接口,各个测试执行WEB服务通过消息WEB服务接收到[消息1]后,请求测试管理WEB服务的签到接口。After receiving the first message, the test execution module requests the check-in interface of the test management module. After receiving [Message 1] through the message WEB service, each test execution WEB service requests the check-in interface of the test management WEB service.
测试管理模块根据收到的请求数量向测试执行模块分配压力测试任务。The test management module allocates stress test tasks to the test execution module according to the number of requests received.
测试管理WEB服务在[消息1]发出后,统计一段时间内(假设为3s)到达的签到请求,这里例如请求中包含对应测试执行WEB服务的IP,也作为该服务的唯一标识。测试管理WEB服务根据统计到的请求得到n个测试执行WEB服务,假设IP为:192.168.0.2、192.168.0.3、192.168.0.1。先根据IP进行排序,并根据个数n,为各个测试执行WEB服务分配压力测试任务,若不够整除的默认放到最后一个, 最后请求各个测试执行WEB服务的接收任务接口,将下列列表数据同步给各个测试执行WEB服务。After [Message 1] is sent, the test management WEB service counts the check-in requests that arrive within a period of time (assuming 3 seconds). Here, for example, the request contains the IP address of the corresponding test execution WEB service, which is also used as the unique identifier of the service. The test management WEB service obtains n test execution WEB services based on the counted requests, assuming the IP addresses are: 192.168.0.2, 192.168.0.3, and 192.168.0.1. First, sort by IP address, and assign stress test tasks to each test execution WEB service based on the number n. If the number is not divisible by integer, it is placed at the end by default. Finally, request the receiving task interface of each test execution WEB service to synchronize the following list data to each test execution WEB service.
如图4所示,为测试管理WEB服务生成执行详情表并展示的后台数据,其中至少包括执行机器数、已执行数、成功数、失败数、总执行时长、平均耗时、QPS(Queries-per-second)即每秒查询率等数据。As shown in Figure 4, an execution details table is generated for the test management WEB service and the background data is displayed, which includes at least the number of execution machines, the number of executions, the number of successes, the number of failures, the total execution time, the average execution time, QPS (Queries-per-second), or the query rate per second, and other data.
S23,测试执行模块执行压力测试任务并返回执行结果。S23, the test execution module executes the stress test task and returns the execution result.
在一个或多个实施例中,当待测试的服务,例如举例的答题服务需要压力测试时,测试执行模块执行压力测试任务并返回执行结果。In one or more embodiments, when a service to be tested, such as the example question answering service, requires stress testing, the test execution module executes the stress testing task and returns the execution result.
测试管理模块向测试执行模块发送第二消息,例如连接消息WEB服务并作为生产者,向消息WEB服务发送第二消息topic=B的[消息2],[消息2]的内容例如为:执行标识(比如AAA)。The test management module sends a second message to the test execution module, for example, connects to the message WEB service and acts as a producer to send a second message [Message 2] of topic=B to the message WEB service, wherein the content of [Message 2] is, for example: execution identifier (such as AAA).
测试执行模块接收第二消息后根据预设任务区间生成与任务区间对应唯一的虚拟用户,例如各个测试执行WEB服务通过消息WEB服务接收到[消息2]后,根据自身的任务区间,生成一批与任务区间对应唯一ID的虚拟用户。After receiving the second message, the test execution module generates a unique virtual user corresponding to the task interval according to the preset task interval. For example, after each test execution WEB service receives [Message 2] through the message WEB service, it generates a batch of virtual users with unique IDs corresponding to the task interval according to its own task interval.
在一个或多个实施例中,例如采用分布式用户模拟系统,可以在不影响真实用户的情况下,对WEB服务进行全面和深入的压力测试,确保服务在高负载情况下的性能和稳定性。In one or more embodiments, for example, a distributed user simulation system may be used to perform comprehensive and in-depth stress testing on WEB services without affecting real users, thereby ensuring the performance and stability of the services under high load conditions.
这里,分布式架构用户模拟系统采用分布式架构,例如由多个节点组成,每个节点可以模拟一定数量的用户。这些节点分布在不同的服务器或容器中,可以在不同的地理位置运行,以模拟真实世界中的用户分布,每个节点上运行的模拟用户例如能够根据预设的行为脚本执行操作,例如,在答题WEB服务的场景中,模拟用户会在题目发布后的10秒内选择答案并提交。这里,系统设计时考虑到可扩展性,可以根据需要增加或减少模拟用户的数量,以实现可以轻松地从模拟少量用户到模拟50万甚至更多用户。这里,模拟用户的行为还可以通过参数化输入来控制,以允许测试人员定义不同的测试场景,如不同的答题选项和提交时间,还能够根据预设的算法自动调整测试参数,例如不同用户对同一题目的不同答案选择,以确保测试覆盖所有可能的使用场景。另外,系统中的节点需要能够同步操作,以确保所有模拟用户几乎同时开始测试。此外,节点之间的通信机制确保了测试数据的一致性和准确性。系统还能够模拟节点故障的情况,并测试服务的恢复能力,以评估在真实环境中遇到问题时的表现。Here, the distributed architecture user simulation system adopts a distributed architecture, for example, it consists of multiple nodes, each of which can simulate a certain number of users. These nodes are distributed in different servers or containers and can run in different geographical locations to simulate the user distribution in the real world. The simulated users running on each node can, for example, perform operations according to preset behavior scripts. For example, in the scenario of answering questions WEB service, the simulated user will select the answer and submit it within 10 seconds after the question is released. Here, the system is designed with scalability in mind, and the number of simulated users can be increased or decreased as needed to achieve the ability to easily simulate a small number of users to 500,000 or even more users. Here, the behavior of simulated users can also be controlled by parameterized input to allow testers to define different test scenarios, such as different answer options and submission times, and can also automatically adjust test parameters according to preset algorithms, such as different answers to the same question by different users, to ensure that the test covers all possible usage scenarios. In addition, the nodes in the system need to be able to operate synchronously to ensure that all simulated users start the test almost at the same time. In addition, the communication mechanism between nodes ensures the consistency and accuracy of the test data. The system can also simulate node failures and test the recovery capability of the service to evaluate the performance when encountering problems in a real environment.
测试执行模块根据自身所在服务器性能,对待测试的服务发起并发请求;这里,并发请求中例如至少包括虚拟用户信息、预设对应标识 (AAA)的接口URI和根据预设概率随机选中的参数串,即完全模拟真实用户的请求情况。The test execution module initiates concurrent requests to the service to be tested based on the performance of the server where it is located. Here, the concurrent requests include at least virtual user information, an interface URI of a preset corresponding identifier (AAA), and a parameter string randomly selected according to a preset probability, which completely simulates the request of a real user.
这里,例如系统前端会有一个或多个负载均衡器,负责将进入的请求分发到后端的多个服务器,以确保没有单一的服务器会因为过载而成为瓶颈。为了管理大量的并发请求,系统会使用消息队列来缓存请求,以控制数据流向服务的速率,防止服务因为暴增的请求而崩溃。系统例如还会采用异步处理机制来处理请求,以在等待一个请求的处理结果时,继续接收和处理其他请求。为了提高系统的可靠性,当某个服务器发生故障时,负载均衡器还会将请求重新分配到其他健康的服务器上。Here, for example, there will be one or more load balancers at the front end of the system, which are responsible for distributing incoming requests to multiple servers at the back end to ensure that no single server becomes a bottleneck due to overload. In order to manage a large number of concurrent requests, the system will use message queues to cache requests to control the rate at which data flows to the service and prevent the service from crashing due to a surge in requests. For example, the system will also use asynchronous processing mechanisms to process requests so that it can continue to receive and process other requests while waiting for the processing result of one request. In order to improve the reliability of the system, when a server fails, the load balancer will also redistribute requests to other healthy servers.
在一个或多个实施例中,例如根据执行结果与预设期望返回结果确定测试执行模块的性能,包括:将并发请求的返回结果与预设期望返回结果进行匹配,并比较请求消耗时间是否在预设期望最大返回时间内,若同时满足两者则自动化压力测试成功,否则为自动化压力测试失败。In one or more embodiments, for example, the performance of the test execution module is determined based on the execution results and the preset expected return results, including: matching the return results of concurrent requests with the preset expected return results, and comparing whether the request consumption time is within the preset expected maximum return time. If both are met, the automated stress test is successful, otherwise the automated stress test fails.
S24,根据执行结果与预设期望返回结果确定测试执行模块的性能。S24, determining the performance of the test execution module according to the execution result and the preset expected return result.
例如,测试执行WEB服务每完成一批请求,假设为1000个,就上报一次给测试管理WEB服务,直到完成所有请求任务为止。上报内容为各个请求是否成功和各请求消耗时间。For example, when the test execution web service completes a batch of requests, let's say 1,000, it reports to the test management web service once until all request tasks are completed. The report includes whether each request is successful and the time taken for each request.
这里,如图5所示,为测试管理WEB服务收到上报数据后,统计汇总数据并更新的详情的后台数据,其中至少包括执行机器数、已执行数、成功数、失败数、总执行时长、平均耗时、QPS(Queries-per-second)即每秒查询率等数据。Here, as shown in FIG5 , after the test management WEB service receives the reported data, it summarizes the data and updates the detailed background data, which at least includes the number of execution machines, the number of executions, the number of successes, the number of failures, the total execution time, the average execution time, QPS (Queries-per-second), or the query rate per second, and other data.
根据本公开的自动化压力测试方法,压力测试开始后,压测压力测试节奏完全由待压力测试服务通知并自动完成,过程中无需测试人员干预;可以完全模拟真实不同用户发起不同参数的压力测试过程(比如答题过程中不同用户对同一题提交不同答案);还能实现自动汇总统计被压力测试的各个接口的性能。According to the automated stress testing method disclosed in the present invention, after the stress test starts, the stress test rhythm is completely notified by the stress test service and completed automatically, and no tester intervention is required during the process; the stress testing process with different parameters initiated by different real users can be fully simulated (for example, different users submit different answers to the same question during the test process); and the performance of each interface under stress test can be automatically summarized and counted.
应该理解的是,虽然附图的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,其可以以其他的顺序执行。而且,附图的流程图中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,其执行顺序也不必然是依次进行,而是可以与其他步骤或者其他步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
自动化压力测试装置Automated pressure testing device
为了实现本公开实施例中的技术方案,本公开的一个实施例提供了一种自动化压力测试装置,如图6所示,其例如包括测试管理模块601、测试执行模块602、消息模块603,当然自动化压力测试装置还可以包括其他功能操作模块。In order to implement the technical solution in the embodiments of the present disclosure, an embodiment of the present disclosure provides an automated stress testing device, as shown in Figure 6, which, for example, includes a test management module 601, a test execution module 602, and a message module 603. Of course, the automated stress testing device may also include other functional operation modules.
测试管理模块601,用于配置压力测试所需要的测试参数,并根据测试参数确定测试执行模块,并向测试执行模块分配压力测试任务。The test management module 601 is used to configure the test parameters required for the stress test, determine the test execution module according to the test parameters, and allocate the stress test task to the test execution module.
在一个或多个实施例中,例如测试管理模块601还用于根据执行结果与预设期望返回结果确定测试执行模块的性能。In one or more embodiments, for example, the test management module 601 is also used to determine the performance of the test execution module according to the execution result and the preset expected return result.
这里,测试管理模块601例如可以实现上述方法中的S21-S24步骤或其他步骤中的相应功能或技术方案,这里不再赘述。Here, the test management module 601 can, for example, implement the corresponding functions or technical solutions in steps S21-S24 or other steps in the above method, which will not be described in detail here.
测试执行模块602,用于执行压力测试任务并返回执行结果。The test execution module 602 is used to execute the stress test task and return the execution result.
这里,测试执行模块602例如可以实现上述方法中的S21-S24步骤或其他步骤中的相应功能或技术方案,这里不再赘述。Here, the test execution module 602 can, for example, implement steps S21-S24 in the above method or corresponding functions or technical solutions in other steps, which will not be described in detail here.
消息模块603,用于实现测试管理模块向测试执行模块发送第一消息和测试管理模块向测试执行模块发送第二消息。The message module 603 is used to implement the test management module sending a first message to the test execution module and the test management module sending a second message to the test execution module.
这里,消息模块603例如可以实现上述方法中的S21-S24步骤或其他步骤中的相应功能或技术方案,这里不再赘述。Here, the message module 603 can, for example, implement the corresponding functions or technical solutions in steps S21-S24 or other steps in the above method, which will not be repeated here.
应该理解的是,虽然附图的框图中的每个方框可以代表一个模块,该模块的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令,但是这些模块并不是必然按照顺序依次执行。本公开中装置实施例中的各模块及功能单元可以集成在一个处理模块中,也可以是各个单元单独物理存在,也可以两个或两个以上的模块或功能单元集成在一个模块中。上述集成的各个模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。上述提到的存储介质可以是只读存储器,磁盘或光盘等。It should be understood that, although each box in the block diagram of the accompanying drawings may represent a module, a part of which contains one or more executable instructions for implementing a specified logical function, these modules are not necessarily executed in sequence. The modules and functional units in the device embodiments disclosed herein may be integrated into a processing module, or each unit may exist physically separately, or two or more modules or functional units may be integrated into one module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules. If the integrated modules are implemented in the form of software functional modules and sold or used as independent products, they may also be stored in a computer-readable storage medium. The above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
计算机设备Computer equipment
下面参考图7,其示出了适于用来实现本公开实施例的计算机设备的结构示意图。本公开实施例中的计算机设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。Referring to Figure 7, a schematic diagram of the structure of a computer device suitable for implementing the embodiment of the present disclosure is shown below. The computer device in the embodiment of the present disclosure is only an example and should not bring any limitation to the function and scope of use of the embodiment of the present disclosure.
如图7所示,电子设备700可以包括处理装置(例如中央处理器、图形处理器等)701,用于控制电子设备的整体操作。处理装置可以包括一个或多个处理器来执行指令,以完成上述的方法的全部或部分步骤。此外,处理装置701还可以包括一个或多个模块,用于处理和其他装置之间的交互。As shown in FIG7 , the electronic device 700 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 701 for controlling the overall operation of the electronic device. The processing device may include one or more processors to execute instructions to complete all or part of the steps of the above method. In addition, the processing device 701 may also include one or more modules for processing and interacting with other devices.
存储装置702用于存储各种类型的数据,存储装置702可以是包括各种类型的计算机可读存储介质或者它们的组合,例如可以是电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。The storage device 702 is used to store various types of data. The storage device 702 may include various types of computer-readable storage media or combinations thereof, such as electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or components, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with 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 thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that may be used by or in conjunction with an instruction execution system, device, or component.
传感器装置703,用于感受规定的被测量的信息并按照一定的规律转换成可用输出信号,可以包括一个或多个传感器。例如,其可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器等,用于检测电子设备的打开/关闭状态、相对定位、加速/减速、温度、湿度和光线等的变化。The sensor device 703 is used to sense the specified measured information and convert it into a usable output signal according to a certain rule, and may include one or more sensors. For example, it may include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor, etc., for detecting changes in the opening/closing state, relative positioning, acceleration/deceleration, temperature, humidity and light of the electronic device.
处理装置701、存储装置702以及传感器装置703通过总线704彼此相连。输入/输出(I/O)接口705也连接至总线704。The processing device 701 , the storage device 702 , and the sensor device 703 are connected to each other via a bus 704 . An input/output (I/O) interface 705 is also connected to the bus 704 .
多媒体装置706可以包括触摸屏、触摸板、键盘、鼠标、摄像头、麦克风等的输入装置用以接收来自用户的输入信号,在各种输入装置可以与上述传感器装置703的各种传感器配合完成例如手势操作输入、图像识别输入、距离检测输入等;多媒体装置706还可以包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置。The multimedia device 706 may include input devices such as a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, etc. for receiving input signals from a user. The various input devices may cooperate with the various sensors of the above-mentioned sensor device 703 to complete, for example, gesture operation input, image recognition input, distance detection input, etc. The multimedia device 706 may also include output devices such as a liquid crystal display (LCD), a speaker, a vibrator, etc.
电源装置707,用于为电子设备中的各种装置提供电力,可以包括电源管理系统、一个或多个电源及为其他装置分配电力的组件。The power supply device 707 is used to provide power to various devices in the electronic device, and may include a power management system, one or more power supplies, and components for distributing power to other devices.
通信装置708,可以允许电子设备700与其他设备进行无线或有线通信以交换数据。The communication device 708 may allow the electronic device 700 to communicate with other devices wirelessly or by wire to exchange data.
上述各项装置也均可以连接至I/O接口705以实现电子设备700的应用。The above-mentioned devices can also be connected to the I/O interface 705 to implement the application of the electronic device 700.
虽然图中示出了具有各种装置的电子设备,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。Although the electronic device with various devices is shown in the figure, it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置从网络上被下载和安装,或者从存储装置被安装。在该计算机程序被处理装置执行时,执行本公开实施例的方法中限定的上述功能。In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device. When the computer program is executed by a processing device, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。In the context of the present disclosure, a machine-readable medium may be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device.
要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。The computer-readable medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and/or flow chart, and the combination of the square boxes in the block diagram and/or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定。The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, constitute a limitation on the unit itself.
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。The functions described above herein may be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that may be used include, without limitation, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
根据本公开的一个或多个实施例,提供了一种自动化压力测试方法,采用了如下所述的技术方案,包括:According to one or more embodiments of the present disclosure, an automated stress testing method is provided, which adopts the following technical solution, including:
启动测试管理模块,配置所述测试管理模块中压力测试所需要的测试参数;Start the test management module and configure the test parameters required for the stress test in the test management module;
根据所述测试参数确定测试执行模块,并向所述测试执行模块分配压力测试任务;Determine a test execution module according to the test parameters, and assign a stress test task to the test execution module;
所述测试执行模块执行所述压力测试任务并返回执行结果;The test execution module executes the stress test task and returns the execution result;
根据所述执行结果与预设期望返回结果确定所述测试执行模块的性能。The performance of the test execution module is determined according to the execution result and the preset expected return result.
根据本公开的一个或多个实施例,提供了一种自动化压力测试方法,采用了如下所述的技术方案,包括:According to one or more embodiments of the present disclosure, an automated stress testing method is provided, which adopts the following technical solution, including:
所述配置所述测试管理模块中压力测试所需要的测试参数,还包括:The configuration of the test parameters required for the stress test in the test management module also includes:
添加所述测试参数并确认提交;Add the test parameters and confirm submission;
所述测试参数至少包括执行标识、总执行数、待发起请求的接口、待发起请求的接口待选参数串、期望返回结果、期望最大返回时间之一。The test parameters include at least one of an execution identifier, a total number of executions, an interface to be requested, a parameter string to be selected for the interface to be requested, an expected return result, and an expected maximum return time.
根据本公开的一个或多个实施例,提供了一种自动化压力测试方法,采用了如下所述的技术方案,包括:According to one or more embodiments of the present disclosure, an automated stress testing method is provided, which adopts the following technical solution, including:
所述待发起请求的接口待选参数串包括至少一个,每个所述待选参数串不重复,且每个所述待选参数串指定选中概率;The interface parameter string to be selected for the request to be initiated includes at least one, each of the parameter strings to be selected is not repeated, and each of the parameter strings to be selected specifies a probability of selection;
所述待选参数串的个数根据实际被压力测试接口可选参数值的可选种类确定。The number of the parameter strings to be selected is determined according to the optional types of optional parameter values of the actual stress-tested interface.
根据本公开的一个或多个实施例,提供了一种自动化压力测试方法,采用了如下所述的技术方案,包括:According to one or more embodiments of the present disclosure, an automated stress testing method is provided, which adopts the following technical solution, including:
所述根据所述测试参数确定测试执行模块,并向所述测试执行模块分配压力测试任务,包括:The step of determining a test execution module according to the test parameters and assigning a stress test task to the test execution module includes:
所述测试管理模块向所述测试执行模块发送第一消息;The test management module sends a first message to the test execution module;
所述测试执行模块接收所述第一消息后请求所述测试管理模块的签到接口;After receiving the first message, the test execution module requests the check-in interface of the test management module;
所述测试管理模块根据收到的请求数量向所述测试执行模块分配所述压力测试任务。The test management module allocates the stress test task to the test execution module according to the number of requests received.
根据本公开的一个或多个实施例,提供了一种自动化压力测试方法,采用了如下所述的技术方案,包括:According to one or more embodiments of the present disclosure, an automated stress testing method is provided, which adopts the following technical solution, including:
所述测试执行模块执行所述压力测试任务并返回执行结果,包括:The test execution module executes the stress test task and returns the execution result, including:
所述测试管理模块向所述测试执行模块发送第二消息;The test management module sends a second message to the test execution module;
所述测试执行模块接收所述第二消息后根据预设任务区间生成与所述任务区间对应唯一的虚拟用户;After receiving the second message, the test execution module generates a unique virtual user corresponding to the task interval according to the preset task interval;
所述测试执行模块根据自身所在服务器性能,对待测试的服务发起并发请求;The test execution module initiates concurrent requests to the service to be tested according to the performance of the server where it is located;
所述并发请求中至少包括虚拟用户信息、预设对应标识的接口和根据预设概率随机选中的参数串。The concurrent request at least includes virtual user information, an interface with a preset corresponding identifier, and a parameter string randomly selected according to a preset probability.
根据本公开的一个或多个实施例,提供了一种自动化压力测试方法,采用了如下所述的技术方案,According to one or more embodiments of the present disclosure, an automated stress testing method is provided, which adopts the following technical solution:
所述根据所述执行结果与预设期望返回结果确定所述测试执行模块的性能,包括:Determining the performance of the test execution module according to the execution result and a preset expected return result includes:
将所述并发请求的返回结果与预设期望返回结果进行匹配,并比较请求消耗时间是否在预设期望最大返回时间内,若同时满足两者则所述自动化压力测试成功。The return result of the concurrent request is matched with the preset expected return result, and the request consumption time is compared to see whether it is within the preset expected maximum return time. If both are met, the automated stress test is successful.
根据本公开的一个或多个实施例,提供了一种自动化压力测试装置,用于实现如上任一项所述的方法,采用了如下所述的技术方案,包括:According to one or more embodiments of the present disclosure, an automated pressure testing device is provided, which is used to implement any of the above methods, and adopts the following technical solution, including:
测试管理模块,用于配置所述压力测试所需要的测试参数,并根据所述测试参数确定测试执行模块,并向所述测试执行模块分配压力测试任务;A test management module, used to configure the test parameters required for the stress test, determine the test execution module according to the test parameters, and assign the stress test task to the test execution module;
测试执行模块,用于执行所述压力测试任务并返回执行结果,The test execution module is used to execute the stress test task and return the execution result.
所述测试管理模块还用于根据所述执行结果与预设期望返回结果确定所述测试执行模块的性能。The test management module is also used to determine the performance of the test execution module according to the execution result and the preset expected return result.
根据本公开的一个或多个实施例,提供了一种自动化压力测试装置,采用了如下所述的技术方案,包括:According to one or more embodiments of the present disclosure, an automated pressure testing device is provided, which adopts the following technical solution, including:
还包括消息模块,用于实现所述测试管理模块向所述测试执行模块发送第一消息和所述测试管理模块向所述测试执行模块发送第二消息。It also includes a message module, which is used to enable the test management module to send a first message to the test execution module and the test management module to send a second message to the test execution module.
根据本公开的一个或多个实施例,提供了一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器执行所述计算机程序时实现如前任一项所述的方法。According to one or more embodiments of the present disclosure, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method described in any one of the preceding items is implemented.
根据本公开的一个或多个实施例,提供了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如前任一项所述的方法。According to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method described in any of the preceding items is implemented.
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) to form a technical solution.
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。Although the subject matter has been described in language specific to structural features and/or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410725663.3A CN118312440A (en) | 2024-06-05 | 2024-06-05 | Automated stress testing method, device, equipment, and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410725663.3A CN118312440A (en) | 2024-06-05 | 2024-06-05 | Automated stress testing method, device, equipment, and readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN118312440A true CN118312440A (en) | 2024-07-09 |
Family
ID=91724194
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410725663.3A Pending CN118312440A (en) | 2024-06-05 | 2024-06-05 | Automated stress testing method, device, equipment, and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118312440A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN119149438A (en) * | 2024-11-18 | 2024-12-17 | 苏州吉呗思数据技术有限公司 | Distributed database stability testing method and device, electronic equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108900382A (en) * | 2018-07-18 | 2018-11-27 | 腾讯科技(深圳)有限公司 | Test method and its device |
CN113609026A (en) * | 2021-08-20 | 2021-11-05 | 盐城金堤科技有限公司 | Method and device for pressure testing of server |
CN116302989A (en) * | 2023-02-16 | 2023-06-23 | 平安壹钱包电子商务有限公司 | Pressure testing method and system, storage medium and computer equipment |
-
2024
- 2024-06-05 CN CN202410725663.3A patent/CN118312440A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108900382A (en) * | 2018-07-18 | 2018-11-27 | 腾讯科技(深圳)有限公司 | Test method and its device |
CN113609026A (en) * | 2021-08-20 | 2021-11-05 | 盐城金堤科技有限公司 | Method and device for pressure testing of server |
CN116302989A (en) * | 2023-02-16 | 2023-06-23 | 平安壹钱包电子商务有限公司 | Pressure testing method and system, storage medium and computer equipment |
Non-Patent Citations (2)
Title |
---|
张观石: "SRE原理与实践 构建高可靠性互联网应用", 31 January 2023, 北京:机械工业出版社, pages: 86 - 91 * |
陈孟婕 等: "基于LoadRunner的Web考试系统性能测试与优化", 中国农学通报, no. 34, 5 December 2014 (2014-12-05), pages 261 - 267 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN119149438A (en) * | 2024-11-18 | 2024-12-17 | 苏州吉呗思数据技术有限公司 | Distributed database stability testing method and device, electronic equipment and storage medium |
CN119149438B (en) * | 2024-11-18 | 2025-04-22 | 苏州吉呗思数据技术有限公司 | Distributed database stability testing method and device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107423085B (en) | Method and apparatus for deploying applications | |
CN113392018B (en) | Traffic distribution method and device, storage medium and electronic equipment | |
CN111340220A (en) | Method and apparatus for training a predictive model | |
CN111259066A (en) | Server cluster data synchronization method and device | |
CN110795328A (en) | Interface testing method and device | |
WO2024188197A1 (en) | Virtual resource processing method and apparatus, device, storage medium, and program product | |
CN118312440A (en) | Automated stress testing method, device, equipment, and readable storage medium | |
CN112925623B (en) | Task processing method, device, electronic equipment and medium | |
CN113760230B (en) | Business processing method and device | |
WO2021043066A1 (en) | Communication method and apparatus for multiple management domains | |
CN111813407B (en) | Game development method, game running device and electronic equipment | |
CN112131095B (en) | Pressure testing method and device | |
CN115794262A (en) | Task processing method, device, equipment, storage medium and program product | |
CN111782502A (en) | Automatic testing method and device | |
CN113434384B (en) | Pressure testing method and device | |
CN112925721A (en) | Distributed system testing method and device | |
CN112152879A (en) | Network quality determination method and device, electronic equipment and readable storage medium | |
US20230063599A1 (en) | Edge computing network, data transmission method and apparatus, device and storage medium | |
CN115599651A (en) | Application system testing method and device, electronic equipment and storage medium | |
CN115914375A (en) | Disaster recovery processing method and device for distributed message platform | |
CN115022328A (en) | Server cluster, server cluster testing method and device and electronic equipment | |
CN111368190B (en) | Information recommendation method and device | |
CN112311833B (en) | Data updating method and device | |
CN111831531B (en) | Test method and device | |
CN111338916A (en) | Method, apparatus, electronic device, and computer-readable medium for processing a service request |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20240709 |