CN115292200A - Interface test method, device, equipment and medium - Google Patents

Interface test method, device, equipment and medium Download PDF

Info

Publication number
CN115292200A
CN115292200A CN202211186133.3A CN202211186133A CN115292200A CN 115292200 A CN115292200 A CN 115292200A CN 202211186133 A CN202211186133 A CN 202211186133A CN 115292200 A CN115292200 A CN 115292200A
Authority
CN
China
Prior art keywords
interface
sample data
early warning
response time
target data
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
CN202211186133.3A
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 6Cloud Technology Co Ltd
Beijing 6Cloud Information Technology Co Ltd
Original Assignee
Beijing 6Cloud Technology Co Ltd
Beijing 6Cloud 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 Beijing 6Cloud Technology Co Ltd, Beijing 6Cloud Information Technology Co Ltd filed Critical Beijing 6Cloud Technology Co Ltd
Priority to CN202211186133.3A priority Critical patent/CN115292200A/en
Publication of CN115292200A publication Critical patent/CN115292200A/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
    • 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/3696Methods or tools to render software testable

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 invention relates to the technical field of automatic testing, and discloses an interface testing method, device, equipment and medium. The method includes the steps that interface information called during page operation is captured, and the interface information is recorded, so that corresponding sample data is obtained; responding to parameter replacement operation aiming at sample data, and performing parameter replacement on parameters to be replaced in the sample data based on a preset rule base to obtain corresponding target data; responding to an interface playback request aiming at the target data, acquiring an interface state and response time corresponding to the target data, and detecting whether an interface corresponding to the interface state and the response time is normal; when the interface abnormality is detected, early warning is carried out according to an early warning strategy; therefore, the problems of high interface test cost and low test efficiency in the development and test process of the service system are solved.

Description

Interface test method, device, equipment and medium
Technical Field
The invention relates to the technical field of automatic testing, in particular to an interface testing method, device, equipment and medium.
Background
In the development and test process of the business system, the state and the response time of the interface are often required to be concerned. The current interface state and response time are obtained mainly by the following method: the state and the time returned by the calling interface can be checked by the Web and H5 terminal calling interface through a browser F12; the APP end and the interface called by the small program can obtain the state and the time returned by the interface through charles or fixdler and other agent tools; the API interface can call the interface through a tool such as postman and the like to acquire the state returned by the interface and the used time.
In the method or the process, if a plurality of interfaces are required to be acquired or a plurality of interfaces are required to acquire interface states and response time of different environments, manual execution and result recording are required, and whether the states and the response time are in accordance with expectations or not is manually judged.
However, the current method for acquiring the interface status and the response time has the following problems: the cost of manual operation statistics is high; when a plurality of interfaces are obtained, the interfaces need to obtain interface states and response time of different environments, and whether the states and the response time meet expectations or not needs to be manually judged through manual execution and result recording and manual work, so that the efficiency of manually testing the interfaces is low; and additional labor costs are also required after the status and response time of the interface are counted, such as when the interface with a wrong status or the interface with a response time exceeding a specified value needs to be counted.
Disclosure of Invention
The invention mainly aims to provide an interface testing method, device, equipment and medium, and aims to solve the problems of high interface testing cost and low testing efficiency in the process of developing and testing a service system.
In order to achieve the above object, the present invention provides an interface testing method, which comprises the following steps:
capturing interface information called during page operation, and recording the interface information to obtain corresponding sample data;
responding to the parameter replacement operation aiming at the sample data, and performing parameter replacement on the parameter to be replaced in the sample data based on a preset rule base to obtain corresponding target data;
responding to an interface playback request aiming at the target data, acquiring an interface state and response time corresponding to the target data, and detecting whether an interface corresponding to the interface state and the response time is normal;
and when the interface abnormality is detected, early warning is carried out according to an early warning strategy.
Preferably, the step of capturing interface information called during the page operation and recording the interface information to obtain corresponding sample data includes:
capturing interface information called during page operation through an agent tool, recording the interface information, obtaining corresponding sample data, and storing the sample data into a target database, wherein the sample data is used as the sample data during interface playback, and the sample data comprises class parameters, method parameters and input parameters corresponding to an interface to be detected.
Preferably, the step of performing parameter replacement on the parameter to be replaced in the sample data based on a preset rule base in response to the parameter replacement operation for the sample data to obtain corresponding target data includes:
in response to the parameter replacement operation aiming at the sample data, selecting target sample data corresponding to the parameter replacement operation from the sample data;
and determining parameters to be replaced in the target sample data, and performing parameter replacement on the parameters to be replaced based on a preset rule base to obtain target data after parameter replacement.
Preferably, the interface playback request for the target data is responded, the interface state and the response time corresponding to the target data are obtained, and the interface state and the response time are stored in a target database based on a preset sequence;
and screening the interface state and the response time based on an early warning condition, and detecting whether the interface corresponding to the interface state and the response time is normal.
Preferably, after the step of obtaining the interface state and the response time corresponding to the target data in response to the interface playback request for the target data, and detecting whether the interface corresponding to the interface state and the response time is normal, the method further includes:
and when the interface is detected to be normal, generating a visual interface detection report, and storing the visual interface detection report into a target database.
Preferably, when the interface abnormality is detected, the step of performing early warning according to an early warning strategy includes:
and when the interface abnormality is detected, carrying out real-time early warning in the interface playback process according to an early warning strategy.
Preferably, when the interface abnormality is detected, the step of performing early warning according to an early warning strategy includes:
when the interface abnormality is detected, summarizing the abnormal interfaces with the abnormal interfaces, and after the interface playback request is completed, summarizing and early warning are carried out on the abnormal interfaces according to an early warning strategy.
In addition, to achieve the above object, the present invention further provides an interface state and response time-based early warning device, where the interface state and response time-based early warning device includes:
the recording module is used for capturing interface information called during page operation and recording the interface information to obtain corresponding sample data;
the replacing module is used for responding to the parameter replacing operation aiming at the sample data, and performing parameter replacement on the parameter to be replaced in the sample data based on a preset rule base to obtain corresponding target data;
the request module is used for responding to an interface playback request aiming at the target data, acquiring an interface state and response time corresponding to the target data, and detecting whether an interface corresponding to the interface state and the response time is normal or not;
and the early warning module is used for carrying out early warning according to an early warning strategy when detecting that the interface is abnormal.
Further, to achieve the above object, the present invention also provides a computer apparatus comprising: the early warning method comprises a memory, a processor and an early warning program which is stored on the memory and can run on the processor based on interface state and response time, wherein the early warning program based on the interface state and the response time realizes the steps of the early warning method based on the interface state and the response time when being executed by the processor.
In addition, to achieve the above object, the present invention further provides a computer readable storage medium having stored thereon an interface test program, which when executed by a processor, implements the steps of the interface test method as described above.
The invention provides a method, a device, equipment and a medium for testing an interface; the method and the device acquire the corresponding sample data by capturing the interface information called during the page operation and recording the interface information so as to take the sample data as the interface to play back the sample data. When the parameter replacement operation of the sample data is detected, replacing the parameter to be replaced in the sample data according to a preset rule base to obtain corresponding target data; the parameters are replaced and configured in the rule base, so that the method is flexibly adapted to interfaces of different systems, different environments of the same system and scenes of specific parameter changes of the same environment. When an interface playback request of target data is detected, acquiring an interface state and response time corresponding to the target data, and detecting whether an interface corresponding to the interface state and the response time is normal; when the interface abnormality is detected, early warning is carried out according to an early warning strategy; therefore, the problems of high interface test cost and low test efficiency in the development and test process of the service system are solved.
Drawings
FIG. 1 is a schematic diagram of an apparatus architecture of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a first embodiment of an interface testing method according to the present invention;
FIG. 3 is a schematic diagram illustrating a flow chart of an embodiment of the interface testing method according to the present invention;
FIG. 4 is a schematic sub-flowchart of a first embodiment of an interface testing method according to the present invention;
FIG. 5 is a flowchart illustrating a second embodiment of an interface testing method according to the present invention;
FIG. 6 is a flowchart illustrating a third exemplary embodiment of an interface testing method according to the present invention;
fig. 7 is a functional block diagram of the interface testing apparatus according to the first embodiment of the present invention.
The implementation, functional features and advantages of the present invention will be further described with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention.
As shown in fig. 1, fig. 1 is a schematic device structure diagram of a hardware operating environment according to an embodiment of the present invention.
The device of the embodiment of the invention can be a mobile terminal or a server device.
As shown in fig. 1, the apparatus may include: a processor 1001, e.g. a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. The communication bus 1002 is used to implement connection communication among these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory such as a disk memory. The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration of the apparatus shown in fig. 1 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and an interface test program.
The operating system is a program for managing and controlling computer equipment and software resources, and supports the running of a network communication module, a user interface module, an interface test program and other programs or software; the network communication module is used for managing and controlling the network interface 1002; the user interface module is used to manage and control the user interface 1003.
In the computer device shown in fig. 1, the computer device calls an interface test program stored in a memory 1005 through a processor 1001 and performs operations in the various embodiments of the interface test method described below.
Based on the hardware structure, the embodiment of the interface testing method is provided.
Referring to fig. 2, fig. 2 is a schematic flowchart of a first embodiment of an interface testing method according to the present invention, where the interface testing method includes:
step S10, capturing interface information called during page operation, recording the interface information, and obtaining corresponding sample data;
step S20, responding to the parameter replacement operation aiming at the sample data, and performing parameter replacement on the parameter to be replaced in the sample data based on a preset rule base to obtain corresponding target data;
step S30, responding to an interface playback request aiming at the target data, acquiring an interface state and response time corresponding to the target data, and detecting whether an interface corresponding to the interface state and the response time is normal;
and S40, when the interface is detected to be abnormal, early warning is carried out according to an early warning strategy.
In the embodiment, corresponding sample data is obtained by capturing interface information called during page operation and recording the interface information; responding to parameter replacement operation aiming at sample data, selecting the sample data and performing parameter replacement based on a preset rule base to obtain target data corresponding to the parameter replacement operation; responding to an interface playback request aiming at the target data, acquiring an interface state and response time corresponding to the target data, and detecting whether an interface corresponding to the interface state and the response time is normal; when the interface abnormality is detected, early warning is carried out according to an early warning strategy; therefore, the problems of high interface test cost and low test efficiency in the development and test process of the service system are solved.
The respective steps will be described in detail below:
and S10, capturing interface information called during page operation, recording the interface information, and obtaining corresponding sample data.
In this embodiment, during the development and testing process of the service system, a newly developed software interface that needs to be added to the software project is needed. By calling the newly added interface to be detected, the software project can realize new functions. In the process of monitoring the interface to be detected, the newly added interface to be detected can be monitored in real time, and the newly added interface to be detected can also be monitored at intervals of preset time length by setting a timing task.
Referring to fig. 3, fig. 3 is a schematic flow chart illustrating an implementation of the interface testing method according to the present invention. The method mainly comprises the following steps:
recording and storing the interface, wherein interface information called during page operation is mainly captured by an agent tool, and the captured interface is stored in a file or a target database and is used as sample data during interface playback.
The step of parameter replacement and rule base aims at carrying out parameter replacement on the recorded interface sample, and can replace the content in the interface URL/Header/Body according to the requirement to obtain corresponding target data; the parameter replacement is configured in the rule base, can flexibly adapt to interfaces of different systems, different environments of the same system and scenes of specific parameter changes of the same environment.
And the execution module and the result storage mainly comprise interface playback, wherein an interface playback request of the target data is sent to an http request through a script to obtain the state and the response time of the interface, and the result is stored in a file or a target database after being sequenced according to the interface state and the response time of the interface.
Early warning configuration and early warning notification, wherein when the interface abnormality is detected, early warning is carried out according to a preset early warning strategy; specifically, the early warning strategy is matched according to the state returned by the interface and the response time during interface playback, and notification is carried out according to the configured early warning means during matching.
Capturing interface information during page operation through different proxy tools; the interface information includes, but is not limited to, parameter information such as a method name, an interface description, a packet name and a class name of an input parameter mapping table, a packet name and a class name of a return parameter mapping table, and interface related information such as a system identifier, an interface modifier, an interface remark, a calling frequency, a URL (Uniform Resource Locator) corresponding to a test environment, an exposure identifier, and a discard identifier.
The interface information called during the operation of grabbing the page can be obtained through the browser F12, the packet grabbing agent tool or the RESTful API tool.
Recording the interface information to obtain corresponding sample data; and the sample data is used as the sample data when the interface plays back.
Further, in an embodiment, step S10 includes: capturing interface information called during page operation through an agent tool, recording the interface information, obtaining corresponding sample data, and storing the sample data into a target database, wherein the sample data is used as the sample data during interface playback, and the sample data comprises class parameters, method parameters and input parameters corresponding to an interface to be detected.
In one embodiment, interface information called during page operation is captured through a browser F12, a packet capturing agent tool or a RESTful API tool and other agent tools, and the interface information is recorded to obtain corresponding sample data; then, storing the sample data into a target database; wherein, the sample data is used as the sample data when the interface is played back; the sample data includes, but is not limited to, class parameters, method parameters and input parameters corresponding to the interface to be detected.
And the playback of multiple rounds and multiple environments can be completed by recording each system interface once, so that the efficiency of acquiring the interface state and the response time is greatly improved.
And S20, responding to the parameter replacement operation aiming at the sample data, performing parameter replacement on the parameters to be replaced in the sample data based on a preset rule base, and obtaining corresponding target data.
In this embodiment, when a parameter replacement operation for sample data is detected, first, target sample data corresponding to the parameter replacement operation is selected; and then, determining parameters to be replaced in the target sample data, replacing the parameters to be replaced according to a preset rule base, and acquiring corresponding target data.
The preset rule base is a rule base for replacing the preconfigured parameters, the contents in the URL/Header/Body interface can be replaced according to the requirements, the parameter replacement is configured in the rule base, and the preset rule base can flexibly adapt to interfaces of different systems, different environments of the same system and scenes of specific parameter changes of the same environment. If one wants to use one interface sample to play back the IP or domain name in the URL in two environments; if different environments have different basic data, corresponding basic data in the sample interface needs to be replaced by the basic data of the new environment when the interface is played back; if the query interface is queried according to time, the value in the request parameter can be replaced according to the current time.
Step S30, responding to the interface playback request aiming at the target data, acquiring the interface state and the response time corresponding to the target data, and detecting whether the interface state and the interface corresponding to the response time are normal.
In one embodiment, when an interface playback request for target data is detected, first, an interface state and response time corresponding to the target data are obtained; then, detecting whether the interface corresponding to the interface state and the response time is normal; detecting whether the interface state and the response time meet the conditions corresponding to a preset normal interface or not; if the condition corresponding to the normal interface is met, the interface is normal; if the condition corresponding to the normal interface is not met, the interface is abnormal.
Further, in this embodiment, referring to fig. 4, after step S30, the method further includes:
and A10, when the interface is detected to be normal, generating a visual interface detection report, and storing the visual interface detection report into a target database.
In this embodiment, when it is detected that the interface is normal, a visual interface detection report is generated by using the interface state and the response time corresponding to the target data and the response result corresponding to the interface playback request, and is stored in the target database. The visual interface detection report can be further visually processed, for example, information such as the number of the interfaces to be detected passing the test and the response time of each interface to be detected is counted and displayed in a chart form, so that the convenience of checking the detection result is improved.
And S40, when the interface is detected to be abnormal, early warning is carried out according to an early warning strategy.
In the embodiment, when the interface abnormality is detected, the early warning is performed according to a preset early warning strategy; the early warning strategy refers to early warning configuration and early warning notification, and early warning indexes support configuration according to interface states and maximum response time; the specific early warning means supports modes such as mails, short messages, weChat, nailing and the like.
In the process of developing and testing a service system, interface information called during page operation is captured and recorded; the recorded sample data is subjected to interface playback, so that the response time and the interface state of the interface can be tested for multiple times; in this scene, an abnormal interface can be quickly positioned by configuring an early warning strategy; the function of carrying out early warning notification based on early warning configuration is adopted, the state and the response duration of the playback interface are flexibly configured, corresponding screening and filtering are carried out, and an abnormal interface can be directly obtained; therefore, the interface testing efficiency in the business system development testing process is improved and the testing cost is reduced.
Further, in an embodiment, step S40 includes:
and S41, when the interface is detected to be abnormal, carrying out real-time early warning in the interface playback process according to an early warning strategy.
In the embodiment, when the interface abnormality is detected in the interface playback process, real-time early warning is performed according to a preset early warning strategy; specifically, during interface playback, the early warning strategy of response is matched according to the interface state and response time returned by the interface, and notification is carried out according to the configured early warning means during matching.
When the availability of one system interface is verified, the interface monitoring of the system can be executed regularly; when the interface is detected to be abnormal, alarming is carried out according to an early warning strategy, and operation and maintenance personnel are assisted to improve timeliness of finding and solving problems.
Further, in an embodiment, step S40 further includes:
and S41, when the interface abnormality is detected, summarizing the abnormal interfaces with the abnormal interfaces, and after the interface playback request is completed, summarizing and early warning are carried out on the abnormal interfaces according to an early warning strategy.
In this embodiment, when an interface abnormality is detected in the interface playback process, summarizing abnormal interfaces with abnormal interfaces, and after the interface playback request is completed, summarizing and early warning the summarized abnormal interfaces according to a preset early warning strategy; therefore, the time for interface playback is reduced, and the interface testing efficiency in the development and testing process of the service system is improved.
In the embodiment, corresponding sample data is obtained by capturing interface information called during page operation and recording the interface information; responding to parameter replacement operation aiming at sample data, selecting the sample data and performing parameter replacement based on a preset rule base to obtain target data corresponding to the parameter replacement operation; responding to an interface playback request aiming at the target data, acquiring an interface state and response time corresponding to the target data, and detecting whether an interface corresponding to the interface state and the response time is normal; when the interface abnormality is detected, early warning is carried out according to an early warning strategy; therefore, the problems of high interface test cost and low test efficiency in the development and test process of the service system are solved.
Further, based on the first embodiment of the interface testing method of the present invention, a second embodiment of the interface testing method is provided.
The difference between the second embodiment of the interface testing method and the first embodiment of the interface testing method is that, in step S20, in response to a parameter replacement operation for the sample data, the present embodiment performs parameter replacement on a parameter to be replaced in the sample data based on a preset rule base to obtain refinement of corresponding target data, with reference to fig. 5, the step specifically includes:
and S21, responding to the parameter replacement operation aiming at the sample data, and selecting target sample data corresponding to the parameter replacement operation from the sample data.
In this embodiment, after a parameter replacement operation for sample data is detected, a target sample parameter corresponding to the parameter replacement operation is selected from the sample data; determining a parameter to be replaced in the target sample parameters, and replacing the parameter to be replaced according to a preset rule base to obtain corresponding target data; therefore, the parameters are replaced and configured in the rule base in advance, the parameters of the interface to be detected can be replaced before the interface is played back, and the accuracy of the interface test in the development and test process of the service system is improved.
The respective steps will be described in detail below:
and S21, responding to the parameter replacement operation aiming at the sample data, and selecting target sample data corresponding to the parameter replacement operation from the sample data.
In this embodiment, when a parameter replacement operation for sample data is detected, target sample data corresponding to the parameter replacement operation is selected from the sample data. The parameter replacement operation aims at performing parameter replacement on a certain parameter in target sample data, the content in the interface URL/Header/Body can be replaced according to the requirement, and the parameter replacement is configured in the rule base. Wherein, a certain parameter can be determined according to actual requirements; for example, a desire to be able to play back an IP or domain name in a URL in two environments using a set of interface samples requires modification; if different environments have different basic data, corresponding basic data in the sample interface needs to be replaced by the basic data of the new environment when the interface is played back; if the query interface is queried according to time, the value in the request parameter can be replaced according to the current time.
And S22, determining a parameter to be replaced in the target sample data, and performing parameter replacement on the parameter to be replaced based on a preset rule base to obtain target data after parameter replacement.
In this embodiment, after target sample data is selected, parameters to be replaced in the target sample data are determined; and replacing the parameter to be replaced according to a preset rule base to obtain target data after parameter replacement. Wherein, the content in the URL/Header/Body of the parameter to be replaced in the interface is replaced according to the requirement; the parameters are replaced and configured in the rule base in advance, so that the method can be flexibly adapted to interfaces of different systems, different environments of the same system and scenes of specific parameter changes of the same environment. By configuring the parameter replacement in the rule base in advance, the parameter replacement can be carried out on the interface to be detected before the interface is played back, and therefore the accuracy of the interface test in the service system development test process is improved.
In this embodiment, after a parameter replacement operation for sample data is detected, a target sample parameter corresponding to the parameter replacement operation is selected from the sample data; determining parameters to be replaced in the target sample parameters, and replacing the parameters to be replaced according to a preset rule base to obtain corresponding target data; therefore, parameter replacement can be carried out on the interface to be detected before the interface is played back by configuring the parameter replacement in the rule base in advance, and the accuracy of the interface test in the process of developing and testing the service system is improved.
Further, based on the first and second embodiments of the interface testing method of the present invention, a third embodiment of the interface testing method of the present invention is provided.
The difference between the third embodiment of the interface testing method and the first and second embodiments of the interface testing method is that, in step S30, in response to an interface playback request for the target data, the third embodiment of the interface testing method obtains an interface state and response time corresponding to the target data, and detects whether an interface corresponding to the interface state and the response time is normal or not, with reference to fig. 6, the step specifically includes:
step S31, responding to an interface playback request aiming at the target data, acquiring an interface state and response time corresponding to the target data, and storing the interface state and the response time in a target database based on a preset sequence;
and S32, screening the interface state and the response time based on an early warning condition, and detecting whether the interface corresponding to the interface state and the response time is normal.
In this embodiment, when an interface for target data is detected, acquiring an interface state and response time corresponding to the target data, and storing the interface state and the response time into a target database according to a preset sequence; screening the interface state and the response time according to the early warning condition, and detecting whether the interface corresponding to the interface state and the response time is normal; therefore, the method and the device can flexibly configure, correspondingly screen and filter according to the state and the response time length of the playback interface, can directly obtain the abnormal interface, and further improve the testing efficiency of the interface in the development and testing process of the service system.
The respective steps will be described in detail below:
step S31, responding to the interface playback request aiming at the target data, acquiring the interface state and the response time corresponding to the target data, and storing the interface state and the response time in a target database based on a preset sequence.
In this embodiment, when an interface playback request for target data is detected, an interface state and response time corresponding to the target data are obtained; and storing the interface state and the response time into a target database according to a preset arrangement sequence. The preset sequence is a preset arrangement sequence of interface states and response time, and the preset sequence is preferably a time sequence.
And S32, screening the interface state and the response time based on an early warning condition, and detecting whether the interface corresponding to the interface state and the response time is normal.
In this embodiment, the interface state and the response time are screened according to the early warning condition, so that whether the interface corresponding to the interface state and the response time is normal or not can be detected. The early warning condition is that whether the interface is normal or not is detected according to the configuration of the early warning index support according to the interface state and the maximum response time; specifically, interface states and response times corresponding to interfaces in a normal state are preset, and interfaces corresponding to target data are screened according to the preset interface states and response times in the normal state of the interfaces; and further detecting whether the interface corresponding to the interface state and the response time is normal.
Further, when the interface state and the response time do not meet the early warning condition, the interface state and the response time are normal to the used interface;
and when the interface state and the response time meet the early warning condition, the interface state and the response time are abnormal for the interface. Furthermore, in the interface playback process, matching a corresponding early warning strategy according to the interface state and the response time returned by the interface to be detected, and notifying according to a configured early warning means during matching; the interface playback of multiple rounds and multiple environments can be completed by recording each system interface once, so that the interface state and response time acquisition efficiency is greatly improved, and the interface testing efficiency in the service system development testing process is improved.
In this embodiment, when an interface for target data is detected, acquiring an interface state and response time corresponding to the target data, and storing the interface state and the response time into a target database according to a preset sequence; screening the interface state and the response time according to the early warning condition, and detecting whether the interface corresponding to the interface state and the response time is normal; therefore, the method and the device can flexibly configure and correspondingly screen and filter according to the state and the response time of the playback interface, and can directly obtain the abnormal interface, thereby improving the testing efficiency of the interface in the development and testing process of the service system.
The invention also provides an interface testing device. Referring to fig. 7, the interface test apparatus of the present invention includes:
the recording module 10 is configured to capture interface information called during page operation, record the interface information, and obtain corresponding sample data;
a replacing module 20, configured to perform parameter replacement on a parameter to be replaced of the sample data based on a preset rule base in response to a parameter replacement operation for the sample data, and obtain target data corresponding to the parameter replacement operation;
a request module 30, configured to respond to an interface playback request for the target data, obtain an interface state and response time corresponding to the target data, and detect whether an interface corresponding to the interface state and the response time is normal;
and the early warning module 40 is used for carrying out early warning according to an early warning strategy when the interface abnormality is detected.
Furthermore, the present invention also provides a medium, which is a computer readable storage medium, on which an interface test program is stored, and the interface test program implements the steps of the interface test method as described above when executed by a processor.
The method implemented when the interface test program running on the processor is executed may refer to each embodiment of the interface test method of the present invention, and details are not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system 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 system. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages and disadvantages of the embodiments.
Through the description of the foregoing embodiments, it is clear to those skilled in the art that the method of the foregoing embodiments may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but in many cases, the former is a better implementation. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. An interface test method, characterized in that the interface test method comprises the following steps:
capturing interface information called during page operation, and recording the interface information to obtain corresponding sample data;
responding to the parameter replacement operation aiming at the sample data, performing parameter replacement on the parameter to be replaced in the sample data based on a preset rule base, and obtaining corresponding target data;
responding to an interface playback request aiming at the target data, acquiring an interface state and response time corresponding to the target data, and detecting whether an interface corresponding to the interface state and the response time is normal;
and when the interface abnormality is detected, early warning is carried out according to an early warning strategy.
2. The interface testing method according to claim 1, wherein the step of capturing interface information called during page operation and recording the interface information to obtain corresponding sample data comprises:
capturing interface information called during page operation through an agent tool, recording the interface information, obtaining corresponding sample data, and storing the sample data into a target database, wherein the sample data is used as the sample data during interface playback, and the sample data comprises class parameters, method parameters and input parameters corresponding to an interface to be detected.
3. The interface testing method according to claim 1, wherein the step of performing parameter replacement on the parameter to be replaced in the sample data based on a preset rule base in response to the parameter replacement operation for the sample data to obtain corresponding target data comprises:
in response to the parameter replacement operation aiming at the sample data, selecting target sample data corresponding to the parameter replacement operation from the sample data;
and determining parameters to be replaced in the target sample data, and performing parameter replacement on the parameters to be replaced based on a preset rule base to obtain target data after parameter replacement.
4. The interface test method according to claim 1, wherein the step of obtaining the interface status and the response time corresponding to the target data in response to the interface playback request for the target data, and detecting whether the interface corresponding to the interface status and the response time is normal includes:
responding to an interface playback request aiming at the target data, acquiring an interface state and response time corresponding to the target data, and storing the interface state and the response time in a target database based on a preset sequence;
and screening the interface state and the response time based on an early warning condition, and detecting whether the interface corresponding to the interface state and the response time is normal.
5. The interface testing method according to claim 1, wherein after the steps of obtaining the interface status and the response time corresponding to the target data in response to the interface playback request for the target data, and detecting whether the interface corresponding to the interface status and the response time is normal, the method further comprises:
and when the interface is detected to be normal, generating a visual interface detection report, and storing the visual interface detection report into a target database.
6. The interface testing method of claim 1, wherein the step of performing early warning according to an early warning policy when the interface abnormality is detected comprises:
and when the interface is detected to be abnormal, carrying out real-time early warning in the interface playback process according to an early warning strategy.
7. The interface testing method of claim 1, wherein the step of performing early warning according to an early warning policy when the interface abnormality is detected comprises:
when the interface abnormality is detected, summarizing the abnormal interfaces with the abnormal interfaces, and after the interface playback request is completed, summarizing and early warning are carried out on the abnormal interfaces according to an early warning strategy.
8. An interface test apparatus, the interface test apparatus comprising:
the recording module is used for capturing interface information called during page operation, recording the interface information and obtaining corresponding sample data;
the replacing module is used for responding to the parameter replacing operation aiming at the sample data, performing parameter replacing on the parameter to be replaced in the sample data based on a preset rule base, and obtaining corresponding target data;
the request module is used for responding to an interface playback request aiming at the target data, acquiring an interface state and response time corresponding to the target data, and detecting whether an interface corresponding to the interface state and the response time is normal or not;
and the early warning module is used for carrying out early warning according to an early warning strategy when the interface abnormality is detected.
9. A computer device, characterized in that the computer device comprises: memory, a processor and an interface test program stored on the memory and executable on the processor, the interface test program when executed by the processor implementing the steps of the interface test method according to any one of claims 1 to 7.
10. A computer-readable storage medium, having stored thereon an interface test program which, when executed by a processor, implements the steps of the interface test method of any one of claims 1 to 7.
CN202211186133.3A 2022-09-28 2022-09-28 Interface test method, device, equipment and medium Pending CN115292200A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211186133.3A CN115292200A (en) 2022-09-28 2022-09-28 Interface test method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211186133.3A CN115292200A (en) 2022-09-28 2022-09-28 Interface test method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN115292200A true CN115292200A (en) 2022-11-04

Family

ID=83834679

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211186133.3A Pending CN115292200A (en) 2022-09-28 2022-09-28 Interface test method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN115292200A (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109656806A (en) * 2018-10-29 2019-04-19 口碑(上海)信息技术有限公司 A kind of the playback test method and device of interface data
CN110046088A (en) * 2019-02-19 2019-07-23 阿里巴巴集团控股有限公司 A kind of interface test method, device and equipment
CN110888805A (en) * 2019-11-11 2020-03-17 北京仁科互动网络技术有限公司 RESTful API playback test method and system
CN111190827A (en) * 2019-12-30 2020-05-22 航天信息股份有限公司 Interface automation test method and device, storage medium and electronic equipment
CN111767227A (en) * 2020-06-30 2020-10-13 深圳前海微众银行股份有限公司 Recording playback test method and device
WO2020245504A1 (en) * 2019-06-04 2020-12-10 Meeshkan Oy Method and system for integration testing
CN112395184A (en) * 2019-08-19 2021-02-23 中移(苏州)软件技术有限公司 Information acquisition method, equipment and computer storage medium
CN112506788A (en) * 2020-12-16 2021-03-16 北京航天智造科技发展有限公司 Method and device for automatically monitoring microservice interface and storage medium
CN112817867A (en) * 2021-02-25 2021-05-18 平安消费金融有限公司 Interface test script generation method and device, computer equipment and medium
CN112965901A (en) * 2021-03-05 2021-06-15 北京百度网讯科技有限公司 API testing method, server, system and electronic equipment
CN113505068A (en) * 2021-07-09 2021-10-15 杭州遥望网络科技有限公司 Automatic test method, device, equipment and storage medium for HTTP (hyper text transport protocol) interface

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109656806A (en) * 2018-10-29 2019-04-19 口碑(上海)信息技术有限公司 A kind of the playback test method and device of interface data
CN110046088A (en) * 2019-02-19 2019-07-23 阿里巴巴集团控股有限公司 A kind of interface test method, device and equipment
WO2020245504A1 (en) * 2019-06-04 2020-12-10 Meeshkan Oy Method and system for integration testing
CN112395184A (en) * 2019-08-19 2021-02-23 中移(苏州)软件技术有限公司 Information acquisition method, equipment and computer storage medium
CN110888805A (en) * 2019-11-11 2020-03-17 北京仁科互动网络技术有限公司 RESTful API playback test method and system
CN111190827A (en) * 2019-12-30 2020-05-22 航天信息股份有限公司 Interface automation test method and device, storage medium and electronic equipment
CN111767227A (en) * 2020-06-30 2020-10-13 深圳前海微众银行股份有限公司 Recording playback test method and device
CN112506788A (en) * 2020-12-16 2021-03-16 北京航天智造科技发展有限公司 Method and device for automatically monitoring microservice interface and storage medium
CN112817867A (en) * 2021-02-25 2021-05-18 平安消费金融有限公司 Interface test script generation method and device, computer equipment and medium
CN112965901A (en) * 2021-03-05 2021-06-15 北京百度网讯科技有限公司 API testing method, server, system and electronic equipment
CN113505068A (en) * 2021-07-09 2021-10-15 杭州遥望网络科技有限公司 Automatic test method, device, equipment and storage medium for HTTP (hyper text transport protocol) interface

Similar Documents

Publication Publication Date Title
US9356842B2 (en) Method and system for browser based, non-intrusive measuring of end-user perceived performance of individual third party resource requests
CN111045952A (en) Software testing method, flow playback device, terminal equipment and readable storage medium
US8850398B1 (en) Automated testing of application programs from an application program ecosystem
CN109885496B (en) Test log management method and system
CN109995614B (en) Alpha testing method and device
US20160020986A1 (en) Method and system for aggregating diagnostic analyzer related information
CN111090592A (en) Automatic testing method of buried point, terminal and readable storage medium
CN111045879B (en) Method, device and storage medium for generating pressure test report
JP2015165636A (en) Detecting device, detecting method, and detecting program
CN103678380A (en) Test state presentation and anomaly indexing system and method
CN113495820B (en) Anomaly information collecting and processing method and device and anomaly monitoring system
CN104683181A (en) Performance monitoring method, equipment and system
CN115904860A (en) Micro-service detection method, device, equipment and storage medium
CN114661551A (en) Method and device for monitoring software running state and computer readable storage medium
CN116719750B (en) Software testing method and device, server equipment and storage medium
CN112749059A (en) Front-end abnormity monitoring method, device and system
CN106484601B (en) User data analysis method and system for client
CN115292200A (en) Interface test method, device, equipment and medium
CN107483294B (en) Method and device for monitoring network request
CN107800560B (en) Network detection method and device, and network detection query method and device
KR101828156B1 (en) Transaction Monitoring System and Operating method thereof
JP2019082941A (en) Log collection system and program
CN107102938B (en) Test script updating method and device
CN115695275B (en) Root zone record monitoring method, system, equipment and readable storage medium
CN110430093B (en) Data processing method and device and computer readable 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
RJ01 Rejection of invention patent application after publication

Application publication date: 20221104

RJ01 Rejection of invention patent application after publication