CN112765004B - Automatic and self-adaptive interface performance test method - Google Patents

Automatic and self-adaptive interface performance test method Download PDF

Info

Publication number
CN112765004B
CN112765004B CN202110065942.8A CN202110065942A CN112765004B CN 112765004 B CN112765004 B CN 112765004B CN 202110065942 A CN202110065942 A CN 202110065942A CN 112765004 B CN112765004 B CN 112765004B
Authority
CN
China
Prior art keywords
interface
test
target
target test
service
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
CN202110065942.8A
Other languages
Chinese (zh)
Other versions
CN112765004A (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.)
Rizhao Ruian Information Technology Co ltd
Beijing Rich Information Technology Co ltd
Original Assignee
Rizhao Ruian Information Technology Co ltd
Beijing Rich Information Technology Co 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 Rizhao Ruian Information Technology Co ltd, Beijing Rich Information Technology Co ltd filed Critical Rizhao Ruian Information Technology Co ltd
Priority to CN202110065942.8A priority Critical patent/CN112765004B/en
Publication of CN112765004A publication Critical patent/CN112765004A/en
Application granted granted Critical
Publication of CN112765004B publication Critical patent/CN112765004B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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
    • G06F11/3414Workload generation, e.g. scripts, playback
    • 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/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging

Abstract

The invention discloses an automatic and self-adaptive interface performance testing method, which comprises the following steps: establishing a service script for testing in any network environment, and requesting a testing interface of a target by using the service script; when the interface test is carried out, the service script needs to select to carry out custom configuration or default configuration; opening a custom configuration or default configuration test request interface of a service script in the current network environment; and receiving a test result, and analyzing and judging the overall state and performance condition of the target service through the test data. The test interface can be used for obtaining test results more quickly and more accurately and performing performance analysis on the test results; the test time cost and the deployment cost are greatly reduced, and the threshold of interface performance test is lowered.

Description

