CN111881060B - Interface performance testing method and device and electronic equipment - Google Patents

Interface performance testing method and device and electronic equipment Download PDF

Info

Publication number
CN111881060B
CN111881060B CN202011036729.6A CN202011036729A CN111881060B CN 111881060 B CN111881060 B CN 111881060B CN 202011036729 A CN202011036729 A CN 202011036729A CN 111881060 B CN111881060 B CN 111881060B
Authority
CN
China
Prior art keywords
preset
thread
server
client
time
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
CN202011036729.6A
Other languages
Chinese (zh)
Other versions
CN111881060A (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.)
Beijing Zhiyuan Artificial Intelligence Research Institute
Original Assignee
Beijing Zhiyuan Artificial Intelligence Research Institute
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 Beijing Zhiyuan Artificial Intelligence Research Institute filed Critical Beijing Zhiyuan Artificial Intelligence Research Institute
Priority to CN202011036729.6A priority Critical patent/CN111881060B/en
Publication of CN111881060A publication Critical patent/CN111881060A/en
Application granted granted Critical
Publication of CN111881060B publication Critical patent/CN111881060B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Abstract

The invention discloses an interface performance testing method, an interface performance testing device and electronic equipment, wherein the method comprises the following steps: receiving preset parameters through a client under a preset development environment, and sending the preset parameters to a server; the server side carries out thread management according to the preset parameters and returns data information of the thread to the client side; the client calculates the query rate per second value of the current interface under preset parameters according to the data information and outputs the query rate per second value; the method can test the interface performance in the interface development process and improve the software stability.

Description

