CN107395453B - Background service pressure test method and device - Google Patents

Background service pressure test method and device Download PDF

Info

Publication number
CN107395453B
CN107395453B CN201710533089.1A CN201710533089A CN107395453B CN 107395453 B CN107395453 B CN 107395453B CN 201710533089 A CN201710533089 A CN 201710533089A CN 107395453 B CN107395453 B CN 107395453B
Authority
CN
China
Prior art keywords
dispatching
request
service
result
tested
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.)
Active
Application number
CN201710533089.1A
Other languages
Chinese (zh)
Other versions
CN107395453A (en
Inventor
简仁贤
许�鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Emotibot Technologies Ltd
Original Assignee
Emotibot Technologies Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Emotibot Technologies Ltd filed Critical Emotibot Technologies Ltd
Priority to CN201710533089.1A priority Critical patent/CN107395453B/en
Publication of CN107395453A publication Critical patent/CN107395453A/en
Application granted granted Critical
Publication of CN107395453B publication Critical patent/CN107395453B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3648Software debugging using additional hardware
    • G06F11/3656Software debugging using additional hardware using a specific debug interface
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0817Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning

Abstract

The invention relates to the technical field of network testing, in particular to a background service pressure testing method and a device, wherein the method comprises the following steps: customizing configuration items in the configuration file; generating a dispatching request according to the configuration file and putting the dispatching request into a dispatching queue; reading a dispatching request from the dispatching queue, and dispatching the dispatching request to a service to be tested; and acquiring pressure test data returned by the service to be tested to obtain a pressure test result. The background service pressure testing method and the background service pressure testing device provided by the invention can be conveniently adapted to various background service interfaces through custom configuration, and can be used for measuring the pressure condition of the background service and finding the problem of service performance.

Description

Background service pressure test method and device
Technical Field
The invention relates to the technical field of network testing, in particular to a background service pressure testing method and device.
Background
Today in the internet era, behind each web or app service is a myriad of background services that provide the underlying technical support, and these background services often need to face tremendous pressure from the network. The existing pressure test tools have various problems, part of the tools can only be applied to http interfaces, part of the tools such as Apache Bench can only send a few types of requests, part of the tools can not send enough pressure to test extreme conditions, and part of the tools can only judge whether response is successful according to a return code. To sum up, the existing pressure testing tools have the following defects:
(1) the applicable interface is single;
(2) part of the test tools can only serve a few types of requests;
(3) the test pressure provided is not high enough;
(4) some tools can only determine if the response was successful based on the return code.
The main reasons for the above problems derive from: the internet backend technology relates to a plurality of technical types and complex routes, and technical personnel usually develop a 'field-specific' or 'problem-specific' tool according to actual conditions, so that a general stress testing tool irrelevant to background service types is urgently needed.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides a background service pressure testing method and device, which can be conveniently adapted to various background service interfaces through custom configuration, measure the pressure condition of the background service and find the problem of service performance.
In a first aspect, the present invention provides a background service stress testing method, including:
customizing configuration items in the configuration file;
generating a dispatching request according to the configuration file and putting the dispatching request into a dispatching queue;
reading a dispatching request from the dispatching queue, and dispatching the dispatching request to a service to be tested;
and acquiring pressure test data returned by the service to be tested to obtain a pressure test result.
Preferably, the configuration items in the configuration file include concurrency number, total number of requests, and service address to be tested.
Preferably, the generating a dispatch request according to the configuration file and placing the dispatch request into a dispatch queue includes:
constructing a request mode to be dispatched in a Data file according to the configuration file;
and constructing a dispatching request according to the to-be-dispatched request mode in the Data file, and putting the dispatching request into a dispatching queue.
Preferably, the obtaining of the pressure test data returned by the service to be tested to obtain a pressure test result includes: and acquiring pressure test data returned by the service to be tested, and checking logic to process the pressure test data and the pressure test result according to the result in the script file.
Preferably, before the dispatch request is sent, the method further comprises: and storing the custom result checking logic into a script file.
In a second aspect, the present embodiment provides a background service stress testing apparatus, including:
the user-defined configuration module is used for customizing configuration items in the configuration file;
the dispatching request generating module is used for generating dispatching requests according to the configuration files and putting the dispatching requests into a dispatching queue;
the dispatching module is used for reading a dispatching request from the dispatching queue and dispatching the dispatching request to a service to be tested;
and the result analysis module is used for acquiring the pressure test data returned by the service to be tested to obtain a pressure test result.
Preferably, the configuration items in the configuration file include concurrency number, total number of requests, and service address to be tested.
Preferably, the dispatch request generating module is specifically configured to:
constructing a request mode to be dispatched in a Data file according to the configuration file;
and constructing a dispatching request according to the to-be-dispatched request mode in the Data file, and putting the dispatching request into a dispatching queue.
Preferably, the result analysis module is specifically configured to: and acquiring pressure test data returned by the service to be tested, and checking logic to process the pressure test data and the pressure test result according to the result in the script file.
Preferably, the custom configuration module is specifically configured to store the custom result checking logic in a Scripts file.
The method and the device provided by the embodiment support the self-defined pressure parameters, the self-defined protocol and the self-defined result check logic, can construct the pressure test behavior in a self-defined mode, can distribute the pressure up to 4wqps, can conveniently check the test result and troubleshoot the problems of service.
Drawings
FIG. 1 illustrates a flow diagram of background service stress testing provided by an embodiment of the invention;
fig. 2 shows a block diagram of a background service stress test provided by an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings. The following examples are only for illustrating the technical solutions of the present invention more clearly, and therefore are only examples, and the protection scope of the present invention is not limited thereby.
It is to be noted that, unless otherwise specified, technical or scientific terms used herein shall have the ordinary meaning as understood by those skilled in the art to which the invention pertains.
The stress test of the background service means that: taking testing a web service as an example, a large number of users are simulated to access the service, and a high load is generated on the web service, and in this high load situation, the performance of the web service is tested by detecting some parameters in the web service.
As shown in fig. 1, the background service stress testing method provided in this embodiment includes:
and step S1, customizing the configuration items in the configuration file.
And the configuration item is configured according to the interface protocol to be tested. For example, testing an interface of the HTTP-Post protocol requires configuring global.
And step S2, generating a dispatching request according to the configuration file and putting the dispatching request into a dispatching queue.
And step S3, reading the dispatching request from the dispatching queue, and dispatching the dispatching request to the service to be tested.
And step S4, acquiring pressure test data returned by the service to be tested to obtain a pressure test result.
The background service pressure testing method provided by the embodiment can construct a pressure testing behavior in a user-defined mode, can distribute pressure up to 4wqps, can conveniently adapt to various types of background service interfaces through user-defined configuration, measures the pressure condition of the background service, and finds the service performance problem.
The configuration items in the configuration file comprise concurrency number, total number of requests and service addresses to be tested.
Wherein the concurrency number refers to the number of threads which are simultaneously used for distributing pressure in the pressure tool test. The parameter simulation is carried out on the number of clients simultaneously accessing the tested interface in the real environment.
The total request number refers to the total number of times of accessing the tested interface in the experimental process.
The service address to be tested refers to the interface service address to be subjected to the pressure test.
The preferred embodiment of step S2 includes:
and step S21, constructing the request mode to be dispatched in the Data file according to the configuration file.
And step S22, constructing a dispatching request according to the to-be-dispatched request mode in the Data file, and putting the dispatching request into a dispatching queue.
Wherein the dispatch requests are constructed according to different protocols, respectively. For example, for the HTTP-GET protocol: and assembling the global.targetaddr configuration item in the configuration file and the data in the data file to form a request address URL. As another example, for the HTTP-POST protocol: the request address is a global.
The preferred embodiment of step S4 includes: and acquiring pressure test data returned by the service to be tested, and checking logic to process the pressure test data and the pressure test result according to the result in the script file.
Wherein, before step S3, the method further includes: and storing the custom result checking logic into a script file.
For example, the workload of a programmer is reduced, the result checking logic is divided into a custom part and a template part, the custom part of the result checking logic is embedded into a pre-established result checking logic template in a dynamic script mode, and the obtained result checking logic is stored in a script file. For example, the dynamic script is a groovy script, which can give the java dynamic property, that is, the user can modify the custom result check logic without recompiling the test tool. By the mode, the user can conveniently realize the customized result check logic by rewriting the dynamic script.
Wherein the result checking logic specifies which type of data to obtain from the returned stress test data and what to make a determination based on the obtained data. The following are two examples of result checking logic, (1) check if the network layer error code of the result is correct, such as an http return code; (2) the application layer content of the result is checked for correctness by techniques such as MD 5.
The protocol application layer defined by the user has a special error code value, and a general pressure testing tool does not support the definition result check logic, so that the performance of background service reflected by the error code can be analyzed only afterwards in a more complex mode. By the method of the embodiment, the user can conveniently self-define the performance of the result checking logic for identifying the request of the special errorCode.
The method provided by the embodiment is written by using a scala language, and Groovy is used as a system customization script language, so that the flexibility and the system operation efficiency are considered. And dynamically loading the configuration file and the custom script by the runtime system, and sending a specified concurrent pressure test to the tested service according to the custom logic. The dynamic expansibility is increased on the basis of the high performance of the Scala, and the user can conveniently define the protocol and the result checking logic on the premise of ensuring the system performance.
The method provided by the embodiment supports the self-defined pressure parameters, the self-defined protocol and the self-defined result check logic, can construct the pressure test behavior in a self-defined mode, can distribute the pressure up to 4wqps, can conveniently check the test result and troubleshoot the problems of service.
Based on the same concept as the background service stress test method, this embodiment further provides a background service stress test apparatus, as shown in fig. 2, including:
the user-defined configuration module is used for customizing configuration items in the configuration file;
the dispatching request generating module is used for generating dispatching requests according to the configuration files and putting the dispatching requests into a dispatching queue;
the dispatching module is used for reading a dispatching request from the dispatching queue and dispatching the dispatching request to a service to be tested;
and the result analysis module is used for acquiring the pressure test data returned by the service to be tested to obtain a pressure test result.
The background service pressure testing device provided by the embodiment can construct a pressure testing behavior in a user-defined mode, can distribute pressure up to 4wqps, can conveniently adapt to various types of background service interfaces through user-defined configuration, measures the pressure condition of the background service, and finds the service performance problem.
The configuration items in the configuration file comprise concurrency number, total number of requests and service addresses to be tested.
Wherein the dispatch request generation module is specifically configured to:
constructing a request mode to be dispatched in a Data file according to the configuration file;
and constructing a dispatching request according to the to-be-dispatched request mode in the Data file, and putting the dispatching request into a dispatching queue.
Wherein the result analysis module is specifically configured to: and acquiring pressure test data returned by the service to be tested, and checking logic to process the pressure test data and the pressure test result according to the result in the script file.
The user-defined configuration module is specifically used for storing user-defined result checking logic into the Scripts file.
The device provided by the embodiment supports the self-defined pressure parameters, the self-defined protocol and the self-defined result check logic, can construct a pressure test behavior in a self-defined mode, can distribute pressure up to 4wqps, can conveniently check a test result and troubleshoot problems in service.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the present invention, and they should be construed as being included in the following claims and description.

Claims (6)

1. A background service stress test method is characterized by comprising the following steps:
customizing a configuration item in the configuration file, wherein the configuration item is configured according to an interface protocol to be tested;
generating a dispatching request according to the configuration file and putting the dispatching request into a dispatching queue;
the user-defined result checking logic is stored in a script file;
reading a dispatching request from the dispatching queue, and dispatching the dispatching request to a service to be tested;
acquiring pressure test data returned by the service to be tested to obtain a pressure test result;
the background service pressure testing method is compiled by using a scala language, and Groovy is used as a system customization script language;
wherein, the user-defined result checking logic is stored in the Scripts file, and the method specifically comprises the following steps:
dividing the result checking logic into a user-defined part and a template part, embedding the user-defined part of the result checking logic into a pre-established result checking logic template in a dynamic script mode to obtain result checking logic, and storing the result checking logic into a script file;
the generating a dispatching request according to the configuration file and putting the dispatching request into a dispatching queue comprises the following steps:
constructing a request mode to be dispatched in a Data file according to the configuration file;
and constructing a dispatching request according to the to-be-dispatched request mode in the Data file, and putting the dispatching request into a dispatching queue, wherein the dispatching requests are respectively constructed according to different protocols.
2. The method of claim 1, wherein the configuration items in the configuration file comprise concurrency number, total number of requests, and service address to be tested.
3. The method according to claim 1, wherein the obtaining of the pressure test data returned by the service to be tested to obtain the pressure test result comprises:
and acquiring pressure test data returned by the service to be tested, and checking logic to process the pressure test data and the pressure test result according to the result in the script file.
4. A background service stress testing apparatus, comprising:
the user-defined configuration module is used for customizing configuration items in the configuration file, wherein the configuration items are configured according to the interface protocol to be tested; storing the custom result checking logic into a script file, which specifically comprises the following steps: dividing the result checking logic into a user-defined part and a template part, embedding the user-defined part of the result checking logic into a pre-established result checking logic template in a dynamic script mode to obtain result checking logic, and storing the result checking logic into a script file;
a dispatch request generation module, configured to generate a dispatch request according to the configuration file and place the dispatch request in a dispatch queue, and specifically configured to:
constructing a request mode to be dispatched in a Data file according to the configuration file;
constructing a dispatching request according to the to-be-dispatched request mode in the Data file, and putting the dispatching request into a dispatching queue;
the dispatching module is used for reading a dispatching request from the dispatching queue and dispatching the dispatching request to a service to be tested;
the result analysis module is used for acquiring pressure test data returned by the service to be tested to obtain a pressure test result;
the background service pressure testing device is written by using a scala language, and Groovy is used as a system customization script language.
5. The apparatus of claim 4, wherein the configuration items in the configuration file comprise concurrency number, total number of requests, and service address to be tested.
6. The apparatus of claim 4, wherein the result analysis module is specifically configured to: and acquiring pressure test data returned by the service to be tested, and checking logic to process the pressure test data and the pressure test result according to the result in the script file.
CN201710533089.1A 2017-07-03 2017-07-03 Background service pressure test method and device Active CN107395453B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710533089.1A CN107395453B (en) 2017-07-03 2017-07-03 Background service pressure test method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710533089.1A CN107395453B (en) 2017-07-03 2017-07-03 Background service pressure test method and device

Publications (2)

Publication Number Publication Date
CN107395453A CN107395453A (en) 2017-11-24
CN107395453B true CN107395453B (en) 2021-05-11

Family

ID=60334275

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710533089.1A Active CN107395453B (en) 2017-07-03 2017-07-03 Background service pressure test method and device

Country Status (1)

Country Link
CN (1) CN107395453B (en)

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6047389A (en) * 1997-09-30 2000-04-04 Alcatel Usa Sourcing, L.P. Testing of a software application residing on a hardware component
CN101488085A (en) * 2008-01-17 2009-07-22 中兴通讯股份有限公司 Software interface test method and apparatus
US9430345B2 (en) * 2011-09-23 2016-08-30 Roche Diabetes Care, Inc. Command interface for communication test framework
CN102368227A (en) * 2011-10-13 2012-03-07 福建天晴数码有限公司 Method for generating performance test scripts based on server interfaces
CN102866944B (en) * 2012-06-12 2015-04-29 中国联合网络通信集团有限公司 Pressure testing system and method
CN105335293B (en) * 2015-11-30 2019-08-30 努比亚技术有限公司 A kind of automatization test system and method based on interface concurrent
CN106201878B (en) * 2016-07-08 2018-11-30 百度在线网络技术(北京)有限公司 The execution method and apparatus of test program
CN106776280B (en) * 2016-11-24 2020-10-16 上海携程商务有限公司 Configurable performance testing device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
scala+groovy实现web项目的动态功能扩展;george_zen;《CSDN博客》;20160304;第2页 *

Also Published As

Publication number Publication date
CN107395453A (en) 2017-11-24

Similar Documents

Publication Publication Date Title
CN109302522B (en) Test method, test device, computer system, and computer medium
US7600220B2 (en) Extensible execution language
WO2022016847A1 (en) Automatic test method and device applied to cloud platform
US10545847B2 (en) Grouping and isolating software changes to increase build quality
KR20140072726A (en) Function Test Apparatus based on Unit Test Cases Reusing and Function Test Method thereof
Soldani et al. The μTOSCA toolchain: Mining, analyzing, and refactoring microservice‐based architectures
EP2095236A2 (en) Method, system and computer program for testing software applications based on multiple data sources
CN107704369B (en) Operation log recording method, electronic device, storage medium and system
CN108459850B (en) Method, device and system for generating test script
CN111290941A (en) Method and device for testing multiple interfaces, computing equipment and medium
CN112463588A (en) Automatic test system and method, storage medium and computing equipment
Zhang et al. Environmental modeling for automated cloud application testing
CN110851471A (en) Distributed log data processing method, device and system
CN112732499A (en) Test method and device based on micro-service architecture and computer system
CN113238965B (en) Interface test script generation method, system and storage medium
TWI626538B (en) Infrastructure rule generation
KR20070104202A (en) Automation test service system for view software of portable telephone and method thereof
CN107395453B (en) Background service pressure test method and device
CN109274533B (en) Web service fault positioning device and method based on rule engine
Husufa et al. Optimizing JMeter on performance testing using the bulk data method
CN110618943B (en) Security service test method and device, electronic equipment and readable storage medium
CN114238140A (en) Access test method and device
CN114238129A (en) Method, device and equipment for generating interface data and storage medium
CN113407440B (en) Testing system and method for wireless communication module
KR102111392B1 (en) Test unified administration system and Controlling Method for the Same

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
GR01 Patent grant
GR01 Patent grant