Automatic and self-adaptive interface performance test method
Technical Field
The invention relates to the technical field of computer testing, in particular to an automatic and self-adaptive interface performance testing method.
Background
In the prior art, the QPS/TPS performance of the test interface often needs to be tested by using a third party tool, the third party test tool is installed in an intranet environment or some special network environments, and the customized configuration brings great additional cost, so that developers and users have poor experience.
At present, a common open source testing tool cannot perform high-efficiency testing in a complex environment, lacks clear report description, is difficult to intuitively display the optimal performance of each concurrent interface, often tests the performance condition of one interface under multiple concurrencies, needs to perform multiple tests, and records the test results of each time respectively, wherein the condition cannot meet the user requirements under each scene.
For the problems in the related art, no effective solution has been proposed at present.
Disclosure of Invention
Aiming at the technical problems in the related art, the invention provides an automatic and self-adaptive interface performance testing method, solves the problems of automatic and self-adaptive interface performance testing in a complex environment, reduces testing cost, improves testing efficiency, and can overcome the defects in the prior art.
In order to achieve the technical purpose, the technical scheme of the invention is realized as follows: an automatic and self-adaptive interface performance test method comprises the following steps:
S1, establishing a service script for testing in any network environment, wherein the service script is registered with a pressure test interface;
s2, requesting a test interface of a target by using the service script;
s3, when the interface test is carried out, the service script needs to select to carry out custom configuration or default configuration;
S4, opening a custom configuration or default configuration test request interface of a service script in the current network environment;
S41, if the custom configuration is selected, the specific steps of the custom configuration include:
S411, setting configuration parameters required by a target test interface, wherein the configuration parameters comprise a target interface name, a target interface call address, a target interface request body, a specified press-test line number of the target interface and a specified single-line layer cycle number of the target interface;
S412, after confirming the parameters of the target test interface, the service script calls the target interface, and pressure test is carried out until the target interface is stopped according to the configuration parameters of S32, and the target interface and the service script are always in a connection state in the pressure test process;
S42, if the default configuration is selected, the specific steps of the default configuration include:
s421, calling a default test case matched with the test interface, and limiting the concurrency total according to a threshold value filled in by first registration;
S422, performing pressure test of each round with the thread number of 2 n until the thread number exceeds the thread threshold value configured during registration, and stopping the pressure test of the target test interface;
s5, receiving the test result, and analyzing and judging the overall state and performance condition of the target service through the test data.
Further, in S1, the relevant information to be provided by the registration is an interface ID, an interface name, an interface description, an interface request address, an interface type, a concurrency threshold of the interface, and version information of the interface.
Further, the whole framework of the service script program is SpringBoot, and the service whole is deployed on the Kubernetes cluster.
Further, the service script is also provided with a log recording module and a statistical analysis module.
Further, in S4, the test request interface parameters configured by the user include: interface address, interface name, concurrent thread number, interface cycle number and interface request message.
Further, in S5, the custom pressure test interface return parameters include: interface address, number of concurrent threads, number of interface cycles, interface request message, average return time of success or failure status, and average QPS of success or failure status.
Further, in S5, the default pressure test interface return parameters include: interface address, number of concurrent threads, number of interface cycles, average return time of success or failure status, average QPS of success or failure status, single test status, and single return data.
Further, when the single test state fails, a single piece of return data returns exception information.
Further, in S5, the test result includes the overall state of the test, the average time of success or failure of the target interface, and the QPS of success or failure of the target interface.
The invention has the beneficial effects that: the test interface can be used for obtaining test results more quickly and more accurately and performing performance analysis on the test results; the test time cost and the deployment cost are greatly reduced, and the threshold of interface performance test is lowered.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart diagram of an automated, adaptive interface performance testing method according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which are derived by a person skilled in the art based on the embodiments of the invention, fall within the scope of protection of the invention.
As shown in fig. 1, an automatic and adaptive interface performance testing method according to an embodiment of the present invention includes the following steps:
S1, establishing a service script for testing in any network environment, wherein the service script is registered with a pressure test interface;
s2, requesting a test interface of a target by using the service script;
s3, when the interface test is carried out, the service script needs to select to carry out custom configuration or default configuration;
S4, opening a custom configuration or default configuration test request interface of a service script in the current network environment;
S41, if the custom configuration is selected, the specific steps of the custom configuration include:
S411, setting configuration parameters required by a target test interface, wherein the configuration parameters comprise a target interface name, a target interface call address, a target interface request body, a specified press-test line number of the target interface and a specified single-line layer cycle number of the target interface;
S412, after confirming the parameters of the target test interface, the service script calls the target interface, and pressure test is carried out until the target interface is stopped according to the configuration parameters of S32, and the target interface and the service script are always in a connection state in the pressure test process;
S42, if the default configuration is selected, the specific steps of the default configuration include:
s421, calling a default test case matched with the test interface, and limiting the concurrency total according to a threshold value filled in by first registration;
S422, performing pressure test of each round with the thread number of 2 n until the thread number exceeds the thread threshold value configured during registration, and stopping the pressure test of the target test interface;
s5, receiving the test result, and analyzing and judging the overall state and performance condition of the target service through the test data.
In a specific embodiment of the present invention, in S1, the relevant information to be provided by the registration is an interface ID, an interface name, an interface description, an interface request address, an interface type, a concurrency threshold of the interface, and version information of the interface.
In a specific embodiment of the present invention, the service script program overall framework is SpringBoot, and the service overall is deployed on the Kubernetes cluster.
In a specific embodiment of the present invention, the service script is further provided with a log recording module and a statistical analysis module.
In a specific embodiment of the present invention, in S4, the test request interface parameters configured in a self-defining manner include: interface address, interface name, concurrent thread number, interface cycle number and interface request message.
In one embodiment of the present invention, in S5, the custom pressure test interface return parameters include: interface address, number of concurrent threads, number of interface cycles, interface request message, average return time of success or failure status, and average QPS of success or failure status.
In one embodiment of the present invention, in S5, the default pressure test interface return parameters include: interface address, number of concurrent threads, number of interface cycles, average return time of success or failure status, average QPS of success or failure status, single test status, and single return data.
In one embodiment of the invention, a single piece of return data returns exception information when the single piece of test status fails.
In one embodiment of the present invention, in S5, the test result includes the overall state of the test, the average time of success or failure of the target interface, and the QPS of success or failure of the target interface.
In order to facilitate understanding of the above technical solutions of the present invention, the following describes the above technical solutions of the present invention in detail by a specific usage manner.
According to the automatic and self-adaptive interface performance testing method, the third-party interface is tested in a service mode, the testing interface is registered in the service, and the pressure testing interface of the target is requested in the service mode, so that the purpose of testing is achieved.
The whole framework of the program is SpringBoot, so that the additional configuration of projects is reduced, a large number of third party libraries can be conveniently integrated, and the iteration and maintenance of the service can be performed; the service is wholly deployed on the Kubernetes cluster, so that the state management, resource management and safety monitoring of the service are facilitated.
The method completes an automatic interface performance test method under any network environment, and specifically comprises the following functions; the test service provides a service script special for testing, and the service script has independence, controllability, disaster tolerance and robustness;
the test service provides autonomous registration of the test interface, and can supplement some interface related information into registration information, such as interface name or interface description and the like;
the test service has definite log record and statistical analysis, so that the number of times each interface is called and which user calls each interface can be clearly known, and the final calling result is success or failure;
the test result of the test service records the interface performance when the test is successful and the interface performance when the test is failed.
The test service provides a test mode for an external interface and a test mode meeting different requirements, and comprises the following two modes:
the first test mode is input: the user-defined pressure test can be carried out on the external interface by the user through the pressure test interface registration provided by the test service, and the related information provided by the registration is interface ID, interface name, interface description, interface request address, interface type (algorithm or system), concurrent threshold value of the interface and version information of the interface; the user can test according to the actual requirement, the test information is filled into the interface, the concurrent number and the training times are configured, and the service can perform pressure test on the target interface according to the designated configuration information.
The first test mode outputs: according to the appointed input data request interface of the user, filling in the parameters required by the test request interface, wherein the parameters mainly comprise five parts, namely a pressure test target interface name, a pressure test target interface calling address, a pressure test target interface request body, an appointed pressure test line number of threads of the pressure test target interface and an appointed single-line layer cycle number of the pressure test target interface; clicking and executing after confirming the parameters of the interface without errors, wherein the service can call the target interface at the moment, and performing pressure test according to the current configuration, so that the target interface is not interrupted as much as possible in the pressure test process; after the pressure test is completed by all threads according to the execution cycle times, the test result is returned uniformly, and finally the test result is returned in a text mode, wherein the text content comprises the integral state of the pressure test, the average time for successfully pressing the target interface, the QPS for successfully pressing the target interface and the average time for failed pressing the target interface, and a user can intuitively analyze and judge the integral state and the performance condition of the target service through the returned data.
The second test mode is input: the default test interface does not need to manually fill in information such as a target test case, a target interface name, a target interface address and the like, fills in the test case when the first registration is used, calls back the test case of membership and the test interface name and ID when the default test is performed, and limits the concurrency total according to the threshold value filled in by the first registration; and performing pressure test according to the interface set specified by the system, gradually increasing the concurrent thread number by 2 n, and stopping performing the pressure test if the thread number exceeds the threshold defined by the system.
The second test mode output: after testing according to the set of the test interfaces specified in the system, outputting a standard result file, wherein the result file is the return time of all interfaces under 2 n, the QPS value, the interface test state mark (success or failure), the thread number, the cycle number of each thread and the specific return details of the interfaces. When the interface test is completed, a test report of the current test interface is generated, and the report is named by the interface name and the current time stamp, so that the test report can be downloaded.
After the interface execution is completed, the user can download the result file of the pressure test at this time, and the result file is used as a performance judgment basis for the system interface or the algorithm interface.
In summary, by means of the technical scheme of the invention, the test interface can be used for obtaining the test result more quickly and more accurately and analyzing the performance of the test result; the test time cost and the deployment cost are greatly reduced, and the threshold of interface performance test is lowered.
The foregoing description of the preferred embodiments of the invention is not intended to be limiting, but rather is intended to cover all modifications, equivalents, alternatives, and improvements that fall within the spirit and scope of the invention.

