CN110046067B - Interface testing method and device - Google Patents

Interface testing method and device Download PDF

Info

Publication number
CN110046067B
CN110046067B CN201910324322.4A CN201910324322A CN110046067B CN 110046067 B CN110046067 B CN 110046067B CN 201910324322 A CN201910324322 A CN 201910324322A CN 110046067 B CN110046067 B CN 110046067B
Authority
CN
China
Prior art keywords
data
tested
interface
response data
distinguishing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910324322.4A
Other languages
Chinese (zh)
Other versions
CN110046067A (en
Inventor
于剑锋
洪克锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wireless Life Hangzhou Information Technology Co ltd
Original Assignee
Wireless Life Hangzhou 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 Wireless Life Hangzhou Information Technology Co ltd filed Critical Wireless Life Hangzhou Information Technology Co ltd
Priority to CN201910324322.4A priority Critical patent/CN110046067B/en
Publication of CN110046067A publication Critical patent/CN110046067A/en
Application granted granted Critical
Publication of CN110046067B publication Critical patent/CN110046067B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2205Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
    • G06F11/221Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested to test buses, lines or interfaces, e.g. stuck-at or open line faults
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The disclosure relates to an interface testing method and device, wherein the method comprises the following steps: sending request data to an interface to be tested, and receiving response data to be tested returned by the interface to be tested; determining to-be-tested distinguishing data between the to-be-tested response data and pre-stored normal response data; identifying the distinguishing data to be tested through a trained classifier to obtain an identification result; and when the identification result is that the to-be-tested distinguishing data are normal, determining that the interface to be tested passes detection. According to the technical scheme, the automatic detection can be performed, the labor cost is reduced, the to-be-detected distinguishing data between the to-be-detected response data and the pre-stored normal response data is detected, the noise of the response data can be effectively reduced, and the detection accuracy is improved.

Description

Interface testing method and device
Technical Field
The disclosure relates to the field of computer technology, and in particular, to an interface testing method and device.
Background
With the development of computer technology, the complexity of systems and software has increased, and interface testing has become increasingly important in order to ensure that data interaction between systems or software is performed properly.
The current interface test method is to send a request to an interface, detect response data after the interface returns the response data, and if the response data is normal, the interface passes the detection. The existing test method is to write an automatic test script for testing, but each verification needs to manually set an assertion for verification, one assertion can only verify one field, and the labor cost is high; yet another method is to visually display the response data, and manually determine whether the response data is normal or not, which is also costly.
Disclosure of Invention
The embodiment of the disclosure provides an interface testing method and device. The technical scheme is as follows:
according to a first aspect of an embodiment of the present disclosure, there is provided an interface testing method, including:
sending request data to an interface to be tested, and receiving response data to be tested returned by the interface to be tested;
determining to-be-tested distinguishing data between the to-be-tested response data and pre-stored normal response data;
identifying the distinguishing data to be tested through a trained classifier to obtain an identification result;
and when the identification result is that the to-be-tested distinguishing data are normal, determining that the interface to be tested passes detection.
In one embodiment, the method further comprises:
acquiring first historical response data which is returned by the interface type and passes the test aiming at the request data when the interface type is the interface to be tested;
taking distinguishing data between any two first historical response data as positive samples;
training an initial classifier by using sample data, and continuously modifying parameters of the initial classifier until the accuracy of the identification result of the trained classifier exceeds a preset threshold, wherein the sample data comprises the positive sample.
In one embodiment, the sample data further comprises a negative sample, the method further comprising:
acquiring second historical response data which is returned by the interface type to the interface to be tested and is not passed by the test aiming at the request data;
and taking distinguishing data between any one of the second historical response data and any one of the first historical response data as a negative sample.
In one embodiment, the method further comprises:
and when the identification result is that the to-be-tested distinguishing data is abnormal, determining that the interface to be tested fails the test.
According to a second aspect of embodiments of the present disclosure, there is provided an interface test apparatus, including:
the transmission module is used for sending request data to an interface to be tested and receiving response data to be tested returned by the interface to be tested;
the first determining module is used for determining to-be-tested distinguishing data between the to-be-tested response data and pre-stored normal response data;
the identification module is used for identifying the data to be tested and distinguished through a trained classifier to obtain an identification result;
and the second determining module is used for determining that the interface to be detected passes detection when the identification result is that the data to be detected are normal.
In one embodiment, the apparatus further comprises:
the first acquisition module is used for acquiring first historical response data which is returned by the interface type to the request data and passes the test when the interface type is the interface to be tested;
the first sample module is used for taking distinguishing data between any two pieces of first historical response data as positive samples;
and the training module is used for training the initial classifier by using sample data, and continuously modifying parameters of the initial classifier until the accuracy of the identification result of the trained classifier exceeds a preset threshold value, wherein the sample data comprises the positive sample.
In one embodiment, the sample data further comprises a negative sample, the apparatus further comprising:
the second acquisition module is used for acquiring second historical response data which is returned by the interface type to the interface to be tested and is not passed by the test aiming at the request data;
and the second sample module is used for taking distinguishing data between any one of the second historical response data and any one of the first historical response data as a negative sample.
In one embodiment, the apparatus further comprises:
and when the identification result is that the to-be-tested distinguishing data is abnormal, determining that the interface to be tested fails the test.
According to a third aspect of the embodiments of the present disclosure, there is provided an interface test apparatus, including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the steps of the method of any one of claims 1 to 4.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps in the above-described method.
The technical scheme provided by the embodiment of the disclosure can comprise the following beneficial effects: the embodiment can send request data to the interface to be tested and receive response data to be tested returned by the interface to be tested; determining to-be-tested distinguishing data between the to-be-tested response data and pre-stored normal response data; identifying the distinguishing data to be tested through a trained classifier to obtain an identification result; when the identification result is that the to-be-tested distinguishing data are normal, determining that the interface to be tested passes detection; therefore, the test points are not required to be set by manual writing and assertion, whether the response data are normal or not is not required to be judged by naked eyes by manual operation, the automatic detection can be carried out, the labor cost is reduced, the to-be-detected distinguishing data between the to-be-detected response data and the pre-stored normal response data are detected, the noise of the response data can be effectively reduced, and the detection accuracy is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure.
Fig. 1 is a flow chart illustrating a method of interface testing according to an exemplary embodiment.
Fig. 2 is a flow chart illustrating a method of interface testing according to an exemplary embodiment.
Fig. 3 is a block diagram illustrating an interface testing apparatus according to an exemplary embodiment.
Fig. 4 is a block diagram illustrating an interface testing apparatus according to an exemplary embodiment.
Fig. 5 is a block diagram illustrating an interface test apparatus according to an exemplary embodiment.
Fig. 6 is a block diagram illustrating an interface test apparatus according to an exemplary embodiment.
Fig. 7 is a block diagram illustrating an interface test apparatus according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
Fig. 1 is a flowchart illustrating an interface testing method, as shown in fig. 1, for use in a terminal, according to an exemplary embodiment, comprising the following steps 101-104:
in step 101, request data is sent to an interface to be tested, and response data to be tested returned by the interface to be tested is received.
Here, when the terminal wants to detect whether an interface is normal, the terminal sends request data to the interface and receives response data returned by the interface, the terminal can determine whether the interface is normal by checking whether the response data is normal, if the response data is normal, the terminal determines that the interface is normal, and if the response data is abnormal, the terminal determines that the interface is abnormal. In this embodiment, the interface to be detected is referred to as an interface to be detected, and the response data returned by the interface to be detected is referred to as response data to be detected.
Here, the data type of the response data is text-like data, and may be, for example, data in a format of JSON (JavaScript object notation) or XML (extensible markup language), and the like, which is not particularly limited in this embodiment.
In step 102, the data for distinguishing between the data for distinguishing and the pre-stored normal response data is determined.
Here, for the interfaces of the same kind, if the interfaces are normal interfaces, the response data returned by the interfaces for the same request data should be similar, and may only have some parameters different, if one interface is an abnormal interface, the response data returned by the abnormal interface is different from the response data returned by the normal interface, so in this embodiment, when detecting the interface to be detected, the terminal only needs to check the distinguishing data between the response data to be detected returned by the interface to be detected and the pre-stored normal response data, namely the distinguishing data to be detected, if the distinguishing data to be detected is normal, the distinguishing between the response data to be detected and the normal response data is indicated as normal distinguishing, and the response data to be detected is normal data. If the data to be tested is abnormal, the difference between the response data to be tested and the normal response data is abnormal, and the response data to be tested is abnormal.
Here, the terminal may first determine the discrimination data between the discrimination data and the pre-stored normal response data, so as to detect whether the discrimination data is normal or not.
In step 103, the data to be tested and distinguished are identified through a trained classifier, and an identification result is obtained.
Here, a trained classifier may be pre-stored in the terminal, and the trained classifier is used for classifying the data to be tested, and may divide the data to be tested into normal data and abnormal data. The terminal can input the distinguishing data to be tested into the classifier, and the classifier can output an identification result, wherein the identification result can be that the distinguishing data to be tested is normal or that the distinguishing data to be tested is abnormal.
It should be noted that, the classifier pre-stored in the terminal may be trained by the terminal itself, or may be sent to the terminal after other devices are trained, which is not limited in this embodiment.
In step 104, when the identification result is that the to-be-tested distinguishing data is normal, determining that the to-be-tested interface passes the test.
Here, when the identification result is that the data to be tested is normal, it indicates that the difference between the data to be tested and the normal response data is normal, and the data to be tested is normal, at this time, it can be determined that the interface to be tested is detected and the interface is normal.
The embodiment can send request data to the interface to be tested and receive response data to be tested returned by the interface to be tested; determining to-be-tested distinguishing data between the to-be-tested response data and pre-stored normal response data; identifying the distinguishing data to be tested through a trained classifier to obtain an identification result; when the identification result is that the to-be-tested distinguishing data are normal, determining that the interface to be tested passes detection; therefore, the test points are not required to be set by manual writing and assertion, whether the response data are normal or not is not required to be judged by naked eyes by manual operation, the automatic detection can be carried out, the labor cost is reduced, the to-be-detected distinguishing data between the to-be-detected response data and the pre-stored normal response data are detected, the noise of the response data can be effectively reduced, the detection accuracy is improved, and the verification range is wider.
In one possible implementation manner, the interface testing method may further include the following steps A1 to A3.
In step A1, first historical response data of passing of the test returned by the request data when the interface type is the interface to be tested is obtained.
In step A2, distinguishing data between any two of the first historical response data is taken as a positive sample.
In step A3, training an initial classifier by using sample data, and continuously modifying parameters of the initial classifier until the accuracy of the recognition result of the trained classifier exceeds a preset threshold, wherein the sample data comprises the positive sample.
The method comprises the steps that a trained classifier prestored in a terminal is trained by the terminal, the terminal can firstly collect first historical response data which are returned by the interface type to be tested and pass through a test for the request data when the interface type is the interface to be tested, then the classifier is trained by taking distinguishing data between any two pieces of first historical response data as positive samples, the terminal can input the first historical response data into an initial classifier, if the identification result output by the classifier is normal, the identification result is correct, and if the identification result output by the classifier is abnormal, the identification result is wrong; if the identification result is wrong, the terminal can modify the parameters in the classifier, the terminal can continuously modify the parameters of the classifier until the accuracy of the identification result of the classifier after the parameters are modified exceeds a preset threshold value such as 99%, and the like, and the classifier obtained at the moment is a trained classifier which can accurately identify normal distinguishing data.
Here, the first historical response data acquired by the terminal is massive, the terminal determines the distinguishing data between any two pieces of first historical response data, the calculated amount is large, and in order to ensure the diversity of samples and reduce the calculated amount, the terminal can only determine the distinguishing data between two adjacent pieces of first historical response data as positive samples.
For example, for interface a, the terminal may collect a batch of json type response data returned by interface a for the request data: json1, json2, json3, json4, … …, json. The json1 and json2 are compared by using jsondiff (comparing the contents of the two files), the difference data of json1 and json2 is marked as d1, the difference data d1 of json1 and json2, the difference data d2 of json2 and json3, the difference data dn-1 of json n-1 and json n of … … are sequentially obtained by using the diff mode, and thus positive samples [ d1, d2, d3, … …, d n-1] can be obtained, and the positive samples are trained to obtain the classifier C1. When the terminal obtains the to-be-tested response data json X returned by the to-be-tested interface A, the json X is used for comparing with normal response data to obtain to-be-tested distinguishing data test_d, a classifier C1 is used for judging the test_d, and when the identification result is that the to-be-tested distinguishing data is normal, the to-be-tested interface is determined to pass detection.
According to the embodiment, the trained classifier can be obtained by training the distinguishing data between any two normal first historical response data as positive samples, and the implementation is simple.
In a possible implementation manner, the sample data further includes a negative sample, and the interface test method may further include the following steps B1 and B2.
In step B1, second historical response data which is returned for the request data and is not passed by the test when the interface type is the interface to be tested is obtained.
In step B2, distinguishing data between any one of the second historical response data and any one of the first historical response data is taken as a negative sample.
Here, to increase the accuracy of the classifier identification, the terminal may also take some negative samples to identify the classifier. The terminal can acquire second historical response data which is returned by the interface type to the interface to be tested and is not passed by the test aiming at the request data, namely, acquire abnormal second historical response data, and then the terminal can take distinguishing data between the abnormal second historical response data and any one of the first historical response data as a negative sample.
Here, when the terminal trains the classifier, after inputting the negative sample, if the recognition result output by the classifier is normal, the recognition result is wrong, and if the recognition result output by the classifier is abnormal, the recognition result is correct; the terminal may train the classifier using the positive and negative samples together until the accuracy of the recognition result of the classifier is above a preset threshold.
Here, it should be noted that, the terminal may take the distinguishing data between the second historical response data and the same first historical response data as a negative sample, and the normal response data pre-stored in the terminal and compared with the to-be-tested response data may also be the same first historical response data, which is not limited herein.
According to the embodiment, the classifier can be trained by taking the distinguishing data between any one of the first historical response data and any one of the second historical response data as a negative sample, so that the recognition accuracy of the classifier can be enhanced.
In one possible embodiment, the interface testing method may further include the following step C1.
In step C1, when the identification result is that the to-be-tested distinguishing data is abnormal, determining that the interface to be tested fails the test.
If the identification result output by the classifier is abnormal, the difference between the response data to be tested and the normal response data is abnormal, and the response data to be tested is abnormal, at this time, the interface to be tested can be determined to be not detected, and the interface is abnormal, and at this time, maintenance personnel are required to maintain the interface.
In this embodiment, when the identification result is that the to-be-tested distinguishing data is abnormal, it may be determined that the interface to be tested fails the test, so that maintenance personnel can repair the interface.
The implementation is described in detail below by way of several embodiments.
Fig. 2 is a flow chart of an interface testing method, which may be implemented by a detection device, such as a terminal, as shown in fig. 2, according to an exemplary embodiment, including steps 201-210.
In step 201, first historical response data that passes the test returned for the request data when the interface type is the interface to be tested is obtained.
In step 202, distinguishing data between any two of the first historical response data is taken as a positive sample.
In step 203, second historical response data that is returned for the request data and that fails the test when the interface type is the interface to be tested is obtained.
In step 204, distinguishing data between any of the second historical response data and any of the first historical response data is taken as a negative sample.
In step 205, training an initial classifier by using sample data, where the sample data includes the positive sample and the negative sample, and continuously modifying parameters of the initial classifier until a correct rate of an identification result of the trained classifier exceeds a preset threshold.
In step 206, the request data is sent to the interface to be tested, and the response data to be tested returned by the interface to be tested is received.
In step 207, the data for the discrimination to be tested between the data for the response to be tested and pre-stored normal response data is determined.
In step 208, the data to be tested is identified by a trained classifier, so as to obtain an identification result.
In step 209, when the identification result is that the to-be-tested distinguishing data is normal, it is determined that the to-be-tested interface passes detection.
In step 210, when the identification result is that the to-be-tested distinguishing data is abnormal, it is determined that the to-be-tested interface fails the test.
The following are device embodiments of the present disclosure that may be used to perform method embodiments of the present disclosure.
Fig. 3 is a block diagram of an interface testing apparatus that may be implemented as part or all of an electronic device by software, hardware, or a combination of both, according to an example embodiment. As shown in fig. 3, the interface test apparatus includes:
the transmission module 301 is configured to send request data to an interface to be tested, and receive response data to be tested returned by the interface to be tested;
a first determining module 302, configured to determine to-be-tested distinguishing data between the to-be-tested response data and pre-stored normal response data;
the identifying module 303 is configured to identify the to-be-tested distinguishing data through a trained classifier, so as to obtain an identifying result;
and the second determining module 304 is configured to determine that the interface to be tested passes detection when the identification result is that the data to be tested is normal.
As a possible embodiment, fig. 4 is a block diagram of an interface testing apparatus according to an exemplary embodiment, and as shown in fig. 4, the interface testing apparatus disclosed above may be further configured to include a first acquisition module 305, a first sample module 306, and a training module 307, where:
a first obtaining module 305, configured to obtain first historical response data that passes the test returned for the request data when the interface type is the interface to be tested;
a first sample module 306, configured to take distinguishing data between any two of the first historical response data as positive samples;
the training module 307 is configured to train the initial classifier by using sample data, and continuously modify parameters of the initial classifier until a correct rate of a recognition result of the trained classifier exceeds a preset threshold, where the sample data includes the positive sample.
As a possible embodiment, fig. 5 is a block diagram of an interface testing apparatus according to an exemplary embodiment, where, as shown in fig. 5, the sample data further includes a negative sample, and the above disclosed interface testing apparatus may be further configured to include a second acquisition module 308 and a second sample module 309, where:
a second obtaining module 308, configured to obtain second historical response data that is returned for the request data and that fails the test when the interface type is the interface to be tested;
a second sample module 309, configured to take as a negative sample distinguishing data between any of the second historical response data and any of the first historical response data.
As a possible embodiment, fig. 6 is a block diagram of an interface testing apparatus according to an exemplary embodiment, and as shown in fig. 6, the interface testing apparatus disclosed above may further be configured to include a third determining module 310, where:
and a third determining module 310, configured to determine that the interface to be tested fails the test when the identification result is that the data to be tested is abnormal.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Fig. 7 is a block diagram illustrating an interface test apparatus according to an exemplary embodiment. For example, the apparatus 700 may be provided as a terminal. The apparatus 700 includes a processing component 711 that further includes one or more processors, and memory resources represented by memory 712, for storing instructions, such as application programs, executable by the processing component 711. The application programs stored in memory 712 may include one or more modules that each correspond to a set of instructions. Further, the processing component 711 is configured to execute instructions to perform the above-described methods.
The apparatus 700 may further comprise a power supply component 713 configured to perform power management of the apparatus 700, a wired or wireless network interface 714 configured to connect the apparatus 700 to a network, and an input output (I/O) interface 715. The apparatus 700 may operate based on an operating system stored in the memory 712, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, or the like.
A non-transitory computer readable storage medium, which when executed by a processor of apparatus 700, enables apparatus 700 to perform the interface testing method described above, the method comprising:
sending request data to an interface to be tested, and receiving response data to be tested returned by the interface to be tested;
determining to-be-tested distinguishing data between the to-be-tested response data and pre-stored normal response data;
identifying the distinguishing data to be tested through a trained classifier to obtain an identification result;
and when the identification result is that the to-be-tested distinguishing data are normal, determining that the interface to be tested passes detection.
In one embodiment, the method further comprises:
acquiring first historical response data which is returned by the interface type and passes the test aiming at the request data when the interface type is the interface to be tested;
taking distinguishing data between any two first historical response data as positive samples;
training an initial classifier by using sample data, and continuously modifying parameters of the initial classifier until the accuracy of the identification result of the trained classifier exceeds a preset threshold, wherein the sample data comprises the positive sample.
In one embodiment, the sample data further comprises a negative sample, the method further comprising:
acquiring second historical response data which is returned by the interface type to the interface to be tested and is not passed by the test aiming at the request data;
and taking distinguishing data between any one of the second historical response data and any one of the first historical response data as a negative sample.
In one embodiment, the method further comprises:
and when the identification result is that the to-be-tested distinguishing data is abnormal, determining that the interface to be tested fails the test.
The embodiment also provides an interface testing device, which comprises:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
sending request data to an interface to be tested, and receiving response data to be tested returned by the interface to be tested;
determining to-be-tested distinguishing data between the to-be-tested response data and pre-stored normal response data;
identifying the distinguishing data to be tested through a trained classifier to obtain an identification result;
and when the identification result is that the to-be-tested distinguishing data are normal, determining that the interface to be tested passes detection.
In one embodiment, the processor may be further configured to:
the method further comprises the steps of:
acquiring first historical response data which is returned by the interface type and passes the test aiming at the request data when the interface type is the interface to be tested;
taking distinguishing data between any two first historical response data as positive samples;
training an initial classifier by using sample data, and continuously modifying parameters of the initial classifier until the accuracy of the identification result of the trained classifier exceeds a preset threshold, wherein the sample data comprises the positive sample.
In one embodiment, the processor may be further configured to:
the sample data further includes a negative sample, the method further comprising:
acquiring second historical response data which is returned by the interface type to the interface to be tested and is not passed by the test aiming at the request data;
and taking distinguishing data between any one of the second historical response data and any one of the first historical response data as a negative sample.
In one embodiment, the processor may be further configured to:
the method further comprises the steps of:
and when the identification result is that the to-be-tested distinguishing data is abnormal, determining that the interface to be tested fails the test.
In one embodiment, the processor may be further configured to:
other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (8)

1. An interface testing method, comprising:
sending request data to an interface to be tested, and receiving response data to be tested returned by the interface to be tested;
determining to-be-tested distinguishing data between the to-be-tested response data and pre-stored normal response data, wherein the to-be-tested distinguishing data comprises the following steps of: the response data comprises json type response data, and the content of the two json files is compared in a json diff mode to obtain distinguishing data;
identifying the distinguishing data to be tested through a trained classifier to obtain an identification result;
when the identification result is that the to-be-tested distinguishing data are normal, determining that the interface to be tested passes detection;
the method further comprises the steps of:
acquiring a plurality of first historical response data which are returned by the interface type to the request data and pass the test when the interface type is the interface to be tested;
taking as positive samples distinguishing data between every adjacent two of the plurality of first historical response data, comprising: comparing the contents of two adjacent json files by using a json diff mode to obtain distinguishing data, and taking a set formed by a plurality of distinguishing data as a positive sample;
and training the initial classifier by using sample data, and continuously modifying parameters of the initial classifier until the accuracy of the identification result of the trained classifier exceeds a preset threshold, wherein the sample data is the positive sample.
2. The method of claim 1, wherein the sample data further comprises a negative sample, the method further comprising:
acquiring second historical response data which is returned by the interface type to the interface to be tested and is not passed by the test aiming at the request data;
and taking distinguishing data between any one of the second historical response data and any one of the first historical response data as a negative sample.
3. The method according to claim 1, wherein the method further comprises:
and when the identification result is that the to-be-tested distinguishing data is abnormal, determining that the interface to be tested fails the test.
4. An interface testing apparatus, comprising:
the transmission module is used for sending request data to an interface to be tested and receiving response data to be tested returned by the interface to be tested;
the first determining module is used for determining to-be-tested distinguishing data between the to-be-tested response data and pre-stored normal response data, and comprises the following steps: the response data comprises json type response data, and the content of the two json files is compared in a json diff mode to obtain distinguishing data;
the identification module is used for identifying the data to be tested and distinguished through a trained classifier to obtain an identification result;
the second determining module is used for determining that the interface to be detected passes detection when the identification result is that the data to be detected are normal;
the apparatus further comprises:
the first acquisition module is used for acquiring first historical response data which is returned by the interface type to the request data and passes the test when the interface type is the interface to be tested;
the first sample module is used for taking distinguishing data between every two adjacent first historical response data as positive samples, and comprises the following steps: comparing the contents of two adjacent json files by using a json diff mode to obtain distinguishing data;
the training module is used for training the initial classifier by using sample data, and continuously modifying parameters of the initial classifier until the accuracy of the identification result of the trained classifier exceeds a preset threshold, wherein the sample data is the positive sample.
5. The apparatus of claim 4, wherein the sample data further comprises a negative sample, the apparatus further comprising:
the second acquisition module is used for acquiring second historical response data which is returned by the interface type to the interface to be tested and is not passed by the test aiming at the request data;
and the second sample module is used for taking distinguishing data between any one of the second historical response data and any one of the first historical response data as a negative sample.
6. The apparatus of claim 4, wherein the apparatus further comprises:
and the third determining module is used for determining that the interface to be tested fails the test when the identification result is that the data to be tested is abnormal.
7. An interface testing apparatus, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the steps of the method of any one of claims 1 to 3.
8. A computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the method of any one of claims 1 to 3.
CN201910324322.4A 2019-04-22 2019-04-22 Interface testing method and device Active CN110046067B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910324322.4A CN110046067B (en) 2019-04-22 2019-04-22 Interface testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910324322.4A CN110046067B (en) 2019-04-22 2019-04-22 Interface testing method and device

Publications (2)

Publication Number Publication Date
CN110046067A CN110046067A (en) 2019-07-23
CN110046067B true CN110046067B (en) 2023-10-31

Family

ID=67278346

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910324322.4A Active CN110046067B (en) 2019-04-22 2019-04-22 Interface testing method and device

Country Status (1)

Country Link
CN (1) CN110046067B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111198821B (en) * 2020-01-06 2021-07-16 瑞庭网络技术(上海)有限公司 Interface abnormity judgment method and device and readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5341142A (en) * 1987-07-24 1994-08-23 Northrop Grumman Corporation Target acquisition and tracking system
AU2001253675A1 (en) * 2000-04-26 2002-01-24 Eyepoint Pharmaceuticals Us, Inc. Sustained release drug delivery devices, methods of use, and methods of manufacturing thereof
CN103092761A (en) * 2013-02-05 2013-05-08 烽火通信科技股份有限公司 Method and device of recognizing and checking modifying code blocks based on difference information file
US9665288B1 (en) * 2013-12-26 2017-05-30 EMC IP Holding Company LLC Techniques for determining workload skew
CN107194433A (en) * 2017-06-14 2017-09-22 电子科技大学 A kind of Radar range profile's target identification method based on depth autoencoder network
JP2018049565A (en) * 2016-09-23 2018-03-29 株式会社東芝 System for software verification and software verification method
CN109189622A (en) * 2018-08-21 2019-01-11 上海起作业信息科技有限公司 Interface test method and device, electronic equipment, storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6375972B1 (en) * 2000-04-26 2002-04-23 Control Delivery Systems, Inc. Sustained release drug delivery devices, methods of use, and methods of manufacturing thereof
US7426497B2 (en) * 2004-08-31 2008-09-16 Microsoft Corporation Method and apparatus for analysis and decomposition of classifier data anomalies
EP2381367A1 (en) * 2010-04-20 2011-10-26 Siemens Aktiengesellschaft Method and apparatus for the performing unit testing of software modules in software systems
JP2018156711A (en) * 2017-03-21 2018-10-04 東芝メモリ株式会社 Memory controller and data reading method
US10838848B2 (en) * 2017-06-01 2020-11-17 Royal Bank Of Canada System and method for test generation

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5341142A (en) * 1987-07-24 1994-08-23 Northrop Grumman Corporation Target acquisition and tracking system
AU2001253675A1 (en) * 2000-04-26 2002-01-24 Eyepoint Pharmaceuticals Us, Inc. Sustained release drug delivery devices, methods of use, and methods of manufacturing thereof
CN103092761A (en) * 2013-02-05 2013-05-08 烽火通信科技股份有限公司 Method and device of recognizing and checking modifying code blocks based on difference information file
US9665288B1 (en) * 2013-12-26 2017-05-30 EMC IP Holding Company LLC Techniques for determining workload skew
JP2018049565A (en) * 2016-09-23 2018-03-29 株式会社東芝 System for software verification and software verification method
CN107194433A (en) * 2017-06-14 2017-09-22 电子科技大学 A kind of Radar range profile's target identification method based on depth autoencoder network
CN109189622A (en) * 2018-08-21 2019-01-11 上海起作业信息科技有限公司 Interface test method and device, electronic equipment, storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于k-邻近算法的手写识别系统的研究与实现;辛英;;电子设计工程(第07期);全文 *

Also Published As

Publication number Publication date
CN110046067A (en) 2019-07-23

Similar Documents

Publication Publication Date Title
US11029260B2 (en) Solder paste printing quality inspection system and method
US10684321B2 (en) Printed circuit board inspecting apparatus, method for detecting anomaly in solder paste and computer readable recording medium
CN109947651B (en) Artificial intelligence engine optimization method and device
CN112069070A (en) Page detection method, device, server and computer readable storage medium
CN106802898B (en) Data entry method and device
CN110046067B (en) Interface testing method and device
US20200225279A1 (en) Smart decision feedback device and method for inspecting circuit board
CN116840072B (en) Automatic checking system for electronic connector
CN110309057B (en) Automatic script-based flow project testing method and related equipment
CN115859065A (en) Model evaluation method, device, equipment and storage medium
CN115373984A (en) Code coverage rate determining method and device
CN110633204B (en) Program defect detection method and device
CN111010365B (en) External hanging detection method and device based on login data and computer equipment
CN112015645A (en) Function test method and device of web system and electronic equipment
KR20230024160A (en) System and method for semantic segmentation learning data error detection and correction
CN112905488A (en) Link testing method and device, computer equipment and storage medium
CN111132052A (en) Intelligent safety campus positioning method, system, equipment and readable storage medium
CN117171547B (en) Fault diagnosis method, device, equipment and storage medium based on large model
CN113986603B (en) Method and device for determining page loading abnormity reason and storage medium
CN110572221A (en) automatic test system and test method for wireless network card signals
CN117828499B (en) PCBA abnormal part determination method, system, storage medium and electronic equipment
CN113848210A (en) Material qualitative method and qualitative system based on material detection data
CN112416768A (en) Interactive security vulnerability detection method, system, device and readable storage medium
CN117851226A (en) Verification method, device, equipment and storage medium for system test
CN117171547A (en) Fault diagnosis method, device, equipment and storage medium based on large model

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant