CN112988589A - Interface testing method, device and system - Google Patents

Interface testing method, device and system Download PDF

Info

Publication number
CN112988589A
CN112988589A CN202110328035.8A CN202110328035A CN112988589A CN 112988589 A CN112988589 A CN 112988589A CN 202110328035 A CN202110328035 A CN 202110328035A CN 112988589 A CN112988589 A CN 112988589A
Authority
CN
China
Prior art keywords
test
request
test request
concurrent
client
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
Application number
CN202110328035.8A
Other languages
Chinese (zh)
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 Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network 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 Beijing Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN202110328035.8A priority Critical patent/CN112988589A/en
Publication of CN112988589A publication Critical patent/CN112988589A/en
Pending legal-status Critical Current

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/3684Test management for test design, e.g. generating new test cases
    • 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

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

The embodiment of the application provides an interface testing method, device and system, and relates to the technical field of software testing, wherein a client can receive a testing instruction input by a user; generating a first test request carrying a concurrent test identifier; the concurrent test identification represents the concurrent test times indicated by the test instruction; sending a first test request to a tool server; the tool server can start the concurrent test times threads represented by the concurrent test identification; respectively sending a second test request to an interface server corresponding to the first test request through each thread; the second test request is obtained based on the first test request; when a test response aiming at the second test request returned by the interface server is received, sending a test result obtained based on the test response to the client; the client can obtain the test result. Therefore, labor cost can be reduced, and testing efficiency is improved.

Description

Interface testing method, device and system
Technical Field
The present application relates to the field of software testing technologies, and in particular, to a method, an apparatus, and a system for testing an interface.
Background
With the rapid development of network technology, more and more software is applied to various aspects of life, work, entertainment and the like of users. As the business of software is continuously developed, the software also needs to be continuously updated iteratively, so that the requirement for the interface test of the software becomes very important in order to ensure that stable and reliable services can be provided for users.
In the related art, a tester may use an interface test tool to test software to be tested. For example, the interface test tool may send a test request to an interface server corresponding to the software to be tested, and then may obtain a test response to the test request returned by the interface server, so as to obtain a test result.
However, if concurrent testing is to be implemented, a tester needs to write codes for concurrent testing, which increases labor cost and reduces testing efficiency.
Disclosure of Invention
The embodiment of the application aims to provide an interface testing method, device and system, which can reduce labor cost and improve testing efficiency. The specific technical scheme is as follows:
in a first aspect, in order to achieve the above object, an embodiment of the present application discloses an interface testing method, where the method is applied to a tool server, and the method includes:
receiving a first test request sent by a client;
if the first test request carries a concurrent test identifier, starting a thread with concurrent test times represented by the concurrent test identifier;
respectively sending a second test request to an interface server corresponding to the first test request through each thread; the second test request is obtained based on the first test request;
and when a test response which is returned by the interface server and aims at the second test request is received, sending a test result obtained based on the test response to the client.
Optionally, before the sending, by each thread, a second test request to the interface server corresponding to the first test request, the method further includes:
judging whether the first test request carries a compression identifier or not;
and if the first test request carries a compression identifier, compressing a request body of the first test request based on a preset compression algorithm to obtain a second test request.
Optionally, the sending, to the client, a test result obtained based on the test response includes:
and converting the test result obtained based on the test response into a JSON format, and sending the converted test result to the client.
Optionally, the test result includes at least one of: the test response, the identifier indicating whether the interface server successfully responds to the second test request, and the duration of the interface server responding to the second test request.
In a second aspect, in order to achieve the above object, an embodiment of the present application discloses an interface testing method, where the method is applied to a client, and the method includes:
receiving a test instruction input by a user;
generating a first test request carrying a concurrent test identifier; wherein the concurrent test identification represents the concurrent test times indicated by the test instruction;
sending the first test request to a tool server to enable the tool server to start a plurality of threads of concurrent tests represented by the concurrent test identification, and sending a second test request to an interface server corresponding to the first test request through each thread, wherein the second test request is obtained based on the first test request, and when a test response aiming at the second test request returned by the interface server is received, sending a test result obtained based on the test response to the client;
and acquiring the test result.
Optionally, the test result includes at least one of: the test response, the identifier indicating whether the interface server successfully responds to the second test request, and the duration of the interface server responding to the second test request.
Optionally, before the generating the first test request carrying the concurrent test identifier, the method further includes:
judging whether the test instruction indicates to compress a request body;
the generating of the first test request carrying the concurrent test identifier includes:
and under the condition that the test instruction indicates that the request body is compressed, generating a first test request carrying a concurrent test identifier and a compression identifier, so that the tool server compresses the request body of the first test request based on a preset compression algorithm after receiving the first test request, and obtaining a second test request.
In a third aspect, in order to achieve the above object, an embodiment of the present application discloses an interface testing system, where the interface testing system includes a tool server and a client, where:
the client is used for receiving a test instruction input by a user; generating a first test request carrying a concurrent test identifier; wherein the concurrent test identification represents the concurrent test times indicated by the test instruction; sending the first test request to the tool server;
the tool server is used for starting the concurrent test times threads represented by the concurrent test identification; respectively sending a second test request to an interface server corresponding to the first test request through each thread; the second test request is obtained based on the first test request; when a test response which is returned by the interface server and aims at the second test request is received, sending a test result obtained based on the test response to the client;
the client is further used for obtaining the test result.
In a fourth aspect, in order to achieve the above object, an embodiment of the present application discloses an interface testing apparatus, where the apparatus is applied to a tool server, and the apparatus includes:
the first test request receiving module is used for receiving a first test request sent by a client;
the thread starting module is used for starting the threads with the concurrent test times represented by the concurrent test identification if the first test request carries the concurrent test identification;
a second test request sending module, configured to send a second test request to the interface server corresponding to the first test request through each thread; the second test request is obtained based on the first test request;
and the test result sending module is used for sending a test result obtained based on the test response to the client when receiving the test response which is returned by the interface server and aims at the second test request.
Optionally, the apparatus further comprises:
a determining module, configured to determine whether the first test request carries a compression identifier before the second test request is sent to the interface server corresponding to the first test request through each thread;
and the compression module is used for compressing the request body of the first test request based on a preset compression algorithm to obtain a second test request if the first test request carries a compression identifier.
Optionally, the test result sending module is specifically configured to convert the test result obtained based on the test response into a JSON format, and send the converted test result to the client.
Optionally, the test result includes at least one of: the test response, the identifier indicating whether the interface server successfully responds to the second test request, and the duration of the interface server responding to the second test request.
In a fifth aspect, in order to achieve the above object, an embodiment of the present application discloses an interface testing apparatus, where the apparatus is applied to a client, and the apparatus includes:
the test instruction receiving module is used for receiving a test instruction input by a user;
the first test request generation module is used for generating a first test request carrying a concurrent test identifier; wherein the concurrent test identification represents the concurrent test times indicated by the test instruction;
a first test request sending module, configured to send the first test request to a tool server, so that the tool server starts a plurality of threads of concurrent tests represented by the concurrent test identifier, and sends a second test request to an interface server corresponding to the first test request through each thread, where the second test request is obtained based on the first test request, and when a test response to the second test request returned by the interface server is received, sends a test result obtained based on the test response to the client;
and the test result acquisition module is used for acquiring the test result.
Optionally, the test result includes at least one of: the test response, the identifier indicating whether the interface server successfully responds to the second test request, and the duration of the interface server responding to the second test request.
Optionally, the apparatus further comprises:
the judging module is used for judging whether the test instruction indicates to compress a request body before the first test request carrying the concurrent test identification is generated;
the first test request generating module is specifically configured to generate a first test request carrying a concurrent test identifier and a compression identifier under the condition that the test instruction indicates to compress the request body, so that the tool server compresses the request body of the first test request based on a preset compression algorithm after receiving the first test request, and obtains a second test request.
In another aspect of this application, in order to achieve the above object, an embodiment of this application further discloses an electronic device, where the electronic device includes a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the interface testing method according to the first aspect or the second aspect when executing the program stored in the memory.
In yet another aspect of this embodiment, there is further provided a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the interface testing method according to the first aspect or the second aspect is implemented.
In another aspect of this embodiment, a computer program product containing instructions is provided, which when executed on a computer, causes the computer to execute the interface testing method according to the first aspect or the second aspect.
The embodiment of the application provides an interface testing method, wherein a client can receive a testing instruction input by a user; generating a first test request carrying a concurrent test identifier; the concurrent test identification represents the concurrent test times indicated by the test instruction; sending a first test request to a tool server; the tool server can start the concurrent test times threads represented by the concurrent test identification; respectively sending a second test request to an interface server corresponding to the first test request through each thread; the second test request is obtained based on the first test request; when a test response aiming at the second test request returned by the interface server is received, sending a test result obtained based on the test response to the client; the client can obtain the test result.
Based on the processing, the testing personnel can realize concurrent testing only by inputting corresponding testing instructions to the client without writing codes by themselves, so that the labor cost can be reduced, and the testing efficiency and the accessing of the application subsystem can be improved.
Of course, not all advantages described above need to be achieved at the same time in the practice of any one product or method of the present application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is an architecture diagram of a network provided by an embodiment of the present application;
fig. 2 is a flowchart of an interface testing method according to an embodiment of the present application;
fig. 3 is a flowchart of another interface testing method provided in the embodiment of the present application;
fig. 4 is a flowchart of another interface testing method provided in the embodiment of the present application;
fig. 5 is a flowchart of another interface testing method provided in the embodiment of the present application;
fig. 6 is a schematic diagram of a test page provided in an embodiment of the present application;
fig. 7 is a structural diagram of an interface testing apparatus according to an embodiment of the present disclosure;
FIG. 8 is a block diagram of another interface testing apparatus according to an embodiment of the present disclosure;
fig. 9 is a block diagram of an electronic device according to an embodiment of the present disclosure;
fig. 10 is a block diagram of another electronic device provided in the embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the related art, if concurrent testing is to be implemented, a tester needs to write concurrent testing codes, so that labor cost is increased, and testing efficiency is reduced.
In order to solve the above problem, an interface test system is provided in an embodiment of the present application, and referring to fig. 1, fig. 1 is an architecture diagram of a network provided in an embodiment of the present application, where the network may include an interface test system 101, an interface server 102, an interface server 103, and an interface server 104; the interface test system 101 may include a tool server 1011 and a client 1012.
The tool server 1011 can communicate with a plurality of interface servers, and in the embodiment of the present invention, only three interface servers are used as an example for description, but the present invention is not limited thereto.
Client 1012 may receive a test instruction input by a user and then generate a first test request carrying concurrent test identifiers. And the concurrent test identification represents the concurrent test times indicated by the test instruction. In turn, the client 1012 may send a first test request to the tool server 1011.
After receiving the first test request, the tool server 1011 may start the concurrent test times of threads indicated by the concurrent test identifier, and further send a second test request to the interface server (e.g., the interface server 102) corresponding to the first test request through each thread. And the second test request is obtained based on the first test request. Accordingly, upon receiving a test response to the second test request returned by the interface server 102, the tool server 1011 may send a test result based on the test response to the client 1012.
Client 1012 may then obtain the test results.
Based on the above processing, the tester can realize concurrent testing without writing codes by himself or by inputting corresponding testing instructions to the client 1012, and thus, the labor cost can be reduced and the testing efficiency can be improved.
With regard to the processing method of the tool server and the client in the interface test system, reference may be made to the detailed description of the method embodiments of the tool server and the client in the subsequent embodiments.
Referring to fig. 2, fig. 2 is a flowchart of an interface testing method provided in an embodiment of the present application, where the method may be applied to a tool server, where the tool server may be a tool server in an interface testing system according to the above embodiment, and the method may include the following steps:
s201: receiving a first test request sent by a client.
S202: and if the first test request carries the concurrent test identifier, starting a plurality of concurrent test threads represented by the concurrent test identifier.
S203: and respectively sending a second test request to the interface server corresponding to the first test request through each thread.
And the second test request is obtained based on the first test request.
S204: and when a test response which is returned by the interface server and aims at the second test request is received, sending a test result obtained based on the test response to the client.
According to the interface testing method provided by the embodiment of the application, the concurrent testing can be realized only by inputting the corresponding testing instruction to the client side without compiling the code by a tester, so that the labor cost can be reduced, and the testing efficiency is improved.
In one embodiment, the tool server may be deployed in the cloud, that is, a cloud server in a cloud computing environment is adopted as the tool server.
For step S201, the first test request may be generated by the client based on the test instruction of the tester. It can be understood that the first test request may carry the test method, the address of the interface to be tested (including the IP address and the port number of the interface server), and corresponding parameters.
The test method can comprise the following steps: POST (submitting data to be processed to a specified resource), GET (requesting data from a specified resource), PUT (uploading up-to-date data to a specified resource location), or DELETE (requesting deletion of a resource), etc.
For example, if the first test request requires deletion of a cloud server, the parameter may include an identification of the cloud server requiring deletion.
For step S202, if the first test request carries the concurrent test identifier, it indicates that the tester needs to perform concurrent test on the corresponding interface server based on the first test request. The number of concurrent tests is set according to the needs of the tester, for example, the number of concurrent tests may be 5, or the number of concurrent tests may be 10, but is not limited thereto.
In one embodiment, the concurrent test identification or the non-concurrent test identification may be represented by a specified field in the first test request. For example, if the value of the specified field is a, it indicates a non-concurrent test flag; if the value of the designated field is B, it indicates a concurrent test identifier, and at this time, B may be the number of concurrent tests.
Or, if the first test request is a concurrent test request, the first test request may include the specified field; the first test request may not include the specified field if the first test request is a non-concurrent test request.
For step S203, the first test request may be directly determined as the second test request, that is, the tool server may directly forward the first test request to the interface server.
In one embodiment, the tool server may include a Multiprocess module and/or a Threading module to open multiple threads based on the Multiprocess module or the Threading module.
The interface server is a service providing server, and may be, for example, an advertisement service server, a user center service server, an asset service server, an order service server, and the like.
In one embodiment, referring to fig. 3, on the basis of fig. 2, before step S203, the method may further include the steps of:
s205: and judging whether the first test request carries a compression identifier or not.
S206: and if the first test request carries the compression identifier, compressing the request body of the first test request based on a preset compression algorithm to obtain a second test request.
In one implementation, if the first test request is a POST request, the first test request may include a request body. For example, the first test request is a POST request that requires uploading of a log file, and the requester of the first test request may be the log file that requires uploading.
In the embodiment of the present application, the tester may further select whether to compress a request body (body) of the first test request in the client.
If the tester selects to compress the request body of the first test request, the first test request generated by the client may carry a compression identifier, and correspondingly, after the tool server receives the first test request, it is determined that the first test request carries the compression identifier, and the request body of the first test request may be compressed based on a preset compression algorithm to obtain a compressed first test request (i.e., a second test request).
Illustratively, the tool server may compress the request into gzip format, or alternatively, may compress the request into TAR format, but is not limited thereto.
Based on the above processing, the request body of the first test request can be compressed, which can improve the reliability of data transmission, reduce the data amount to be transmitted, further improve the efficiency of test,
in one embodiment, the test results may include at least one of: the test response, the identifier which indicates whether the interface server successfully responds to the second test request, and the duration of the interface server responding to the second test request.
In this embodiment of the application, the tool server may obtain the test response returned by the interface server, and further, may determine a duration for the interface server to respond to the second test request according to the time for receiving the test response and the time for sending the second test request.
In addition, the tool server can also judge whether the interface server is in the specified duration, and return an expected test response, and if so, the tool server can determine that the interface server successfully responds to the second test request; otherwise, it may be determined that the interface server did not successfully respond to the second test request.
In one embodiment, the step S204 may include the following steps: and converting the test result obtained based on the test response into a JSON format, and sending the converted test result to the client.
In the embodiment of the application, the tool server can convert the test result into the JSON format, and the data in the JSON format is easy for a user to read and write and is easy for machine analysis and generation, so that the efficiency of analyzing the test result by the client can be improved, the efficiency of displaying the test result can be improved, and the user experience can be improved.
The tool server provided in the embodiment of the present application may be developed based on python language, but is not limited thereto.
Based on the same concept, an embodiment of the present application further provides an interface testing method, where the method may be applied to a client, where the client may be a client in the interface testing system according to the foregoing embodiment, and referring to fig. 4, the method may include the following steps
S401: and receiving a test instruction input by a user.
S402: and generating a first test request carrying the concurrent test identifier.
And the concurrent test identification represents the concurrent test times indicated by the test instruction.
S403: and sending a first test request to the tool server so that the tool server starts a plurality of threads of concurrent testing times represented by the concurrent testing identification, respectively sending a second test request to the interface server corresponding to the first test request through each thread, and sending a test result obtained based on the test response to the client side when receiving the test response which is returned by the interface server and aims at the second test request.
And the second test request is obtained based on the first test request.
S404: and obtaining a test result.
According to the interface testing method provided by the embodiment of the application, the concurrent testing can be realized only by inputting the corresponding testing instruction to the client side without compiling the code by a tester, so that the labor cost can be reduced, and the testing efficiency is improved.
In one embodiment, the client may be a Browser side, that is, the interface testing system may be implemented based on a B/S (Browser/Server) architecture.
In one implementation, the client may display a test page, and a tester may input information such as a test method, an address of an interface to be tested, and corresponding parameters in the test page, and accordingly, the client may generate a corresponding test request.
In addition, a concurrent test option may be set in the test page, based on the concurrent test option, a tester may select the concurrent test times, and correspondingly, the client may generate a corresponding test request carrying a concurrent test identifier and send the generated test request to the tool server, and correspondingly, the tool server starts a thread with the concurrent test times indicated by the concurrent test identifier and sends a second test request to the interface server corresponding to the first test request through each thread, and further, when a test response to the second test request returned by the interface server is received, the tool server may send a test result obtained based on the test response to the client, and a processing manner of the tool server may refer to the related introduction of the above embodiment.
In one embodiment, the test results may include at least one of: the test response, the identifier which indicates whether the interface server successfully responds to the second test request, and the duration of the interface server responding to the second test request.
In one embodiment, after receiving the test result, the client may also display the test result in a test page.
In one embodiment, referring to fig. 5, on the basis of fig. 4, before step S402, the method may further include the steps of:
s405: it is determined whether the test instruction indicates to compress the requestor.
Accordingly, S402 may include:
s4021: and under the condition that the test instruction indicates that the request body is compressed, generating a first test request carrying a concurrent test identifier and a compression identifier, so that the tool server compresses the request body of the first test request based on a preset compression algorithm after receiving the first test request, and obtaining a second test request.
In one implementation, the tester may also choose whether to compress the request body in the test page. If the tester chooses to compress the request body, the client can generate a test request carrying the compression identifier and send the test request to the tool server, and correspondingly, the tool server can compress the request body.
The client provided by the embodiment of the application may be developed based on a Django framework, and certainly, is not limited thereto.
Referring to fig. 6, fig. 6 is a schematic diagram of a test page provided in the embodiment of the present application.
The tester may click on the "select file" button to select that the data described above is required, for example, to select that the log file described above is required.
Within the "Request" display box, a test method may be selected and parameters added.
Data to be uploaded can be input in the Edit Message display box.
The Send 1time represents that the number of concurrent tests is 1, the Send 5time represents that the number of concurrent tests is 5, the Send 10time represents that the number of concurrent tests is 10, and testers can select corresponding times based on requirements.
The test results may be displayed within a "Response" display box.
Based on the same inventive concept, an interface testing apparatus is further provided in the embodiments of the present application, and referring to fig. 7, fig. 7 is a structural diagram of an interface testing apparatus provided in the embodiments of the present application, where the apparatus is applied to a tool server, and the apparatus includes:
a first test request receiving module 701, configured to receive a first test request sent by a client;
a thread starting module 702, configured to start a thread with the concurrent test times indicated by the concurrent test identifier if the first test request carries the concurrent test identifier;
a second test request sending module 703, configured to send a second test request to the interface server corresponding to the first test request through each thread; the second test request is obtained based on the first test request;
a test result sending module 704, configured to send, to the client, a test result obtained based on the test response when receiving the test response to the second test request returned by the interface server.
Optionally, the apparatus further comprises:
a determining module, configured to determine whether the first test request carries a compression identifier before the second test request is sent to the interface server corresponding to the first test request through each thread;
and the compression module is used for compressing the request body of the first test request based on a preset compression algorithm to obtain a second test request if the first test request carries a compression identifier.
Optionally, the test result sending module 704 is specifically configured to convert the test result obtained based on the test response into a JSON format, and send the converted test result to the client.
Optionally, the test result includes at least one of: the test response, the identifier indicating whether the interface server successfully responds to the second test request, and the duration of the interface server responding to the second test request.
Based on the same inventive concept, an interface testing apparatus is further provided in the embodiments of the present application, referring to fig. 8, where fig. 8 is a structural diagram of an interface testing apparatus provided in the embodiments of the present application, where the apparatus is applied to a client, and the apparatus includes:
a test instruction receiving module 801, configured to receive a test instruction input by a user;
a first test request generating module 802, configured to generate a first test request carrying a concurrent test identifier; wherein the concurrent test identification represents the concurrent test times indicated by the test instruction;
a first test request sending module 803, configured to send the first test request to a tool server, so that the tool server starts a plurality of threads of concurrent tests represented by the concurrent test identifier, and sends a second test request to an interface server corresponding to the first test request through each thread, where the second test request is obtained based on the first test request, and when a test response to the second test request and returned by the interface server is received, sends a test result obtained based on the test response to the client;
a test result obtaining module 804, configured to obtain the test result.
Optionally, the test result includes at least one of: the test response, the identifier indicating whether the interface server successfully responds to the second test request, and the duration of the interface server responding to the second test request.
Optionally, the apparatus further comprises:
the judging module is used for judging whether the test instruction indicates to compress a request body before the first test request carrying the concurrent test identification is generated;
the first test request generating module 802 is specifically configured to generate a first test request carrying a concurrent test identifier and a compression identifier under the condition that the test instruction indicates to compress the request body, so that the tool server compresses the request body of the first test request based on a preset compression algorithm after receiving the first test request, so as to obtain a second test request.
The embodiment of the present application further provides an electronic device, as shown in fig. 9, which includes a processor 901, a communication interface 902, a memory 903, and a communication bus 904, where the processor 901, the communication interface 902, and the memory 903 complete mutual communication through the communication bus 904,
a memory 903 for storing computer programs;
the processor 901 is configured to implement the following steps when executing the program stored in the memory 903:
receiving a first test request sent by a client;
if the first test request carries a concurrent test identifier, starting a thread with concurrent test times represented by the concurrent test identifier;
respectively sending a second test request to an interface server corresponding to the first test request through each thread; the second test request is obtained based on the first test request;
and when a test response which is returned by the interface server and aims at the second test request is received, sending a test result obtained based on the test response to the client.
The embodiment of the present application further provides an electronic device, as shown in fig. 10, which includes a processor 1001, a communication interface 1002, a memory 1003 and a communication bus 1004, wherein the processor 1001, the communication interface 1002 and the memory 1003 complete mutual communication through the communication bus 1004,
a memory 1003 for storing a computer program;
the processor 1001 is configured to implement the following steps when executing the program stored in the memory 1003:
receiving a test instruction input by a user;
generating a first test request carrying a concurrent test identifier; wherein the concurrent test identification represents the concurrent test times indicated by the test instruction;
sending the first test request to a tool server to enable the tool server to start a plurality of threads of concurrent tests represented by the concurrent test identification, and sending a second test request to an interface server corresponding to the first test request through each thread, wherein the second test request is obtained based on the first test request, and when a test response aiming at the second test request returned by the interface server is received, sending a test result obtained based on the test response to the client;
and acquiring the test result.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
The embodiment of the present application further provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are run on a computer, the computer is enabled to execute the interface testing method provided in the embodiment of the present application.
It should be noted that other implementation manners of the interface testing method are the same as those of the foregoing method embodiment, and are not described herein again.
The embodiments of the present application further provide another computer program product containing instructions, which when run on a computer, causes the computer to execute the interface testing method provided by the embodiments of the present application.
It should be noted that other implementation manners of the interface testing method are the same as those of the foregoing method embodiment, and are not described herein again.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus, the system, the electronic device, the computer-readable storage medium, and the computer program product embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and in relation to the description, reference may be made to some of the description of the method embodiments.
The above description is only for the preferred embodiment of the present application and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (17)