Claims (5)

1. An automatic and self-adaptive interface performance testing method is characterized by comprising the following steps:
s1, establishing a service script for testing in any network environment, wherein the service script is registered with a target test interface,
The service script is also provided with a log recording module and a statistical analysis module;
S2, requesting a target test interface by using the service script;
s3, when the interface test is carried out, the service script needs to select to carry out custom configuration or default configuration;
s4, opening a target test interface of custom configuration or default configuration of the service script in the current network environment,
The target test interface parameters of the custom configuration comprise: interface address, interface name, concurrent thread number, interface cycle number and interface request message,
S41, if the custom configuration is selected, the specific steps of the custom configuration include:
s411, setting configuration parameters required by a target test interface, wherein the configuration parameters comprise a target test interface name, a target test interface call address, a target test interface request body, a specified test line number of the target test interface and a specified single-line layer cycle number of the target test interface;
S412, after confirming the parameters of the target test interface, the service script calls the target test interface, and pressure test is carried out according to the configuration parameters of S3 until the test is stopped, and in the pressure test process, the target test interface and the service script are always in a connection state,
S42, if the default configuration is selected, the specific steps of the default configuration include:
s421, calling a default test case matched with the target test interface, and limiting the concurrency total according to a threshold value filled in by first registration;
S422, performing pressure test of each round with the thread number of 2 n until the thread number exceeds the thread threshold value configured during registration, and stopping the pressure test of the target test interface;
s5, receiving a test result, and analyzing and judging the overall state and performance condition of the target service through test data;
in S1, the related information to be provided by the registration is an interface ID, an interface name, an interface description, an interface request address, an interface type, a concurrency threshold of the interface, and version information of the interface;
The whole framework of the service script program is SpringBoot, and the service whole is deployed on the Kubernetes cluster.
2. The automated, adaptive interface performance testing method of claim 1, wherein in S5, customizing target test interface return parameters comprises: interface address, number of concurrent threads, number of interface cycles, interface request message, average return time of success or failure status, and average QPS of success or failure status.
3. The automated, adaptive interface performance testing method of claim 1, wherein in S5, default target test interface return parameters comprise: interface address, number of concurrent threads, number of interface cycles, average return time of success or failure status, average QPS of success or failure status, single test status, and single return data.
4. An automated, adaptive interface performance testing method according to claim 3, wherein when the single test state fails, a single piece of return data returns exception information.
5. The method according to claim 1, wherein in S5, the test result includes the overall status of the test, the average time of success or failure of the target test interface, and the QPS of success or failure of the target test interface.
CN202110065942.8A 2021-01-19 2021-01-19 Automatic and self-adaptive interface performance test method Active CN112765004B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110065942.8A CN112765004B (en) 2021-01-19 2021-01-19 Automatic and self-adaptive interface performance test method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110065942.8A CN112765004B (en) 2021-01-19 2021-01-19 Automatic and self-adaptive interface performance test method