Interface performance testing method and device and electronic equipment
Technical Field
The invention relates to the technical field of computers, in particular to an interface performance testing method and device and electronic equipment.
Background
In software system development, it is necessary to implement the association and invocation between functions by defining "interfaces". However, in the process of interface development by developers in a development environment such as IntelliJ IDEA, it is difficult to deeply understand the performance of the developed interface, so that a series of concurrent requests often occur after the functions are on-line, which seriously reduces the usability of software and greatly affects the experience of users on the software.
Disclosure of Invention
The invention provides an interface performance testing method, an interface performance testing device and electronic equipment, which are used for realizing performance testing in an interface development process and improving software stability.
An interface performance testing method comprises the following steps:
receiving preset parameters through a client under a preset development environment, and sending the preset parameters to a server;
the server side carries out thread management according to the preset parameters and returns data information of the thread to the client side;
and the client calculates the query rate per second value of the current interface under preset parameters according to the data information and outputs the query rate per second value.
Further, the preset development environment comprises an IntelliJ IDEA development environment.
Further, the preset parameters include a preset thread number, a preset connection number and a preset duration.
Further, the server comprises a selector;
the server side performs thread management according to the preset parameters, and the thread management comprises the following steps:
and within the preset time length, recording the time-consuming time length for executing the associated events with the preset connection number in each thread according to the preset thread number in the threads through the selector.
Further, the data information is the time-consuming duration of executing the associated events with the preset connection number in each thread;
the client calculates the query rate per second value of the current interface under preset parameters according to the data information, and the method comprises the following steps:
detecting whether time-consuming duration of executing the associated events with the preset connection number in each thread of the preset thread number sent by the server is received or not within the preset duration;
if yes, calculating the average value of the time-consuming duration, and obtaining the query rate per second value.
An interface performance testing device comprises a server and a client;
under a preset development environment, the client is used for receiving preset parameters and sending the preset parameters to the server;
the server is used for performing thread management according to the preset parameters and returning data information of the thread to the client;
and the client is also used for calculating the query rate per second value of the current interface under the preset parameters according to the data information and outputting the query rate per second value.
Further, the preset parameters comprise a preset thread number, a preset connection number and a preset duration; the server comprises a selector;
and the server is also used for recording the time-consuming duration of executing the associated events with the preset connection number in each thread in the threads according to the preset thread number in the preset duration through the selector.
Further, the data information is the time-consuming duration of executing the associated events with the preset connection number in each thread;
the client is also used for detecting whether the time-consuming duration of executing the associated events with the preset connection number in each thread of the preset thread number sent by the server is received or not within the preset duration; if yes, calculating the average value of the time-consuming duration, and obtaining the query rate per second value.
An electronic device comprises a processor and a memory, wherein the memory stores a plurality of instructions, and the processor is used for reading the instructions and executing the interface performance testing method.
A computer-readable storage medium having stored thereon a plurality of instructions readable by a processor and performing the interface performance testing method described above.
The interface performance testing method, the device and the electronic equipment provided by the invention at least have the following beneficial effects:
(1) the performance test in the interface development process is realized, and the stability of software is improved;
(2) the potential defects of the interface can be predicted in advance so as to be repaired and optimized in time;
(3) the method can directly test the locally developed interface or the remote interface in the IntelliJ IDEA environment without depending on other third-party interface performance test software, and is high in convenience.
Drawings
Fig. 1 is a flowchart of an embodiment of a method for testing interface performance according to the present invention.
Fig. 2 is a schematic structural diagram of an embodiment of an interface performance testing apparatus provided in the present invention.
Fig. 3 is a schematic structural diagram of an embodiment of an electronic device provided in the present invention.
Detailed Description
In order to better understand the technical solution, the technical solution will be described in detail with reference to the drawings and the specific embodiments.
Referring to fig. 1, the present embodiment provides an interface performance testing method, including:
step S101, receiving preset parameters through a client under a preset development environment, and sending the preset parameters to a server;
step S102, the server side carries out thread management according to the preset parameters and returns data information of the thread to the client side;
and step S103, the client calculates the query rate per second value of the current interface under the preset parameters according to the data information, and outputs the query rate per second value.
The client and the server are created in advance under the preset development environment. In some embodiments, before step S101, under a preset development environment, a server creation request sent by a user (e.g., a developer) is received, and a server (server) is created according to the server creation request; receiving a client creating request sent by a user, and creating a client (client) according to the client creating request.
In some embodiments, the pre-set development environment includes an IntelliJ IDEA development environment that provides functionality for custom plug-in development with which the above-described methods can be implemented.
In some embodiments, the preset parameters include a preset thread number (thread), a preset connection number (connection), and a preset duration (time). The preset parameters are optionally input by a user.
Executing step S101, receiving preset parameters through the client: the method comprises the steps of presetting thread number (thread), connection number (connection) and time, and transmitting the thread number (thread), the connection number (connection) and the time to a server.
In step S102, the server calls the tested interface to create a thread according to the preset number of threads and execute the associated event in the thread according to the preset number of connections. The associated events include establishment of a channel (channel), data arrival and the like, the execution subject of the associated events is the tested interface, and one thread may include associated events with a preset connection number (connection). In some embodiments, the server includes a selector (selector). In the preset time, the server monitors the associated events in each thread under the preset thread number (thread) through the selector, records the time-consuming time for executing the associated events with the preset connection number in each thread, and returns the time-consuming time to the client by each thread.
Further, step S103 is executed, and the client detects whether a time-consuming duration for executing the associated event with the preset connection number in each thread of the preset thread number sent by the server is received within a preset duration; if yes, calculating the average value of the time-consuming duration under the preset thread number, and obtaining the query per second value (QPS).
And if the number of the received threads of the time-consuming duration is less than the preset number of the threads within the preset time duration, not calculating.
The client counts a query rate per second (QPS) value of the current interface under the conditions of the preset thread number and the preset connection number, so that the performance test of the interface is realized.
In other embodiments, the preset parameters further include a URL, for example, in a format of ip + port + contextPath + interfaceName, and the client transmits the preset parameters including the URL to the server. Different from the foregoing embodiment, before executing step S102, the server calls an interface with the URL as a target address, creates a thread according to a preset number of threads by the called interface in step S102, and executes an associated event in the thread according to the preset number of connections. Thus, performance testing can be performed for the remote interface. Other testing procedures refer to the above embodiments, and are not described herein.
The interface performance testing method provided by the embodiment at least has the following beneficial effects:
(1) the performance test in the interface development process is realized, and the software stability is improved;
(2) the potential defects of the interface can be predicted in advance so as to be repaired and optimized in time;
(3) the method can directly test the locally developed interface or the remote interface in the IntelliJ IDEA without depending on other third-party interface performance test software, and is high in convenience.
Referring to fig. 2, the present embodiment provides an interface performance testing apparatus, which includes a server 201 and a client 202;
under a preset development environment, the client 202 is configured to receive preset parameters and send the preset parameters to the server 201;
the server 201 is configured to perform thread management according to the preset parameter, and return data information of a thread to the client 202;
the client 202 is further configured to calculate a query rate per second value of the current interface under preset parameters according to the data information, and output the query rate per second value.
In some embodiments, the preset parameters include a preset number of threads, a preset number of connections, and a preset duration; the client 202 receives the preset parameters: the method comprises the steps of presetting thread number (thread), connection number (connection) and time, and transmitting the thread number (thread), the connection number (connection) and the time to a server.
And the server calls the tested interface to create a thread according to the preset thread number and execute the associated event in the thread according to the preset connection number. The associated events include establishment of a channel (channel), data arrival and the like, the execution subject of the associated events is the tested interface, and one thread may include associated events with a preset connection number (connection). In some embodiments, the server includes a selector (selector). In the preset time, the server monitors the associated events in each thread under the preset thread number (thread) through the selector, records the time-consuming time for executing the associated events with the preset connection number in each thread, and returns the time-consuming time to the client by each thread.
The client 201 is further configured to detect whether the time-consuming duration of the associated event of each thread of the preset thread number sent by the server under the preset connection number is received within the preset duration; if yes, calculating the average value of the time-consuming duration under the preset thread number, and obtaining the query per second value (QPS).
And if the number of the received threads of the time-consuming duration is less than the preset number of the threads within the preset time duration, not calculating.
The client 201 counts a Query Per Second (QPS) value of the current interface under the conditions of the preset thread number and the preset connection number, thereby implementing the performance test on the interface.
Optionally, the preset development environment includes an IntelliJ IDEA development environment, and the interface performance testing apparatus is implemented by providing a function of developing a custom plug-in by using the IntelliJ IDEA development environment. The device is used as a plug-in to directly perform performance test on the interface which is locally developed in the IntelliJ IDEA development environment, and the user inputs the preset parameters by using the interface provided by the plug-in.
In other embodiments, the preset parameters further include a URL, for example, in a format of ip + port + contextPath + interfaceName, and the client transmits the preset parameters including the URL to the server. Different from the foregoing embodiment, before executing step S102, the server calls an interface with the URL as a target address, creates a thread according to a preset number of threads by the called interface in step S102, and executes an associated event in the thread according to the preset number of connections. Thus, performance testing can be performed for the remote interface. Other testing procedures refer to the above embodiments, and are not described herein.
The interface performance testing device provided by the embodiment at least comprises the following beneficial effects:
(1) the performance test in the interface development process is realized, and the software stability is improved;
(2) the potential defects of the interface can be predicted in advance so as to be repaired and optimized in time;
(3) the method can directly test the locally developed interface or the remote interface in the IntelliJ IDEA environment without depending on other third-party interface performance test software, and is high in convenience.
Referring to fig. 3, the present embodiment further provides an electronic device, including a processor 301 and a memory 302, where the memory 302 stores a plurality of instructions, and the processor 301 is configured to read the plurality of instructions and execute the above-mentioned interface performance testing method, for example, including: receiving preset parameters through a client under a preset development environment, and sending the preset parameters to a server; the server side carries out thread management according to the preset parameters and returns data information of the thread to the client side; and the client calculates the query rate per second value of the current interface under preset parameters according to the data information and outputs the query rate per second value.
The present embodiment also provides a computer-readable storage medium, where the computer-readable storage medium stores a plurality of instructions, and the instructions are readable by a processor and execute the above interface performance testing method, for example, including: receiving preset parameters through a client under a preset development environment, and sending the preset parameters to a server; the server side carries out thread management according to the preset parameters and returns data information of the thread to the client side; and the client calculates the query rate per second value of the current interface under preset parameters according to the data information and outputs the query rate per second value.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention. It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (4)

1. An interface performance testing method is characterized by comprising the following steps:
receiving preset parameters through a client under a preset development environment, and sending the preset parameters to a server, wherein the preset parameters comprise a preset thread number, a preset connection number and a preset duration;
the server side carries out thread management according to the preset parameters and returns data information of the thread to the client side;
the client calculates the query rate per second value of the current interface under preset parameters according to the data information and outputs the query rate per second value;
the server comprises a selector, and the data information is the time-consuming duration of executing the associated events with preset connection number in each thread;
the step that the server side carries out thread management according to the preset parameters comprises the following steps:
the server calls the tested interface to create a thread according to a preset thread number and execute the associated events in the thread according to a preset connection number, monitors the associated events in each thread under the preset thread number through the selector in a preset time period, and records the time consumption time for executing the associated events of the preset connection number in each thread;
the client calculates the query rate per second value of the current interface under preset parameters according to the data information, and the method comprises the following steps:
detecting whether time-consuming duration of executing the associated events with the preset connection number in each thread of the preset thread number sent by the server is received or not within the preset duration;
if yes, calculating the average value of the time-consuming duration to obtain the query rate per second value;
the client and the server are pre-established in the preset development environment, and the preset development environment comprises an intelliJ IDEA development environment.
2. The interface performance testing device is characterized by comprising a server and a client;
in a preset development environment, the client is used for receiving preset parameters and sending the preset parameters to the server, wherein the preset parameters comprise a preset thread number, a preset connection number and a preset duration;
the server comprises a selector, the server is used for calling the tested interface, creating a thread according to a preset thread number and executing associated events in the thread according to a preset connection number, monitoring the associated events in each thread under the preset thread number through the selector in a preset time, recording the time-consuming time for executing the associated events of the preset connection number in each thread, and returning the time-consuming time to the client;
the client is used for detecting whether the time-consuming duration of executing the associated events with the preset connection number in each thread of the preset thread number sent by the server is received or not within the preset duration; if yes, calculating the average value of the time-consuming duration to obtain a query rate per second;
the client and the server are pre-established in the preset development environment, and the preset development environment comprises an intelliJ IDEA development environment.
3. An electronic device comprising a processor and a memory, the memory storing a plurality of instructions, the processor being configured to read the plurality of instructions and execute the interface performance testing method of claim 1.
4. A computer-readable storage medium storing a plurality of instructions readable by a processor and performing the interface performance testing method of claim 1.
CN202011036729.6A 2020-09-28 2020-09-28 Interface performance testing method and device and electronic equipment Active CN111881060B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011036729.6A CN111881060B (en) 2020-09-28 2020-09-28 Interface performance testing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011036729.6A CN111881060B (en) 2020-09-28 2020-09-28 Interface performance testing method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN111881060A CN111881060A (en) 2020-11-03
CN111881060B true CN111881060B (en) 2021-01-15

Family

ID=73199174

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011036729.6A Active CN111881060B (en) 2020-09-28 2020-09-28 Interface performance testing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111881060B (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102833125A (en) * 2011-06-17 2012-12-19 腾讯科技(深圳)有限公司 Test server, test system adopting test server, and test method
CN108512710B (en) * 2017-02-24 2022-05-24 腾讯科技(深圳)有限公司 Test method based on test tool and test tool
CN111026636A (en) * 2019-09-27 2020-04-17 珠海随变科技有限公司 Software project testing method, device, equipment and storage medium
CN110750458A (en) * 2019-10-22 2020-02-04 恩亿科(北京)数据科技有限公司 Big data platform testing method and device, readable storage medium and electronic equipment

Also Published As

Publication number Publication date
CN111881060A (en) 2020-11-03

Similar Documents

Publication Publication Date Title
US8782215B2 (en) Performance testing in a cloud environment
CN106681811B (en) Multithreading scheduling method and device based on thread pool
CN110471749B (en) Task processing method, device, computer readable storage medium and computer equipment
CN110784374A (en) Method, device, equipment and system for monitoring operation state of service system
CN104683181B (en) A kind of method for monitoring performance, equipment and system
CN111694748B (en) Pressure testing method and device
CN114328132A (en) Method, device, equipment and medium for monitoring state of external data source
CN103218295A (en) Method and system for testing message handling capacity of ESB (Enterprise Service Bus)
CN107102937B (en) User interface testing method and device
US10432490B2 (en) Monitoring single content page application transitions
CN112631879A (en) Data acquisition method and device, computer readable medium and electronic equipment
CN111881060B (en) Interface performance testing method and device and electronic equipment
US20160321173A1 (en) Automatic garbage collection thrashing monitoring
CN112363980A (en) Data processing method and device for distributed system
CN108280024A (en) Traffic distribution strategy test method, device and electronic equipment
CN114077540A (en) Interface test system and interface test method
CN110851688A (en) Page request method, device and equipment
CN114465919B (en) Network service testing method, system, electronic equipment and storage medium
CN111506422B (en) Event analysis method and system
US20180063005A1 (en) Non-blocking request processing method and device
CN112866431A (en) IP address allocation method and device and computer equipment
CN112416763A (en) Method, device and equipment for automatically testing interface and storage medium
CN110908886A (en) Data sending method and device, electronic equipment and storage medium
CN116578631B (en) Data interaction method, data acquisition equipment, data processing equipment and interaction system
CN108089823B (en) Information output method and device for storage system

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