1. An interface testing method, which is applied to a tool server, the method comprising:
receiving a first test request sent by a client;
if the first test request carries a concurrent test identifier, starting a thread with concurrent test times represented by the concurrent test identifier;
respectively sending a second test request to an interface server corresponding to the first test request through each thread; the second test request is obtained based on the first test request;
and when a test response which is returned by the interface server and aims at the second test request is received, sending a test result obtained based on the test response to the client.
2. The method of claim 1, wherein before the sending, by each thread, a second test request to the interface server corresponding to the first test request, the method further comprises:
judging whether the first test request carries a compression identifier or not;
and if the first test request carries a compression identifier, compressing a request body of the first test request based on a preset compression algorithm to obtain a second test request.
3. The method of claim 1, wherein sending the test result based on the test response to the client comprises:
and converting the test result obtained based on the test response into a JSON format, and sending the converted test result to the client.
4. The method of claim 1, wherein the test results comprise at least one of: the test response, the identifier indicating whether the interface server successfully responds to the second test request, and the duration of the interface server responding to the second test request.
5. An interface testing method, which is applied to a client, is characterized in that the method comprises the following steps:
receiving a test instruction input by a user;
generating a first test request carrying a concurrent test identifier; wherein the concurrent test identification represents the concurrent test times indicated by the test instruction;
sending the first test request to a tool server to enable the tool server to start a plurality of threads of concurrent tests represented by the concurrent test identification, and sending a second test request to an interface server corresponding to the first test request through each thread, wherein the second test request is obtained based on the first test request, and when a test response aiming at the second test request returned by the interface server is received, sending a test result obtained based on the test response to the client;
and acquiring the test result.
6. The method of claim 5, wherein the test results comprise at least one of: the test response, the identifier indicating whether the interface server successfully responds to the second test request, and the duration of the interface server responding to the second test request.
7. The method of claim 5, wherein before the generating the first test request carrying the concurrent test identity, the method further comprises:
judging whether the test instruction indicates to compress a request body;
the generating of the first test request carrying the concurrent test identifier includes:
and under the condition that the test instruction indicates that the request body is compressed, generating a first test request carrying a concurrent test identifier and a compression identifier, so that the tool server compresses the request body of the first test request based on a preset compression algorithm after receiving the first test request, and obtaining a second test request.
8. An interface test system, comprising a tool server and a client, wherein:
the client is used for receiving a test instruction input by a user; generating a first test request carrying a concurrent test identifier; wherein the concurrent test identification represents the concurrent test times indicated by the test instruction; sending the first test request to the tool server;
the tool server is used for starting the concurrent test times threads represented by the concurrent test identification; respectively sending a second test request to an interface server corresponding to the first test request through each thread; the second test request is obtained based on the first test request; when a test response which is returned by the interface server and aims at the second test request is received, sending a test result obtained based on the test response to the client;
the client is further used for obtaining the test result.
9. An interface testing apparatus, wherein the apparatus is applied to a tool server, the apparatus comprising:
the first test request receiving module is used for receiving a first test request sent by a client;
the thread starting module is used for starting the threads with the concurrent test times represented by the concurrent test identification if the first test request carries the concurrent test identification;
a second test request sending module, configured to send a second test request to the interface server corresponding to the first test request through each thread; the second test request is obtained based on the first test request;
and the test result sending module is used for sending a test result obtained based on the test response to the client when receiving the test response which is returned by the interface server and aims at the second test request.
10. The apparatus of claim 9, further comprising:
a determining module, configured to determine whether the first test request carries a compression identifier before the second test request is sent to the interface server corresponding to the first test request through each thread;
and the compression module is used for compressing the request body of the first test request based on a preset compression algorithm to obtain a second test request if the first test request carries a compression identifier.
11. The apparatus according to claim 9, wherein the test result sending module is specifically configured to convert the test result obtained based on the test response into a JSON format, and send the converted test result to the client.
12. The apparatus of claim 9, wherein the test results comprise at least one of: the test response, the identifier indicating whether the interface server successfully responds to the second test request, and the duration of the interface server responding to the second test request.
13. An interface testing apparatus, applied to a client, the apparatus comprising:
the test instruction receiving module is used for receiving a test instruction input by a user;
the first test request generation module is used for generating a first test request carrying a concurrent test identifier; wherein the concurrent test identification represents the concurrent test times indicated by the test instruction;
a first test request sending module, configured to send the first test request to a tool server, so that the tool server starts a plurality of threads of concurrent tests represented by the concurrent test identifier, and sends a second test request to an interface server corresponding to the first test request through each thread, where the second test request is obtained based on the first test request, and when a test response to the second test request returned by the interface server is received, sends a test result obtained based on the test response to the client;
and the test result acquisition module is used for acquiring the test result.
14. The apparatus of claim 13, wherein the test results comprise at least one of: the test response, the identifier indicating whether the interface server successfully responds to the second test request, and the duration of the interface server responding to the second test request.
15. The apparatus of claim 13, further comprising:
the judging module is used for judging whether the test instruction indicates to compress a request body before the first test request carrying the concurrent test identification is generated;
the first test request generating module is specifically configured to generate a first test request carrying a concurrent test identifier and a compression identifier under the condition that the test instruction indicates to compress the request body, so that the tool server compresses the request body of the first test request based on a preset compression algorithm after receiving the first test request, and obtains a second test request.
16. An electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
the memory is used for storing a computer program;
the processor, when executing the program stored in the memory, implementing the method steps of any of claims 1-4, or 5-7.
17. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method steps of any one of claims 1 to 4, or 5 to 7.
CN202110328035.8A 2021-03-26 2021-03-26 Interface testing method, device and system Pending CN112988589A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110328035.8A CN112988589A (en) 2021-03-26 2021-03-26 Interface testing method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110328035.8A CN112988589A (en) 2021-03-26 2021-03-26 Interface testing method, device and system