Publications (2)

Publication Number Publication Date
CN112765004A CN112765004A (en) 2021-05-07
CN112765004B true CN112765004B (en) 2024-04-26

Family

ID=75702964

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110065942.8A Active CN112765004B (en) 2021-01-19 2021-01-19 Automatic and self-adaptive interface performance test method

Country Status (1)

Country Link
CN (1) CN112765004B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102868573A (en) * 2012-09-12 2013-01-09 北京航空航天大学 Method and device for Web service load cloud test
CN106383786A (en) * 2016-09-27 2017-02-08 北京金山安全软件有限公司 Interface pressure performance testing method and device and electronic equipment
CN108512710A (en) * 2017-02-24 2018-09-07 腾讯科技(深圳)有限公司 Test method based on testing tool and testing tool
CN109491894A (en) * 2018-10-25 2019-03-19 深圳壹账通智能科技有限公司 A kind of method and apparatus of interface testing
CN110196809A (en) * 2019-05-30 2019-09-03 贝壳技术有限公司 Interface test method and device
CN110502435A (en) * 2019-07-26 2019-11-26 广东睿江云计算股份有限公司 Automated performance testing method and its system based on Jmeter
US10496532B1 (en) * 2019-08-14 2019-12-03 Capital One Services, Llc Automatically reconfiguring a performance test environment
CN111427765A (en) * 2020-02-17 2020-07-17 叮当快药科技集团有限公司 Method and system for automatically starting interface performance test realized based on jmeter

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102868573A (en) * 2012-09-12 2013-01-09 北京航空航天大学 Method and device for Web service load cloud test
CN106383786A (en) * 2016-09-27 2017-02-08 北京金山安全软件有限公司 Interface pressure performance testing method and device and electronic equipment
CN108512710A (en) * 2017-02-24 2018-09-07 腾讯科技(深圳)有限公司 Test method based on testing tool and testing tool
CN109491894A (en) * 2018-10-25 2019-03-19 深圳壹账通智能科技有限公司 A kind of method and apparatus of interface testing
CN110196809A (en) * 2019-05-30 2019-09-03 贝壳技术有限公司 Interface test method and device
CN110502435A (en) * 2019-07-26 2019-11-26 广东睿江云计算股份有限公司 Automated performance testing method and its system based on Jmeter
US10496532B1 (en) * 2019-08-14 2019-12-03 Capital One Services, Llc Automatically reconfiguring a performance test environment
CN111427765A (en) * 2020-02-17 2020-07-17 叮当快药科技集团有限公司 Method and system for automatically starting interface performance test realized based on jmeter

