CN111478969A - Interface checking method and device - Google Patents

Interface checking method and device Download PDF

Info

Publication number
CN111478969A
CN111478969A CN202010274577.7A CN202010274577A CN111478969A CN 111478969 A CN111478969 A CN 111478969A CN 202010274577 A CN202010274577 A CN 202010274577A CN 111478969 A CN111478969 A CN 111478969A
Authority
CN
China
Prior art keywords
interface
response message
request
preset
generating
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
CN202010274577.7A
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.)
Jilin Yillion Bank Co ltd
Original Assignee
Jilin Yillion Bank 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 Jilin Yillion Bank Co ltd filed Critical Jilin Yillion Bank Co ltd
Priority to CN202010274577.7A priority Critical patent/CN111478969A/en
Publication of CN111478969A publication Critical patent/CN111478969A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Environmental & Geological Engineering (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention provides an interface checking method and device, wherein the method comprises the following steps: when a verification instruction is received, determining an interface corresponding to the verification instruction, and determining an interface document corresponding to the interface; generating a test case corresponding to the interface according to the interface document, and generating a request message corresponding to the test case; sending the request message to a preset server, triggering the server to check an interface according to the request message, and generating a response message corresponding to the request message; and receiving response messages fed back by the server, judging whether the return code of each response message is the same as the preset return code corresponding to the response message, and if the return code of each response message is the same as the preset response message of the return code, passing the interface verification. By applying the invention, the test case and the request message of the interface can be quickly generated, the interface is verified, the occurrence of missing test caused by human factors is reduced, the time and the labor are saved, and the efficiency of verifying the interface is effectively improved.

Description

Interface checking method and device
Technical Field
The present invention relates to the field of interface verification technologies, and in particular, to an interface verification method and apparatus.
Background
Before various applications or various systems are put into use, a series of tests must be carried out on interfaces for realizing functions of the applications or the systems to judge whether the applications or the systems are normal or not, so that the applications or the systems can be ensured to be stably used by users after being put into an application market.
With the increasing demands of users, the number of interfaces of a system or an application program is continuously increased according to various demands of users, each interface is different, the workload of interface verification is increasingly heavy, and the current interface verification method is difficult to meet the increasing workload of interface verification, so that the efficiency of interface verification is very low.
Disclosure of Invention
In view of the above, the present invention provides an interface verification method and apparatus, and by applying the present invention, a standard formatted interface document can be dynamically read, a test case can be automatically generated, a request message for assembly can be automatically sent to a server, and a response message can be compared, so as to improve the efficiency of interface verification.
In order to achieve the purpose, the invention provides the following technical scheme:
an interface verification method, comprising:
when a verification instruction is received, determining an interface corresponding to the verification instruction, and determining an interface document corresponding to the interface;
generating each test case corresponding to the interface according to the interface document, and generating a request message corresponding to each test case;
sending each request message to a preset server according to a request mode and a request address in the interface document, triggering the server to check the interface according to each request message, and generating a response message corresponding to each request message;
receiving each response message fed back by the server, and determining a return code of each response message;
for each response message, judging whether the return code of the response message is the same as the preset return code of the response message;
and if the return code of each response message is the same as the preset return code of the response message, the interface passes the verification.
Optionally, in the foregoing method, generating each test case corresponding to the interface according to the interface document includes:
reading the interface document, and acquiring each field attribute of each field of the interface in the interface document;
generating each test data of each field according to the field attribute;
and combining all the test data according to a preset combination rule to obtain at least one combined test data, wherein the test data in the combined test data corresponds to the fields one by one, and the combined test data is determined as the test case of the interface.
Optionally, the generating a request packet corresponding to each test case includes:
analyzing each test case to obtain test data of each test case;
and assembling the test data of each test case according to preset request message assembling parameters to generate a request message corresponding to each test case.
Optionally, in the method, the triggering the server to check the interface according to each request packet and generate a response packet corresponding to each request packet includes:
triggering the server to analyze each request message so as to verify the interface through the request message and generate verification data corresponding to each request message;
and filling the check data into a preset response message generation field to generate a response message corresponding to each check data.
The above method, optionally, further includes:
generating a check record of each request message and a response record of each response message, and registering and storing the check records and the response records into a preset check log file;
and sending the verification log file, the request message and the response message to a preset storage device for storage.
An interface verification apparatus, comprising:
the device comprises a determining unit, a verification unit and a verification unit, wherein the determining unit is used for determining an interface corresponding to a verification instruction and determining an interface document corresponding to the interface when the verification instruction is received;
the generating unit is used for generating each test case corresponding to the interface according to the interface document and generating a request message corresponding to each test case;
a sending unit, configured to send each request packet to a preset server according to a request mode and a request address in the interface document, trigger the server to check the interface according to each request packet, and generate a response packet corresponding to each request packet;
a receiving unit, configured to receive each response packet fed back by the server, and determine a return code of each response packet;
the judging unit is used for judging whether the return code of the response message is the same as the preset return code of the response message or not for each response message;
and the judging unit is used for passing the interface verification if the return code of each response message is the same as the preset return code of the response message.
The above apparatus, optionally, the generating unit includes:
the reading subunit is used for reading the interface document and acquiring each field attribute of each field of the interface in the interface document;
the first generation subunit is used for generating each test data of each field according to the field attribute;
and the combination subunit is used for combining all the test data according to a preset combination rule to obtain at least one combination test data, wherein the test data in the combination test data corresponds to the fields one by one, and the combination test data is determined as the test case of the interface.
The above apparatus, optionally, the generating unit includes:
the analysis subunit is used for analyzing each test case to acquire the test data of each test case;
and the assembling subunit is used for assembling the test data of each test case according to preset request message assembling parameters to generate a request message corresponding to each test case.
The above apparatus, optionally, the sending unit includes:
the triggering subunit is configured to trigger the server to analyze each request packet, so as to verify the interface through the request packet, and generate verification data corresponding to each request packet;
and the second generating subunit is used for filling the check data into a preset response message generating field and generating a response message corresponding to each check data.
The above apparatus, optionally, further comprises:
the registration unit is used for generating a check record of each request message and a response record of each response message, and registering and storing the check records and the response records into a preset check log file;
and the storage unit is used for sending the verification log file, the request message and the response message to preset storage equipment for storage.
Compared with the prior art, the invention has the following beneficial effects:
the invention provides an interface checking method, which comprises the following steps: when a verification instruction is received, determining an interface corresponding to the verification instruction, and determining an interface document corresponding to the interface; generating each test case corresponding to the interface according to the interface document, and generating a request message corresponding to each test case; sending each request message to a preset server according to a request mode and a request address in the interface document, triggering the server to check the interface according to each request message, and generating a response message corresponding to each request message; receiving each response message fed back by the server, and determining a return code of each response message; for each response message, judging whether the return code of the response message is the same as the preset return code of the response message; and if the return code of each response message is the same as the preset return code of the response message, the interface passes the verification. By applying the method and the device, the request message of the interface can be quickly generated, the interface is verified by applying the request message to obtain the response message corresponding to each request message, the return code in each response message is compared with the preset return code, and if the return code of each response message is consistent with the preset return code, the interface verification is passed; when the condition that the return code in the response message is inconsistent with the preset return code exists, the interface check is not passed; the interface is verified by the generated request message, so that the verification efficiency of the interface is improved, and the working efficiency of workers is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a method for checking an interface according to an embodiment of the present invention;
fig. 2 is a flowchart of another method of an interface verification method according to an embodiment of the present invention;
fig. 3 is a flowchart of another method of an interface verification method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an interface verification interface device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In this application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The embodiment of the invention provides an interface checking method, which is used for checking or testing whether an interface can normally work. The method provided by the present invention can be used in many general purpose or special purpose computing devices or configurations, such as a personal computer, a server computer, or a handheld device, etc., and the execution subject of the method can be a processor or a server of a computer terminal, and a method flowchart of the method can be shown in fig. 1, and specifically includes:
s101, when a verification instruction is received, an interface corresponding to the verification instruction is determined, and an interface document corresponding to the interface is determined.
In the method provided by the embodiment of the invention, when an interface tester needs to verify the interface, a verification instruction is sent to the computer terminal, and when the computer terminal receives the verification instruction, the verification instruction is analyzed to determine the interface which is verified by the interface tester, and an interface document corresponding to the interface is obtained. It should be noted that the check instruction includes a unique identification number of the interface, and the processor can determine the interface to be checked through the unique identification number; it should be noted that each interface has a corresponding interface document, and the contents in different interface documents are different, and the interface documents are preset in the interface test platform; wherein, the interface needs to be formatted according to a standard mode. The interface document of each interface is standardized interface document, interface information such as interface address, sending mode, preset return code for checking response message and the like is filled according to preset standard rules, so as to obtain the standardized interface document corresponding to the interface; the content in the interface document is each item of content normalized for the interface definition, including but not limited to information such as a request mode, a request Uniform Resource Identifier (URI), a database code, an interface name, a database used, a user, a consumer, a code format, a field name, a child node, a description of a field, a type of a field, a requirement for the field to appear, a dictionary value or a fixed value of a field, and a remark of a field.
S102, generating each test case corresponding to the interface according to the interface document, and generating a request message corresponding to each test case.
In the method provided by the embodiment of the invention, the interface document is read to obtain the content stored in the interface document, each test case corresponding to the interface is generated according to the content in the obtained interface document, and the request message corresponding to each test case is generated according to the data of each test case. It should be noted that the processor may generate a plurality of test cases corresponding to the interface according to the interface document, and generate a request message corresponding to each test case according to each test case, where the test cases correspond to the request messages one to one; it should be noted that the data contained in the different test cases are different.
S103, sending each request message to a preset server according to the request mode and the request address in the interface document, triggering the server to check the interface according to each request message, and generating a response message corresponding to each request message.
In the method provided by the embodiment of the present invention, different request modes and request addresses corresponding to different interfaces, which may also be referred to as request URIs, are sent to a server according to the request modes and request URIs in interface documents corresponding to the interfaces, so as to trigger the server to verify the interfaces according to data in the request messages, and after each request message is verified, a corresponding response message is generated; it should be noted that the request message corresponds to the response message one to one, and the response message includes, but is not limited to, a return code generated when the corresponding request message verifies the interface. Preferably, if the server does not acquire the response message after timeout, it is determined that the server sending the request message is abnormal, and the interface verification fails, that is, the interface verification fails.
S104, receiving each response message fed back by the server, and determining a return code of each response message.
In the method provided by the embodiment of the invention, a processor receives each response message fed back by the server and analyzes each response message to obtain a return code in the response message; it should be noted that the return code is generated when the server uses the request packet check interface, and the return code may represent a check result of using the request packet check interface. Specifically, the return code includes a key and a value generated when the server checks the interface using the request message, where different request messages generate different return codes.
And S105, judging whether the return code of the response message is the same as the preset return code of the response message or not for each response message.
In the method provided by the embodiment of the present invention, for each response packet, comparing a return code in the response packet with a preset return code corresponding to the response packet, and determining whether the return code of the response packet is the same as the preset return code of the response packet; it should be noted that the request messages correspond to the response messages one to one, and each request message has a corresponding preset return code, that is, the preset return code corresponding to the request message is the preset return code of the response message corresponding to the request message. The preset return code comprises a preset key and a value, each request message has a corresponding preset return code, each request message generates a corresponding response message after checking an interface, and the return code in the response message of the request message is compared with the preset return code of the request message to judge whether the return code in the response message is the same as the preset return code in the request message; if the return code in the response message is the same as the preset return code of the request message, the test case of the request message passes the verification, and if the return code in the response message is different from the preset return code of the request message, the test case of the request message does not pass the verification; in other words, the key and value in the response message are compared with the preset key and value, that is, the key in the response message is compared with the preset key and the value in the response message is compared with the preset value; and when the key and the value in the response message are not consistent with the preset key and the preset value, the test case of the request message fails to be tested.
S106, if the return code of each response message is the same as the preset return code of the response message, the interface passes the verification.
In the method provided by the embodiment of the present invention, if the return code of each response packet is the same as the preset return code of the response packet, the interface check is passed; and if the return code of the response message is different from the preset return code, the interface check is failed. It should be noted that, if the return code of each response message is the same as the preset return code of the response message, the representation and each test case pass the test, and the interface is determined to pass the verification; if the comparison between the return code of the response message and the preset return code is inconsistent, the test case which fails the test is indicated, and the interface is judged to fail to be verified, namely the interface is failed to be verified.
In the method provided by the embodiment of the invention, when a verification instruction is received, an interface corresponding to the verification instruction is determined, and an interface document corresponding to the interface is determined; generating each test case corresponding to the interface according to the interface document, and generating a request message corresponding to each test case; sending each request message to a preset server according to a request mode and a request address in the interface document, triggering the server to check the interface according to each request message, and generating a response message corresponding to each request message; receiving each response message fed back by the server, and determining a return code of each response message; for each response message, judging whether the return code of the response message is the same as the preset return code of the response message; and if the return code of each response message is the same as the preset return code of the response message, the interface passes the verification. In the method provided by the embodiment of the invention, each test case of an interface is generated according to an interface document, a request message corresponding to each test case is generated, each generated request message is sent to a server, the server is triggered to check the interface according to each request message, and a response message corresponding to each request message is generated; and receiving each response message fed back by the server, comparing the return code of each response message with the preset return code corresponding to the response message, judging whether the return code in each response message is consistent with the preset return code corresponding to the response message, if so, passing the interface verification, otherwise, not passing the interface verification. By applying the method provided by the invention to test the interface, the problem of the interface can be found earlier, the problem can be prevented as early as possible, the investment of manpower and material resources in the later period can be reduced, and the cost of the whole project can be saved; by applying the invention, a plurality of test cases can be generated according to the interface document without compiling the test cases one by workers, so that the working efficiency of interface verification is improved, and the plurality of test cases are generated according to the interface document, thereby ensuring that the generated test cases do not make mistakes and the generated test cases are more comprehensive.
In the method provided by the embodiment of the present invention, before checking the interface, a test case corresponding to the interface needs to be generated according to the interface document, and a specific process for generating the test case may refer to fig. 2, where the specific description of fig. 2 is as follows:
s201, reading the interface document, and obtaining each field attribute of each field of the interface in the interface document.
The method provided by the embodiment of the invention comprises the steps of obtaining an interface document corresponding to an interface, reading the interface document to obtain each field attribute of each field related to the interface in the interface document, wherein different interfaces correspond to different fields to be explained, so that the content in each interface is different, so that different interfaces correspond to different interface documents, and it is required to be explained that the interface documents comprise a request mode, a request URI, a request parameter, an encoding mode, a used database and the like.
S202, generating each test data of each field according to the field attribute.
In the method provided by the embodiment of the invention, each test data of each field is generated according to each field attribute corresponding to each field; it should be noted that, taking the field APP _ NO in S201 as an example, test data such as '1', 'good', 'empty', 'test maximum length case', 'maximum length boundary value 1' and the like can be generated; it should be noted that test data generated by different fields are different; the generated test data is associated with the respective attributes of the fields.
S203, combining all the test data according to a preset combination rule to obtain at least one combined test data, wherein the test data in the combined test data corresponds to the fields one by one, and the combined test data is determined as the test case of the interface.
In the method provided by the embodiment of the invention, the generated test data are combined according to a preset combination rule, the combination rule is specifically that one test data is selected from the test data corresponding to each field, the selected test data form combined test data so as to obtain at least one combined test data, the test data of the combined test data correspond to the fields one by one, and the obtained combined test data is determined as a test case of the interface.
In the method provided by the embodiment of the invention, each field attribute of each field in the interface document is read, a plurality of test data are generated according to the field attributes, one field corresponds to a plurality of test data, namely the relation between the field and the test data is 1: N; when the test case of the interface is generated, one test data is selected for each field of the interface, and the test data selected for each field can be filled in the corresponding field to obtain the test case of the interface and generate the request message corresponding to the test case.
In the method provided by the embodiment of the invention, the interface document corresponding to the interface is read to obtain the content of the field related to the interface in the interface document, and each test case corresponding to the interface is generated according to the obtained field content.
In the method provided by the embodiment of the invention, after each test case is generated, a request message is generated according to the test case, and the specific generation process is as follows:
analyzing each test case to obtain test data of each test case;
and assembling the test data of each test case according to preset request message assembling parameters to generate a request message corresponding to each test case.
In the method provided by the embodiment of the present invention, each test case is analyzed to obtain test data in each test case, it should be noted that the test cases include a plurality of test data, the test data in the test cases correspond to the fields one to one, that is, the request packet includes the test data of each field, and the test data of each field is assembled into the request packet according to the assembly rule in the interface document. It should be noted that the message assembly parameters are field names and child nodes of fields, and the test data is assembled into a request message according to the message assembly parameters, and the specific content of the request message is as follows:
Figure BDA0002444316170000101
Figure BDA0002444316170000111
wherein, the field names are APP _ NO, UNIQUE _ ID, CONTRACT _ NO, CREDIT _ L IMIT and MT _ RISK _ L EVE L, and the child nodes are CREDIT _ POINT, STATB L E _ POINT, FRAUD _ POINT, RC _ CREDIT _ SCORE _ L EVE L.
It should be noted that, in the method provided in the embodiment of the present invention, when the server uses the request packet check interface, the server generates a response packet corresponding to the request packet, and a specific process of generating the response packet by the server may refer to fig. 3, which is described in detail as follows:
s301, triggering the server to analyze each request message, so as to verify the interface through the request message, and generating verification data corresponding to each request message.
In the method provided by the embodiment of the invention, after the request message is sent to the server, the server is triggered to use the request message to check the interface, and the server analyzes the request message so as to check the interface according to the test data in the request message and generate the check data corresponding to the interface; it should be noted that the check data includes, but is not limited to, a return code generated after the request message check interface, the check data corresponds to the request message one to one, and the return code may be a character string composed of numbers or a character string composed of numbers and letters; specifically, the return code may include a key and a value, where the key may be a number and the value may be a Chinese meaning characterizing the key.
S302, filling the verification data into a preset response message generation field, and generating a response message corresponding to each verification data.
In the method provided by the embodiment of the invention, the check data is filled in the preset response message generation field so as to generate the response message, and the response message corresponds to the check data one by one. It should be noted that, the generation fields of the response messages corresponding to different interfaces may be different, and specifically, the generated response messages may be as follows:
Figure BDA0002444316170000112
Figure BDA0002444316170000121
note that the RESP _ CODE corresponds to a return CODE.
It should be noted that, the return codes in the response messages are compared with the corresponding preset return codes, whether the return codes in each response message are consistent with the corresponding preset return codes is judged, and when the return codes in each response message are consistent with the corresponding preset return codes, the interface passes the verification; and when the condition that the response message is inconsistent with the corresponding preset return code exists, the interface is not checked.
In the method provided by the embodiment of the invention, in order to enable a worker to check the request messages in the future, after receiving the response messages fed back by the server, a check record of each request message is generated, a response record of each response message is generated, the check record of each request message and the response record of each response message are recorded into a preset check log file, and the check log file, each request message and each response message are sent to a preset storage device for storage. It should be noted that the preset storage device may be a local storage of the computer terminal. By storing the verification log file, the request message and the response message, the worker can conveniently look up and analyze the interface according to the stored request message and response message, and the worker can conveniently maintain and troubleshoot the interface subsequently, so that the working convenience of the worker is improved.
In the method provided by the embodiment of the invention, when a verification instruction is received, an interface corresponding to the verification instruction is determined, and an interface document corresponding to the interface is determined; generating each test case corresponding to the interface according to the interface document, and generating a request message corresponding to each test case; sending each request message to a preset server according to a request mode and a request address in the interface document, triggering the server to check the interface according to each request message, and generating a response message corresponding to each request message; receiving each response message fed back by the server, and determining a return code of each response message; for each response message, judging whether the return code of the response message is the same as the preset return code of the response message; and if the return code of each response message is the same as the preset return code of the response message, the interface passes the verification. By applying the method and the device, a plurality of request messages can be generated according to the interface documents corresponding to the interfaces, the generated request messages comprehensively cover fields needing to be checked in the interfaces, the comprehensiveness of data in the request messages is ensured, the request messages are very convenient to generate, and workers do not need to fill in a large amount of data contents one by one, so that the condition that the data in the generated request messages are not missed is ensured; the interface is verified by using the request message, so that the working efficiency of verifying the interface is improved.
Corresponding to fig. 1, an embodiment of the present invention further provides an interface verification apparatus, which is used for specifically implementing the method in fig. 1, and the interface verification apparatus provided in the embodiment of the present invention may be applied to a computer terminal or various mobile devices, and a schematic structural diagram of the interface verification apparatus is shown in fig. 4, and specifically includes:
a determining unit 401, configured to determine, when a verification instruction is received, an interface corresponding to the verification instruction, and determine an interface document corresponding to the interface;
a generating unit 402, configured to generate, according to the interface document, each test case corresponding to the interface, and generate a request packet corresponding to each test case;
a sending unit 403, configured to send each request packet to a preset server according to a request mode and a request address in the interface document, trigger the server to check the interface according to each request packet, and generate a response packet corresponding to each request packet;
a receiving unit 404, configured to receive each response packet fed back by the server, and determine a return code of each response packet;
a determining unit 405, configured to determine, for each response packet, whether a return code of the response packet is the same as a preset return code of the response packet;
a determining unit 406, configured to pass the interface verification if the return code of each response packet is the same as the preset return code of the response packet.
In the device provided by the embodiment of the invention, when a verification instruction is received, an interface corresponding to the verification instruction is determined, and an interface document corresponding to the interface is determined; generating each test case corresponding to the interface according to the interface document, and generating a request message corresponding to each test case; sending each request message to a preset server according to a request mode and a request address in the interface document, triggering the server to check the interface according to each request message, and generating a response message corresponding to each request message; receiving each response message fed back by the server, and determining a return code of each response message; for each response message, judging whether the return code of the response message is the same as the preset return code of the response message; and if the return code of each response message is the same as the preset return code of the response message, the interface passes the verification. By applying the method and the device, a plurality of request messages can be generated according to the interface documents corresponding to the interfaces, the generated request messages comprehensively cover fields needing to be checked in the interfaces, the comprehensiveness of data in the request messages is ensured, the request messages are very convenient to generate, and workers do not need to fill in a large amount of data contents one by one, so that the condition that the data in the generated request messages are not missed is ensured; the interface is verified by using the request message, so that the working efficiency of verifying the interface is improved.
Based on the foregoing solution, in the apparatus provided in the embodiment of the present invention, the generating unit 402 may be configured to:
the reading subunit is used for reading the interface document and acquiring each field attribute of each field of the interface in the interface document;
the first generation subunit is used for generating each test data of each field according to the field attribute;
and the combination subunit is used for combining all the test data according to a preset combination rule to obtain at least one combination test data, wherein the test data in the combination test data corresponds to the fields one by one, and the combination test data is determined as the test case of the interface.
Based on the foregoing solution, in the apparatus provided in the embodiment of the present invention, the generating unit 402 may be configured to:
the analysis subunit is used for analyzing each test case to acquire the test data of each test case;
and the assembling subunit is used for assembling the test data of each test case according to preset request message assembling parameters to generate a request message corresponding to each test case.
Based on the foregoing solution, in the apparatus provided in the embodiment of the present invention, the sending unit 403 may be configured to:
the triggering subunit is configured to trigger the server to analyze each request packet, so as to verify the interface through the request packet, and generate verification data corresponding to each request packet;
and the second generating subunit is used for filling the check data into a preset response message generating field and generating a response message corresponding to each check data.
Based on the foregoing solution, the apparatus provided in the embodiment of the present invention may be further configured to:
the registration unit is used for generating a check record of each request message and a response record of each response message, and registering and storing the check records and the response records into a preset check log file;
and the storage unit is used for sending the verification log file, the request message and the response message to preset storage equipment for storage.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the system or system embodiments are substantially similar to the method embodiments and therefore are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described system and system embodiments are only illustrative, wherein the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. An interface verification method, comprising:
when a verification instruction is received, determining an interface corresponding to the verification instruction, and determining an interface document corresponding to the interface;
generating each test case corresponding to the interface according to the interface document, and generating a request message corresponding to each test case;
sending each request message to a preset server according to a request mode and a request address in the interface document, triggering the server to check the interface according to each request message, and generating a response message corresponding to each request message;
receiving each response message fed back by the server, and determining a return code of each response message;
for each response message, judging whether the return code of the response message is the same as the preset return code of the response message;
and if the return code of each response message is the same as the preset return code of the response message, the interface passes the verification.
2. The method of claim 1, wherein the generating, from the interface document, each test case corresponding to the interface comprises:
reading the interface document, and acquiring each field attribute of each field of the interface in the interface document;
generating each test data of each field according to the field attribute;
and combining all the test data according to a preset combination rule to obtain at least one combined test data, wherein the test data in the combined test data corresponds to the fields one by one, and the combined test data is determined as the test case of the interface.
3. The method of claim 1, wherein the generating the request packet corresponding to each of the test cases comprises:
analyzing each test case to obtain test data of each test case;
and assembling the test data of each test case according to preset request message assembling parameters to generate a request message corresponding to each test case.
4. The method of claim 1, wherein the triggering the server to verify the interface according to each request packet and generate a response packet corresponding to each request packet comprises:
triggering the server to analyze each request message so as to verify the interface through the request message and generate verification data corresponding to each request message;
and filling the check data into a preset response message generation field to generate a response message corresponding to each check data.
5. The method of claim 1, further comprising:
generating a check record of each request message and a response record of each response message, and registering and storing the check records and the response records into a preset check log file;
and sending the verification log file, the request message and the response message to a preset storage device for storage.
6. An interface verification apparatus, comprising:
the device comprises a determining unit, a verification unit and a verification unit, wherein the determining unit is used for determining an interface corresponding to a verification instruction and determining an interface document corresponding to the interface when the verification instruction is received;
the generating unit is used for generating each test case corresponding to the interface according to the interface document and generating a request message corresponding to each test case;
a sending unit, configured to send each request packet to a preset server according to a request mode and a request address in the interface document, trigger the server to check the interface according to each request packet, and generate a response packet corresponding to each request packet;
a receiving unit, configured to receive each response packet fed back by the server, and determine a return code of each response packet;
the judging unit is used for judging whether the return code of the response message is the same as the preset return code of the response message or not for each response message;
and the judging unit is used for passing the interface verification if the return code of each response message is the same as the preset return code of the response message.
7. The apparatus of claim 6, wherein the generating unit comprises:
the reading subunit is used for reading the interface document and acquiring each field attribute of each field of the interface in the interface document;
the first generation subunit is used for generating each test data of each field according to the field attribute;
and the combination subunit is used for combining all the test data according to a preset combination rule to obtain at least one combination test data, wherein the test data in the combination test data corresponds to the fields one by one, and the combination test data is determined as the test case of the interface.
8. The apparatus of claim 6, wherein the generating unit comprises:
the analysis subunit is used for analyzing each test case to acquire the test data of each test case;
and the assembling subunit is used for assembling the test data of each test case according to preset request message assembling parameters to generate a request message corresponding to each test case.
9. The apparatus of claim 6, wherein the sending unit comprises:
the triggering subunit is configured to trigger the server to analyze each request packet, so as to verify the interface through the request packet, and generate verification data corresponding to each request packet;
and the second generating subunit is used for filling the check data into a preset response message generating field and generating a response message corresponding to each check data.
10. The apparatus of claim 6, further comprising:
the registration unit is used for generating a check record of each request message and a response record of each response message, and registering and storing the check records and the response records into a preset check log file;
and the storage unit is used for sending the verification log file, the request message and the response message to preset storage equipment for storage.
CN202010274577.7A 2020-04-09 2020-04-09 Interface checking method and device Pending CN111478969A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010274577.7A CN111478969A (en) 2020-04-09 2020-04-09 Interface checking method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010274577.7A CN111478969A (en) 2020-04-09 2020-04-09 Interface checking method and device

Publications (1)

Publication Number Publication Date
CN111478969A true CN111478969A (en) 2020-07-31

Family

ID=71751452

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010274577.7A Pending CN111478969A (en) 2020-04-09 2020-04-09 Interface checking method and device

Country Status (1)

Country Link
CN (1) CN111478969A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112579055A (en) * 2020-12-11 2021-03-30 平安普惠企业管理有限公司 Interface parameter checking method and device and computer readable storage medium
CN112671605A (en) * 2020-12-16 2021-04-16 建信金融科技有限责任公司 Test method and device and electronic equipment
CN113609017A (en) * 2021-08-06 2021-11-05 中国工商银行股份有限公司 Interface test case generation method and device
CN113760719A (en) * 2020-11-25 2021-12-07 北京京东振世信息技术有限公司 Interface testing method and tool
CN114666258A (en) * 2022-03-22 2022-06-24 阿波罗智联(北京)科技有限公司 Interface test method, device, electronic equipment and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1791296A1 (en) * 2005-11-29 2007-05-30 Alcatel Lucent Automated QS interface testing framework
CN109474488A (en) * 2018-10-31 2019-03-15 中国银行股份有限公司 Interface test method, device and computer equipment
CN109522218A (en) * 2018-10-19 2019-03-26 平安科技(深圳)有限公司 Interface test method, device, computer equipment and storage medium
CN110188036A (en) * 2019-05-10 2019-08-30 深圳前海微众银行股份有限公司 A kind of method for testing software and device
CN110334021A (en) * 2019-06-25 2019-10-15 深圳前海微众银行股份有限公司 Generation method, device, equipment and the storage medium of interface testing case
CN110716870A (en) * 2019-09-23 2020-01-21 中国建设银行股份有限公司 Automatic service testing method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1791296A1 (en) * 2005-11-29 2007-05-30 Alcatel Lucent Automated QS interface testing framework
CN109522218A (en) * 2018-10-19 2019-03-26 平安科技(深圳)有限公司 Interface test method, device, computer equipment and storage medium
CN109474488A (en) * 2018-10-31 2019-03-15 中国银行股份有限公司 Interface test method, device and computer equipment
CN110188036A (en) * 2019-05-10 2019-08-30 深圳前海微众银行股份有限公司 A kind of method for testing software and device
CN110334021A (en) * 2019-06-25 2019-10-15 深圳前海微众银行股份有限公司 Generation method, device, equipment and the storage medium of interface testing case
CN110716870A (en) * 2019-09-23 2020-01-21 中国建设银行股份有限公司 Automatic service testing method and device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113760719A (en) * 2020-11-25 2021-12-07 北京京东振世信息技术有限公司 Interface testing method and tool
CN112579055A (en) * 2020-12-11 2021-03-30 平安普惠企业管理有限公司 Interface parameter checking method and device and computer readable storage medium
CN112671605A (en) * 2020-12-16 2021-04-16 建信金融科技有限责任公司 Test method and device and electronic equipment
CN113609017A (en) * 2021-08-06 2021-11-05 中国工商银行股份有限公司 Interface test case generation method and device
CN114666258A (en) * 2022-03-22 2022-06-24 阿波罗智联(北京)科技有限公司 Interface test method, device, electronic equipment and medium
CN114666258B (en) * 2022-03-22 2023-11-07 阿波罗智联(北京)科技有限公司 Interface testing method, device, electronic equipment and medium

Similar Documents

Publication Publication Date Title
CN111478969A (en) Interface checking method and device
CN111177005B (en) Service application testing method, device, server and storage medium
CN107656874B (en) Interface testing method and device, simulation baffle and system
CN107122258B (en) Method and equipment for checking state code of test interface
CN110430205B (en) Single sign-on method, device, equipment and computer readable storage medium
CN111343168B (en) Identity authentication method and device, computer equipment and readable storage medium
CN105100029A (en) Method and device for user identity verification
CN114595201A (en) Method, equipment and storage medium for inquiring acquisition record of interface access log
CN109324958B (en) REST unified verification method, device, equipment and readable storage medium
CN115563002A (en) Data importing method and device, storage medium and computer equipment
CN109471646A (en) A kind of upgrade method, device and the storage medium of the BMC version of server
CN112433936A (en) Test method, test device and storage medium
CN111538547A (en) Application page configuration method and device of application program
CN112131127B (en) Interface testing method, device and system and electronic equipment
CN112671615B (en) Method, system and storage medium for collecting front-end user operation behavior data
CN115269424A (en) Automatic regression testing method, device, equipment and storage medium for production flow
CN110618943B (en) Security service test method and device, electronic equipment and readable storage medium
CN112230938A (en) Method and device for configuring rental products of industrial Internet
CN115470095A (en) Test method, test system, electronic equipment and computer storage medium
CN111026619A (en) Page monitoring method and device and storage medium
CN107276852B (en) Data security detection method and terminal
CN115659424A (en) Data security authentication method and device based on interceptor
CN115248778A (en) Code inspection method and device
CN117354342A (en) Cloud service system health inspection method and device
CN116263740A (en) Environment information integration method, device, storage medium and apparatus

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200731