Publications (1)

Publication Number Publication Date
CN112988589A true CN112988589A (en) 2021-06-18

Family

ID=76333947

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110328035.8A Pending CN112988589A (en) 2021-03-26 2021-03-26 Interface testing method, device and system

Country Status (1)

Country Link
CN (1) CN112988589A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113282511A (en) * 2021-06-24 2021-08-20 中国农业银行股份有限公司 Test method and device
CN114398281A (en) * 2022-01-18 2022-04-26 北京自如信息科技有限公司 Application interface time consumption testing method and system and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6915344B1 (en) * 1999-11-30 2005-07-05 Microsoft Corporation Server stress-testing response verification
CN105224450A (en) * 2014-07-02 2016-01-06 阿里巴巴集团控股有限公司 Concurrent testing method and device
CN109710533A (en) * 2018-12-29 2019-05-03 亚信科技(中国)有限公司 A kind of interface test method, device and server
CN110147315A (en) * 2019-04-17 2019-08-20 深圳壹账通智能科技有限公司 Concurrency performance test method, device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6915344B1 (en) * 1999-11-30 2005-07-05 Microsoft Corporation Server stress-testing response verification
CN105224450A (en) * 2014-07-02 2016-01-06 阿里巴巴集团控股有限公司 Concurrent testing method and device
CN109710533A (en) * 2018-12-29 2019-05-03 亚信科技(中国)有限公司 A kind of interface test method, device and server
CN110147315A (en) * 2019-04-17 2019-08-20 深圳壹账通智能科技有限公司 Concurrency performance test method, device, computer equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113282511A (en) * 2021-06-24 2021-08-20 中国农业银行股份有限公司 Test method and device
CN113282511B (en) * 2021-06-24 2024-05-07 中国农业银行股份有限公司 Test method and test equipment
CN114398281A (en) * 2022-01-18 2022-04-26 北京自如信息科技有限公司 Application interface time consumption testing method and system and electronic equipment