Also Published As

Publication number Publication date
CN112765004A (en) 2021-05-07

Similar Documents

Publication Publication Date Title
CN109361562B (en) Automatic testing method based on associated network equipment access
CN111124919A (en) User interface testing method, device, equipment and storage medium
CN109491891A (en) Full-automatic interface pressure surveys method, apparatus, computer equipment and storage medium
CN111274154A (en) Automatic testing method, device, equipment and storage medium
CN107302476A (en) A kind of automated testing method and system for testing asynchronous interactive system
CN112115038A (en) Application testing method and device and storage medium
CN109726830A (en) Equipment routing inspection method, apparatus, electronic equipment and storage medium
CN104615523A (en) Fatigue testing method of BMC management module based on IPMI protocol
CN108874649A (en) Generation method, device and its computer equipment of automatic test script
CN107733710A (en) Construction method, device, computer equipment and the storage medium of link call relation
CN111858336B (en) Automatic software testing method and system
CN112181854A (en) Method, device, equipment and storage medium for generating flow automation script
CN112100078A (en) Method, device and equipment for generating interface test case
CN112463588A (en) Automatic test system and method, storage medium and computing equipment
CN109558328A (en) A kind of test method of code coverage, system, device and readable storage medium storing program for executing
CN113672441A (en) Method and device for testing intelligent equipment
CN105868100A (en) Android system-based automatic test method and device
CN112765004B (en) Automatic and self-adaptive interface performance test method
CN106294097B (en) Application program testing method and device
KR20070104202A (en) Automation test service system for view software of portable telephone and method thereof
CN106940647B (en) Code management method and device
CN116302989A (en) Pressure testing method and system, storage medium and computer equipment
CN116467188A (en) Universal local reproduction system and method under multi-environment scene
CN112073462B (en) Positioning method and device
CN113986263A (en) Code automation test method, device, electronic equipment and storage medium

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