Similar Documents

Publication Publication Date Title
CN110221982B (en) Performance test method, device and equipment of business system and readable storage medium
CN108415832B (en) Interface automation test method, device, equipment and storage medium
CN107341098B (en) Software performance testing method, platform, equipment and storage medium
CN107436844B (en) Method and device for generating interface use case aggregate
CN108628748B (en) Automatic test management method and automatic test management system
CN109408375B (en) Method and device for generating interface document
CN112199300B (en) Interface testing method and device, electronic equipment and storage medium
CN112988589A (en) Interface testing method, device and system
CN112685029A (en) Visual template generation method, device, equipment and storage medium
CN110430070B (en) Service state analysis method, device, server, data analysis equipment and medium
CN109558315B (en) Method, device and equipment for determining test range
CN109189692A (en) A kind of webservice interface test method and device
CN115052037B (en) Client detection method, device, storage medium and equipment
CN113672497B (en) Method, device and equipment for generating non-buried point event and storage medium
CN110245072A (en) A kind of test method and device
CN112948195B (en) Interface testing method, device, electronic equipment and storage medium
CN112579428B (en) Interface testing method, device, electronic equipment and storage medium
CN112631929A (en) Test case generation method and device, storage medium and electronic equipment
CN115129575A (en) Code coverage result generation method and device
CN111651356A (en) Application program testing method, device and system
CN112882937A (en) Test case processing method and device, computer equipment and storage medium
CN111159988A (en) Model processing method and device, computer equipment and storage medium
CN113626409B (en) Test data processing method, device, equipment and storage medium
CN115373973A (en) Software system testing method and device
CN118519893A (en) Test verification method and device of blockchain platform, storage medium and electronic equipment

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