CN114760236B - Interface checking method, device, storage medium and equipment - Google Patents

Interface checking method, device, storage medium and equipment Download PDF

Info

Publication number
CN114760236B
CN114760236B CN202210365807.XA CN202210365807A CN114760236B CN 114760236 B CN114760236 B CN 114760236B CN 202210365807 A CN202210365807 A CN 202210365807A CN 114760236 B CN114760236 B CN 114760236B
Authority
CN
China
Prior art keywords
field
document
message
kth
line
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
CN202210365807.XA
Other languages
Chinese (zh)
Other versions
CN114760236A (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.)
Bank of China Ltd
Original Assignee
Bank of China 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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202210365807.XA priority Critical patent/CN114760236B/en
Publication of CN114760236A publication Critical patent/CN114760236A/en
Application granted granted Critical
Publication of CN114760236B publication Critical patent/CN114760236B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • 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)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses an interface checking method, a device, a storage medium and equipment, which can be applied to the field of mobile interconnection, and the method comprises the following steps: reading an interface document of an interface to be tested to obtain a document field line sequence; reading a message code of an interface to be tested to obtain a message field line sequence; comparing the field length of the field shown in the field row of the kth document with the field length of the field shown in the field row of the kth message to obtain a field length comparison result; and setting a third identifier for the kth document field row and the kth message field under the condition that the field length comparison result meets the second preset condition. The method compares the document field line with the message field line, and sets the identification for the document field line and the message field line according to the comparison result, so that a user can locate defects in the interface to be tested based on the identification as a reference, and the effective inspection of the interface to be tested is realized, thereby reducing the defect rate of the interface test.

Description

Interface checking method, device, storage medium and equipment
Technical Field
The present application relates to the field of interface inspection, and in particular, to an interface inspection method, apparatus, storage medium, and device.
Background
Because banking business is various, hundreds of different products or systems usually process different business, a large number of mutual calls exist among the systems, for example, an online banking system is only responsible for picture display, transaction verification and the like, and the business of actual deposit, loan, exchange and the like is to call the corresponding transaction interface of a core system to complete the business. At present, parallel development among different service systems describes interface functions and message uploading and downloading formats through interface documents, and each service system develops message codes according to the interface documents.
However, because the number of interface documents is huge, for example, a core banking system provides thousands of functional interfaces for peripheral systems to call, each interface contains hundreds of field columns, the manual maintenance of the interface documents is very huge in workload, and is very prone to errors. If the interface document is maintained incorrectly or the interface user side misunderstands the interface description, the interface message sent by the user side can not be accurately processed by the interface provider side, so that the program processing is abnormal.
Because the inter-system joint debugging can only be used in the assembly test or functional test stage after the service system is developed, the test finds problems at the moment, the modification workload is larger, the distance from the production time is usually shorter, and the reworking modification risk is larger. If the test is insufficient and no problem is found, the risk of production defects in the production environment on the belt is extremely high, and the stable operation of the bank system is greatly influenced.
Therefore, how to reduce the defect rate of the interface test is a problem to be solved in the art.
Disclosure of Invention
The application provides an interface checking method, an interface checking device, a storage medium and interface checking equipment, and aims to reduce the defect rate of interface testing.
In order to achieve the above object, the present application provides the following technical solutions:
an interface inspection method, comprising:
reading an interface document of an interface to be tested to obtain a document field line sequence of the interface document; the interface document is written based on a preset document template; the document field line sequence comprises a plurality of document field lines, and the sequence bit of each document field line is determined based on the line position of the document field line in the interface document;
reading the message code of the interface to be tested to obtain a message field row sequence of the message code; the message field line sequence comprises a plurality of message field lines, and the sequence bit of each message field line is determined based on the line position of the message field line in the message code;
comparing the field length of the field shown by the kth document field line with the field length of the field shown by the kth message field line under the condition that the field type of the field shown by the kth document field line in the document field line sequence is the same as the field type of the field shown by the kth message field line in the message field line sequence, so as to obtain a field length comparison result; wherein k=1, 2, …, t, t is any one of the first value and the second value; the first numerical value is the number of document field lines contained in the document field line sequence; the second numerical value is the number of message field lines contained in the message field line sequence;
Setting a third identifier for a kth document field row in the interface document and a kth message field in the message code under the condition that the field length comparison result meets a second preset condition; the second preset condition is: the field length of the field shown in the kth document field line is equal to the field length of the field shown in the kth message field line; the third identifier is used for indicating that the document field line is matched with the message field line.
Optionally, when the field type of the field indicated by the kth document field line in the document field line sequence is the same as the field type of the field indicated by the kth message field line in the message field line sequence, comparing the field length of the field indicated by the kth document field line with the field length of the field indicated by the kth message field line to obtain a field length comparison result, where the comparing includes:
under the condition that the first value is equal to the second value, comparing the field type of the field shown by the kth document field line in the document field line sequence with the field type of the field shown by the kth message field line in the message field line sequence to obtain a field type comparison result;
Under the condition that the field type comparison result meets a first preset condition, comparing the field length of the field shown in the kth document field line with the field length of the field shown in the kth message field line to obtain a field length comparison result; the first preset condition is as follows: the field type of the field shown in the kth document field row is the same as the field type of the field shown in the kth message field row.
Optionally, the method further comprises:
setting a first identifier for other document field lines except the first m-bit document field line in the interface document under the condition that the first value is larger than the second value; m is equal to the second value; the first identifier is used for indicating that the document field line is not matched with the message field line.
Optionally, the method further comprises:
setting a first identifier for other message field lines except the first n-bit message field line in the message code under the condition that the first value is smaller than the second value; n is equal to the first value; the first identifier is used for indicating that the document field line is not matched with the message field line.
Optionally, the method further comprises:
judging whether the field shown in the kth message field row is a character type field or not under the condition that the field type comparison result does not accord with the first preset condition;
Setting a second identifier for a kth document field line in the interface document and a kth message field line in the message code under the condition that the field indicated by the kth message field line is a character type field; the second identifier is used for indicating that the document field line is not completely matched with the message field line and needs to be checked manually;
setting a first identifier for a kth document field line in the interface document and a kth message field line in the message code under the condition that a field shown by the kth message field line is not a character type field; the first identifier is used for indicating that the document field line is not matched with the message field line.
Optionally, the method further comprises:
calculating the sum of the field length of the field shown in the kth document field row and the field length of the target document to obtain a third value when the field length comparison result does not meet the second preset condition but meets a third preset condition; the third preset condition is: the field length of the field shown in the kth document field line is smaller than the field length of the field shown in the kth message field line; the target document field length is: the sum of the field lengths of the fields shown in each target document field row is not less than the field length of the field shown in the kth message field row; the target document field line comprises the k+r document field line in the document field line sequence, wherein r is a positive integer;
Setting the third identifier for a kth document field line and a kth+r document field line in the interface document and a kth message field line in the message code under the condition that the third value is equal to the field length of the field indicated by the kth message field line;
setting a first identifier for other document field lines of which sequence bits are arranged after the kth document field line in the interface document and other message field lines of which sequence bits are arranged after the kth message field line in the message code under the condition that the third numerical value is larger than the field length of the field shown by the kth message field line; the first identifier is used for indicating that the document field line is not matched with the message field line.
Optionally, the method further comprises:
calculating the sum of the field length of the field shown in the kth message field row and the target message field length to obtain a fourth value when the field length comparison result does not meet the second preset condition and does not meet the third preset condition; the third preset condition is: the field length of the field shown in the kth document field line is smaller than the field length of the field shown in the kth message field line; the length of the target message field is as follows: the sum of the field lengths of the fields shown in each target message field row is not less than the field length of the field shown in the kth document field row; the target message field line comprises the k+r message field line in the message field line sequence, wherein r is a positive integer;
Setting the third identifier for a kth message field line and a k+r message field line in the message code and a kth document field line in an interface document under the condition that the fourth value is equal to the field length of the field shown by the kth document field line;
setting a first identifier for other message field lines of which sequence bits are arranged after the kth message field line in the message code and other document field lines of which sequence bits are arranged after the kth document field line in the interface document under the condition that the fourth numerical value is larger than the field length of the field shown by the kth document field line; the first identifier is used for indicating that the document field line is not matched with the message field line.
An interface inspection apparatus comprising:
the document reading unit is used for reading the interface document of the interface to be tested to obtain a document field line sequence of the interface document; the interface document is written based on a preset document template; the document field line sequence comprises a plurality of document field lines, and the sequence bit of each document field line is determined based on the line position of the document field line in the interface document;
The code reading unit is used for reading the message code of the interface to be tested to obtain a message field row sequence of the message code; the message field line sequence comprises a plurality of message field lines, and the sequence bit of each message field line is determined based on the line position of the message field line in the message code;
the comparison unit is used for comparing the field length of the field shown by the kth document field line with the field length of the field shown by the kth message field line under the condition that the field type of the field shown by the kth message field line in the message field line sequence is the same as the field type of the field shown by the kth message field line in the message field line sequence, so as to obtain a field length comparison result; wherein k=1, 2, …, t, t is any one of the first value and the second value; the first numerical value is the number of document field lines contained in the document field line sequence; the second numerical value is the number of message field lines contained in the message field line sequence;
the identification unit is used for setting a third identification for a kth document field row in the interface document and a kth message field in the message code under the condition that the field length comparison result meets a second preset condition; the second preset condition is: the field length of the field shown in the kth document field line is equal to the field length of the field shown in the kth message field line; the third identifier is used for indicating that the document field line is matched with the message field line.
A computer-readable storage medium including a stored program, wherein the program performs the interface checking method.
An interface inspection apparatus comprising: a processor, a memory, and a bus; the processor is connected with the memory through the bus;
the memory is used for storing a program, and the processor is used for running the program, wherein the interface checking method is executed when the program runs.
According to the technical scheme provided by the application, the interface document of the interface to be tested is read to obtain the document field line sequence of the interface document. Reading the message code of the interface to be tested to obtain a message field row sequence of the message code. And under the condition that the field type of the field shown by the kth document field line in the document field line sequence is the same as the field type of the field shown by the kth message field line in the message field line sequence, comparing the field length of the field shown by the kth document field line with the field length of the field shown by the kth message field line to obtain a field length comparison result. And setting a third identifier for a kth document field line in the interface document and a kth message field in the message code under the condition that the field length comparison result meets a second preset condition. Based on the scheme of the application, the document field line in the interface document is compared with the message field line in the message code, and the identification is set for the document field line and the message field line according to the comparison result, so that the user can locate the defects in the interface to be tested based on the identification contained in the document field line and the message field line as the reference basis, thereby realizing the effective inspection of the interface to be tested and reducing the defect rate of the interface test.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1a is a schematic flow chart of an interface checking method according to an embodiment of the present application;
fig. 1b is a schematic flow chart of an interface checking method according to an embodiment of the present application;
fig. 1c is a schematic flow chart of an interface checking method according to an embodiment of the present application;
FIG. 1d is a schematic diagram of a preset document template according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating another method for checking an interface according to an embodiment of the present application;
fig. 3 is a schematic diagram of an interface checking device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
As shown in fig. 1a, fig. 1b, and fig. 1c, a flow chart of an interface checking method according to an embodiment of the present application includes the following steps:
s101: and acquiring an interface document and a message code of the interface to be tested.
Wherein the interface document is written based on a preset document template. The so-called interface documents are: and (3) calling methods by a description interface agreed between different products or service systems, uploading a document in a message format by a transaction interface, and returning the document. The message codes are: XML codes defined in the business system are defined according to the message format and are used for analyzing the uploading or downloading message and mapping the message content to individual variables so that the business system can process business.
It should be noted that, the preset document template includes a plurality of field lines, and an input format of a field shown in each field line, where the input format is used to indicate a field sequence number, a field starting position (commonly called a byte), a field length, a data format, a field type, a field description, a field value description, and whether a field is necessary.
Specifically, taking an interface for establishing details of a loan account as an example, the interface is used for establishing the loan account for a specified customer, and an interface document of the interface includes an input message written according to a preset document template, and the content of the preset document template can be shown in fig. 1 d.
S102: and reading the interface document to obtain a document field row sequence of the interface document and a first numerical value.
Wherein the sequence of document field lines includes a plurality of document field lines, and the order of each document field line is determined based on the line location in the interface document where the document field line is located. The first value is the number of document field lines contained in the sequence of document field lines.
S103: and reading the message code to obtain a message field line sequence of the message code and a second numerical value.
The message field line sequence comprises a plurality of message field lines, and the sequence bit of each message field line is determined based on the line position of the message field line in the message code. The second value is the number of message field lines included in the sequence of message field lines.
S104: and setting a first identifier for other document field lines except the first m document field lines in the interface document under the condition that the first numerical value is larger than the second numerical value.
Wherein m is equal to the second value. The first identifier is used for indicating that the document field line is not matched with the message field line, and in the embodiment of the application, specific expression forms of the first identifier include, but are not limited to, the following: the font color is changed to red.
S105: and setting a first identifier for other message field lines except the first n-bit message field line in the message code under the condition that the first value is smaller than the second value.
Wherein n is equal to the first value.
S106: and under the condition that the first value is equal to the second value, comparing the field type of the field shown by the kth document field line in the document field line sequence with the field type of the field shown by the kth message field line in the message field line sequence to obtain a field type comparison result.
Wherein k=1, 2, …, t, t is any one of the first value and the second value.
S107: judging whether the field type comparison result meets a first preset condition.
If the field type comparison result meets the first preset condition, S108 is executed, otherwise S109 is executed.
The first preset condition is as follows: the field type of the field shown in the kth document field line is the same as the field type of the field shown in the kth message field line.
S108: and comparing the field length of the field shown in the kth document field row with the field length of the field shown in the kth message field row to obtain a field length comparison result.
After S108 is performed, S112 is continued.
S109: judging whether the field shown in the kth message field line is a character type field.
If the field indicated by the kth message field line is a character type field, S110 is executed, otherwise S111 is executed.
S110: setting a second identifier for the kth document field line in the interface document and the kth message field line in the message code.
The second identifier is used for indicating that the document field line and the message field line are not completely matched and need to be checked manually, and concrete expression forms of the second identifier include, but are not limited to: the font color is changed to yellow.
S111: setting a first identifier for a kth document field line in the interface document and a kth message field line in the message code.
S112: judging whether the field length comparison result meets a second preset condition.
If the field length comparison result meets the second preset condition, S113 is executed, otherwise S114 is executed.
The second preset condition is as follows: the field length of the field shown in the kth document field line is equal to the field length of the field shown in the kth message field line.
S113: and setting a third identifier for a kth document field line in the interface document and a kth message field in the message code.
Wherein, the third identifier is used for indicating that the document field line matches the message field line, and the specific expression forms of the third identifier include, but are not limited to: the font color is changed to green.
S114: judging whether the field length comparison result meets a third preset condition.
If the field length comparison result meets the third preset condition, S115 is executed, otherwise S118 is executed.
The third preset condition is as follows: the field length of the field shown in the kth document field line is smaller than the field length of the field shown in the kth message field line.
Generally, if the field length comparison result does not meet the second preset condition and the third preset condition, the field length of the field indicated by the kth document field line is greater than the field length of the field indicated by the kth message field line.
S115: and calculating the sum value of the field length of the field shown in the kth document field row and the field length of the target document to obtain a third numerical value.
The length of the target document field is as follows: the sum of the field lengths of the fields shown in the field rows of each target document is not smaller than the field length of the field shown in the field row of the kth message. The target document field line includes the k+r-th document field line in the document field line sequence, r being a positive integer.
S116: and setting a third identifier for the kth document field line and the (k+r) th document field line in the interface document and the kth message field line in the message code under the condition that the third numerical value is equal to the field length of the field indicated by the kth message field line.
S117: and setting a first identifier for other document field lines of which sequence bits are arranged behind the kth document field line and other message field lines of which sequence bits are arranged behind the kth message field line in the message code under the condition that the third numerical value is larger than the field length of the field shown by the kth message field line.
S118: and calculating the sum value between the field length of the field shown in the kth message field row and the length of the target message field to obtain a fourth numerical value.
The length of the target message field is as follows: the sum of the field lengths of the fields shown in the field rows of each target message is not smaller than the field length of the field shown in the field row of the kth document. The target message field line includes the k+r message field line in the sequence of message field lines.
S119: and setting a third identifier for the kth message field line and the (k+r) th message field line in the message code and the kth document field line in the interface document under the condition that the fourth numerical value is equal to the field length of the field indicated by the kth document field line.
S120: and setting a first identifier for other message field lines of which the sequence bits are arranged behind the kth message field line in the message code and other document field lines of which the sequence bits are arranged behind the kth document field line in the interface document under the condition that the fourth numerical value is larger than the field length of the field shown in the kth document field line.
In summary, the document field line in the interface document is compared with the message field line in the message code, and the identifier is set for the document field line and the message field line according to the comparison result, so that the user can locate the defect in the interface to be tested based on the identifier contained in the document field line and the message field line as the reference basis, thereby realizing effective inspection of the interface to be tested and reducing the defect rate of the interface test.
It should be noted that S101 mentioned in the foregoing embodiment is an alternative implementation of the interface checking method according to the present application. S120 mentioned in the above embodiment is also an alternative implementation of the interface checking method according to the present application. For this reason, the flow shown in the above embodiment can be summarized as the method shown in fig. 2.
As shown in fig. 2, a flow chart of another method for checking an interface according to an embodiment of the present application includes the following steps:
s201: and reading the interface document of the interface to be tested to obtain a document field row sequence of the interface document.
The interface document is written based on a preset document template; the sequence of document field lines includes a plurality of document field lines, and the order of each document field line is determined based on the line location in the interface document where the document field line is located.
S202: reading the message code of the interface to be tested to obtain a message field row sequence of the message code.
The message field line sequence comprises a plurality of message field lines, and the sequence bit of each message field line is determined based on the line position of the message field line in the message code.
S203: and under the condition that the field type of the field shown by the kth document field line in the document field line sequence is the same as the field type of the field shown by the kth message field line in the message field line sequence, comparing the field length of the field shown by the kth document field line with the field length of the field shown by the kth message field line to obtain a field length comparison result.
Wherein k=1, 2, …, t, t is any one of the first value and the second value; the first numerical value is the number of document field lines contained in the sequence of document field lines; the second value is the number of message field lines included in the sequence of message field lines.
S204: and setting a third identifier for a kth document field line in the interface document and a kth message field in the message code under the condition that the field length comparison result meets a second preset condition.
The second preset condition is as follows: the field length of the field shown in the kth document field line is equal to the field length of the field shown in the kth message field line; the third identifier is used for indicating that the document field line is matched with the message field line.
In summary, the document field line in the interface document is compared with the message field line in the message code, and the identifier is set for the document field line and the message field line according to the comparison result, so that the user can locate the defect in the interface to be tested based on the identifier contained in the document field line and the message field line as the reference basis, thereby realizing effective inspection of the interface to be tested and reducing the defect rate of the interface test.
It should be noted that the interface checking method provided by the invention can be used in the fields of artificial intelligence, blockchain, distributed, cloud computing, big data, internet of things, mobile internet, network security, chip, virtual reality, augmented reality, holographic technology, quantum computing, quantum communication, quantum measurement, digital twin or finance. The foregoing is merely an example, and is not intended to limit the application field of the interface checking method provided by the present invention.
The interface checking method provided by the invention can be used in the financial field or other fields, for example, can be used in the transaction application scene in the financial field. Other fields are any field other than the financial field, for example, the electric field. The foregoing is merely an example, and is not intended to limit the application field of the interface checking method provided by the present invention.
Corresponding to the method for checking the interface provided by the embodiment of the application, the embodiment of the application also provides a device for checking the interface.
As shown in fig. 3, an architecture diagram of an interface checking device according to an embodiment of the present application includes:
a document reading unit 100, configured to read an interface document of an interface to be tested, to obtain a document field line sequence of the interface document; the interface document is written based on a preset document template; the sequence of document field lines includes a plurality of document field lines, and the order of each document field line is determined based on the line location in the interface document where the document field line is located.
The code reading unit 200 is configured to read a message code of the interface to be tested, so as to obtain a message field row sequence of the message code; the sequence of message field lines includes a plurality of message field lines, and the sequence bit of each message field line is determined based on the line position of the message field line in the message code.
The comparison unit 300 is configured to compare, in the case that the field type of the field indicated by the kth document field line in the document field line sequence is the same as the field type of the field indicated by the kth message field line in the message field line sequence, the field length of the field indicated by the kth document field line with the field length of the field indicated by the kth message field line, to obtain a field length comparison result; wherein k=1, 2, …, t, t is any one of the first value and the second value; the first numerical value is the number of document field lines contained in the sequence of document field lines; the second value is the number of message field lines included in the sequence of message field lines.
Optionally, the comparing unit 300 is specifically configured to: under the condition that the first value is equal to the second value, comparing the field type of the field shown by the kth document field line in the document field line sequence with the field type of the field shown by the kth message field line in the message field line sequence to obtain a field type comparison result; under the condition that the field type comparison result meets a first preset condition, comparing the field length of the field shown in the kth document field row with the field length of the field shown in the kth message field row to obtain a field length comparison result; the first preset condition is: the field type of the field shown in the kth document field line is the same as the field type of the field shown in the kth message field line.
The alignment unit 300 is further configured to: setting a first identifier for other document field lines except the previous m-bit document field lines in the interface document under the condition that the first value is larger than the second value; m is equal to a second value; the first identifier is used for indicating that the document field line is not matched with the message field line.
The alignment unit 300 is further configured to: setting a first identifier for other message field lines except the first n message field lines in the message code under the condition that the first value is smaller than the second value; n is equal to a first value; the first identifier is used for indicating that the document field line is not matched with the message field line.
The alignment unit 300 is further configured to: judging whether a field shown in a kth message field row is a character type field or not under the condition that the field type comparison result does not accord with a first preset condition; setting a second identifier for a kth document field line in the interface document and a kth message field line in the message code under the condition that the field indicated by the kth message field line is a character type field; the second identifier is used for indicating that the document field line is not completely matched with the message field line and needs to be checked manually; setting a first identifier for a kth document field line in the interface document and a kth message field line in the message code under the condition that a field shown by the kth message field line is not a character type field; the first identifier is used for indicating that the document field line is not matched with the message field line.
The alignment unit 300 is further configured to: calculating the sum of the field length of the field shown in the kth document field row and the field length of the target document under the condition that the field length comparison result does not meet the second preset condition but meets the third preset condition to obtain a third numerical value; the third preset condition is: the field length of the field shown in the kth document field line is smaller than that of the field shown in the kth message field line; the target document field length is: the sum of the field lengths of the fields shown in the field rows of each target document is not less than the field length of the field shown in the field row of the kth message; the target document field line comprises the (k+r) th document field line in the document field line sequence, wherein r is a positive integer;
The alignment unit 300 is further configured to: calculating the sum of the field length of the field shown in the kth message field row and the target message field length to obtain a fourth value under the condition that the field length comparison result does not meet the second preset condition and does not meet the third preset condition; the third preset condition is: the field length of the field shown in the kth document field line is smaller than that of the field shown in the kth message field line; the length of the target message field is as follows: the sum of the field lengths of the fields shown in the field rows of each target message is not smaller than the field length of the field shown in the field row of the kth document; the target message field line comprises the k+r message field line in the message field line sequence, and r is a positive integer.
The identification unit 400 is configured to set a third identifier for a kth document field line in the interface document and a kth message field in the message code, if the field length comparison result meets a second preset condition; the second preset condition is: the field length of the field shown in the kth document field line is equal to the field length of the field shown in the kth message field line; the third identifier is used for indicating that the document field line is matched with the message field line.
Optionally, the identification unit 400 is further configured to: setting a third identifier for a kth document field line and a kth+r document field line in the interface document and a kth message field line in the message code under the condition that the third numerical value is equal to the field length of the field indicated by the kth message field line; setting a first identifier for other document field lines of which sequence bits are arranged behind the kth document field line and other message field lines of which sequence bits are arranged behind the kth message field line in the message code under the condition that the third numerical value is larger than the field length of the field shown by the kth message field line; the first identifier is used for indicating that the document field line is not matched with the message field line.
The identification unit 400 is further configured to: setting a third identifier for a kth message field line and a kth+r message field line in the message code and a kth document field line in the interface document under the condition that the fourth numerical value is equal to the field length of the field shown by the kth document field line; setting a first identifier for other message field lines of which sequence bits are arranged behind the kth message field line in the message code and other document field lines of which sequence bits are arranged behind the kth document field line in the interface document under the condition that the fourth numerical value is larger than the field length of the field shown in the kth document field line; the first identifier is used for indicating that the document field line is not matched with the message field line.
In summary, the document field line in the interface document is compared with the message field line in the message code, and the identifier is set for the document field line and the message field line according to the comparison result, so that the user can locate the defect in the interface to be tested based on the identifier contained in the document field line and the message field line as the reference basis, thereby realizing effective inspection of the interface to be tested and reducing the defect rate of the interface test.
The present application also provides a computer-readable storage medium including a stored program, wherein the program executes the interface checking method provided by the present application.
The application also provides an interface checking device, comprising: a processor, a memory, and a bus. The processor is connected with the memory through a bus, the memory is used for storing a program, and the processor is used for running the program, wherein the interface checking method provided by the application is executed when the program runs, and comprises the following steps:
reading an interface document of an interface to be tested to obtain a document field line sequence of the interface document; the interface document is written based on a preset document template; the document field line sequence comprises a plurality of document field lines, and the sequence bit of each document field line is determined based on the line position of the document field line in the interface document;
Reading the message code of the interface to be tested to obtain a message field row sequence of the message code; the message field line sequence comprises a plurality of message field lines, and the sequence bit of each message field line is determined based on the line position of the message field line in the message code;
comparing the field length of the field shown by the kth document field line with the field length of the field shown by the kth message field line under the condition that the field type of the field shown by the kth document field line in the document field line sequence is the same as the field type of the field shown by the kth message field line in the message field line sequence, so as to obtain a field length comparison result; wherein k=1, 2, …, t, t is any one of the first value and the second value; the first numerical value is the number of document field lines contained in the document field line sequence; the second numerical value is the number of message field lines contained in the message field line sequence;
setting a third identifier for a kth document field row in the interface document and a kth message field in the message code under the condition that the field length comparison result meets a second preset condition; the second preset condition is: the field length of the field shown in the kth document field line is equal to the field length of the field shown in the kth message field line; the third identifier is used for indicating that the document field line is matched with the message field line.
Specifically, on the basis of the foregoing embodiment, when the field type of the field indicated by the kth document field line in the document field line sequence is the same as the field type of the field indicated by the kth message field line in the message field line sequence, comparing the field length of the field indicated by the kth document field line with the field length of the field indicated by the kth message field line to obtain a field length comparison result, where the comparing includes:
under the condition that the first value is equal to the second value, comparing the field type of the field shown by the kth document field line in the document field line sequence with the field type of the field shown by the kth message field line in the message field line sequence to obtain a field type comparison result;
under the condition that the field type comparison result meets a first preset condition, comparing the field length of the field shown in the kth document field line with the field length of the field shown in the kth message field line to obtain a field length comparison result; the first preset condition is as follows: the field type of the field shown in the kth document field row is the same as the field type of the field shown in the kth message field row.
Specifically, on the basis of the above embodiment, the method further includes:
setting a first identifier for other document field lines except the first m-bit document field line in the interface document under the condition that the first value is larger than the second value; m is equal to the second value; the first identifier is used for indicating that the document field line is not matched with the message field line.
Specifically, on the basis of the above embodiment, the method further includes:
setting a first identifier for other message field lines except the first n-bit message field line in the message code under the condition that the first value is smaller than the second value; n is equal to the first value; the first identifier is used for indicating that the document field line is not matched with the message field line.
Specifically, on the basis of the above embodiment, the method further includes:
judging whether the field shown in the kth message field row is a character type field or not under the condition that the field type comparison result does not accord with the first preset condition;
setting a second identifier for a kth document field line in the interface document and a kth message field line in the message code under the condition that the field indicated by the kth message field line is a character type field; the second identifier is used for indicating that the document field line is not completely matched with the message field line and needs to be checked manually;
Setting a first identifier for a kth document field line in the interface document and a kth message field line in the message code under the condition that a field shown by the kth message field line is not a character type field; the first identifier is used for indicating that the document field line is not matched with the message field line.
Specifically, on the basis of the above embodiment, the method further includes:
calculating the sum of the field length of the field shown in the kth document field row and the field length of the target document to obtain a third value when the field length comparison result does not meet the second preset condition but meets a third preset condition; the third preset condition is: the field length of the field shown in the kth document field line is smaller than the field length of the field shown in the kth message field line; the target document field length is: the sum of the field lengths of the fields shown in each target document field row is not less than the field length of the field shown in the kth message field row; the target document field line comprises the k+r document field line in the document field line sequence, wherein r is a positive integer;
Setting the third identifier for a kth document field line and a kth+r document field line in the interface document and a kth message field line in the message code under the condition that the third value is equal to the field length of the field indicated by the kth message field line;
setting a first identifier for other document field lines of which sequence bits are arranged after the kth document field line in the interface document and other message field lines of which sequence bits are arranged after the kth message field line in the message code under the condition that the third numerical value is larger than the field length of the field shown by the kth message field line; the first identifier is used for indicating that the document field line is not matched with the message field line.
Specifically, on the basis of the above embodiment, the method further includes:
calculating the sum of the field length of the field shown in the kth message field row and the target message field length to obtain a fourth value when the field length comparison result does not meet the second preset condition and does not meet the third preset condition; the third preset condition is: the field length of the field shown in the kth document field line is smaller than the field length of the field shown in the kth message field line; the length of the target message field is as follows: the sum of the field lengths of the fields shown in each target message field row is not less than the field length of the field shown in the kth document field row; the target message field line comprises the k+r message field line in the message field line sequence, wherein r is a positive integer;
Setting the third identifier for a kth message field line and a k+r message field line in the message code and a kth document field line in an interface document under the condition that the fourth value is equal to the field length of the field shown by the kth document field line;
setting a first identifier for other message field lines of which sequence bits are arranged after the kth message field line in the message code and other document field lines of which sequence bits are arranged after the kth document field line in the interface document under the condition that the fourth numerical value is larger than the field length of the field shown by the kth document field line; the first identifier is used for indicating that the document field line is not matched with the message field line.
The functionality of the methods of embodiments of the present application, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored on a computing device readable storage medium. Based on such understanding, a part of the present application that contributes to the prior art or a part of the technical solution may be embodied in the form of a software product stored in a storage medium, comprising several instructions for causing a computing device (which may be a personal computer, a server, a mobile computing device or a network device, etc.) to perform all or part of the steps of the method of the various embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk or an optical disk.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. 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 application. Thus, the present application 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 (9)

1. An interface inspection method, comprising:
reading an interface document of an interface to be tested to obtain a document field line sequence of the interface document; the interface document is written based on a preset document template; the document field line sequence comprises a plurality of document field lines, and the sequence bit of each document field line is determined based on the line position of the document field line in the interface document;
Reading the message code of the interface to be tested to obtain a message field row sequence of the message code; the message field line sequence comprises a plurality of message field lines, and the sequence bit of each message field line is determined based on the line position of the message field line in the message code;
comparing the field length of the field shown by the kth document field line with the field length of the field shown by the kth message field line under the condition that the field type of the field shown by the kth document field line in the document field line sequence is the same as the field type of the field shown by the kth message field line in the message field line sequence, so as to obtain a field length comparison result; wherein k=1, 2, …, t, t is any one of the first value and the second value; the first numerical value is the number of document field lines contained in the document field line sequence; the second numerical value is the number of message field lines contained in the message field line sequence;
setting a third identifier for a kth document field row in the interface document and a kth message field in the message code under the condition that the field length comparison result meets a second preset condition; the second preset condition is: the field length of the field shown in the kth document field line is equal to the field length of the field shown in the kth message field line; the third identifier is used for indicating that the document field line is matched with the message field line;
Calculating the sum of the field length of the field shown in the kth document field row and the field length of the target document to obtain a third value when the field length comparison result does not meet the second preset condition but meets a third preset condition; the third preset condition is: the field length of the field shown in the kth document field line is smaller than the field length of the field shown in the kth message field line; the target document field length is: the sum of the field lengths of the fields shown in each target document field row is not less than the field length of the field shown in the kth message field row; the target document field line comprises the k+r document field line in the document field line sequence, wherein r is a positive integer;
setting the third identifier for a kth document field line and a kth+r document field line in the interface document and a kth message field line in the message code under the condition that the third value is equal to the field length of the field indicated by the kth message field line;
setting a first identifier for other document field lines of which sequence bits are arranged after the kth document field line in the interface document and other message field lines of which sequence bits are arranged after the kth message field line in the message code under the condition that the third numerical value is larger than the field length of the field shown by the kth message field line; the first identifier is used for indicating that the document field line is not matched with the message field line.
2. The method according to claim 1, wherein comparing the field length of the field indicated by the kth document field line with the field length of the field indicated by the kth message field line to obtain a field length comparison result when the field type of the field indicated by the kth document field line in the document field line sequence is the same as the field type of the field indicated by the kth message field line in the message field line sequence, includes:
under the condition that the first value is equal to the second value, comparing the field type of the field shown by the kth document field line in the document field line sequence with the field type of the field shown by the kth message field line in the message field line sequence to obtain a field type comparison result;
under the condition that the field type comparison result meets a first preset condition, comparing the field length of the field shown in the kth document field line with the field length of the field shown in the kth message field line to obtain a field length comparison result; the first preset condition is as follows: the field type of the field shown in the kth document field row is the same as the field type of the field shown in the kth message field row.
3. The method as recited in claim 2, further comprising:
setting a first identifier for other document field lines except the first m-bit document field line in the interface document under the condition that the first value is larger than the second value; m is equal to the second value; the first identifier is used for indicating that the document field line is not matched with the message field line.
4. The method as recited in claim 2, further comprising:
setting a first identifier for other message field lines except the first n-bit message field line in the message code under the condition that the first value is smaller than the second value; n is equal to the first value; the first identifier is used for indicating that the document field line is not matched with the message field line.
5. The method as recited in claim 2, further comprising:
judging whether the field shown in the kth message field row is a character type field or not under the condition that the field type comparison result does not accord with the first preset condition;
setting a second identifier for a kth document field line in the interface document and a kth message field line in the message code under the condition that the field indicated by the kth message field line is a character type field; the second identifier is used for indicating that the document field line is not completely matched with the message field line and needs to be checked manually;
Setting a first identifier for a kth document field line in the interface document and a kth message field line in the message code under the condition that a field shown by the kth message field line is not a character type field; the first identifier is used for indicating that the document field line is not matched with the message field line.
6. The method as recited in claim 1, further comprising:
calculating the sum of the field length of the field shown in the kth message field row and the target message field length to obtain a fourth value when the field length comparison result does not meet the second preset condition and does not meet the third preset condition; the third preset condition is: the field length of the field shown in the kth document field line is smaller than the field length of the field shown in the kth message field line; the length of the target message field is as follows: the sum of the field lengths of the fields shown in each target message field row is not less than the field length of the field shown in the kth document field row; the target message field line comprises the k+r message field line in the message field line sequence, wherein r is a positive integer;
Setting the third identifier for a kth message field line and a k+r message field line in the message code and a kth document field line in an interface document under the condition that the fourth value is equal to the field length of the field shown by the kth document field line;
setting a first identifier for other message field lines of which sequence bits are arranged after the kth message field line in the message code and other document field lines of which sequence bits are arranged after the kth document field line in the interface document under the condition that the fourth numerical value is larger than the field length of the field shown by the kth document field line; the first identifier is used for indicating that the document field line is not matched with the message field line.
7. An interface inspection apparatus, comprising:
the document reading unit is used for reading the interface document of the interface to be tested to obtain a document field line sequence of the interface document; the interface document is written based on a preset document template; the document field line sequence comprises a plurality of document field lines, and the sequence bit of each document field line is determined based on the line position of the document field line in the interface document;
The code reading unit is used for reading the message code of the interface to be tested to obtain a message field row sequence of the message code; the message field line sequence comprises a plurality of message field lines, and the sequence bit of each message field line is determined based on the line position of the message field line in the message code;
the comparison unit is used for comparing the field length of the field shown by the kth document field line with the field length of the field shown by the kth message field line under the condition that the field type of the field shown by the kth message field line in the message field line sequence is the same as the field type of the field shown by the kth message field line in the message field line sequence, so as to obtain a field length comparison result; wherein k=1, 2, …, t, t is any one of the first value and the second value; the first numerical value is the number of document field lines contained in the document field line sequence; the second numerical value is the number of message field lines contained in the message field line sequence;
the identification unit is used for setting a third identification for a kth document field row in the interface document and a kth message field in the message code under the condition that the field length comparison result meets a second preset condition; the second preset condition is: the field length of the field shown in the kth document field line is equal to the field length of the field shown in the kth message field line; the third identifier is used for indicating that the document field line is matched with the message field line;
The identification unit is further configured to: calculating the sum of the field length of the field shown in the kth document field row and the field length of the target document to obtain a third value when the field length comparison result does not meet the second preset condition but meets a third preset condition; the third preset condition is: the field length of the field shown in the kth document field line is smaller than the field length of the field shown in the kth message field line; the target document field length is: the sum of the field lengths of the fields shown in each target document field row is not less than the field length of the field shown in the kth message field row; the target document field line comprises the k+r document field line in the document field line sequence, wherein r is a positive integer; setting the third identifier for a kth document field line and a kth+r document field line in the interface document and a kth message field line in the message code under the condition that the third value is equal to the field length of the field indicated by the kth message field line; setting a first identifier for other document field lines of which sequence bits are arranged after the kth document field line in the interface document and other message field lines of which sequence bits are arranged after the kth message field line in the message code under the condition that the third numerical value is larger than the field length of the field shown by the kth message field line; the first identifier is used for indicating that the document field line is not matched with the message field line.
8. A computer-readable storage medium, characterized in that the computer-readable storage medium includes a stored program, wherein the program performs the interface checking method of any one of claims 1 to 6.
9. An interface inspection apparatus, comprising: a processor, a memory, and a bus; the processor is connected with the memory through the bus;
the memory is used for storing a program, and the processor is used for running the program, wherein the program executes the interface checking method according to any one of claims 1-6.
CN202210365807.XA 2022-04-08 2022-04-08 Interface checking method, device, storage medium and equipment Active CN114760236B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210365807.XA CN114760236B (en) 2022-04-08 2022-04-08 Interface checking method, device, storage medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210365807.XA CN114760236B (en) 2022-04-08 2022-04-08 Interface checking method, device, storage medium and equipment

Publications (2)

Publication Number Publication Date
CN114760236A CN114760236A (en) 2022-07-15
CN114760236B true CN114760236B (en) 2023-11-14

Family

ID=82328710

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210365807.XA Active CN114760236B (en) 2022-04-08 2022-04-08 Interface checking method, device, storage medium and equipment

Country Status (1)

Country Link
CN (1) CN114760236B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012034366A1 (en) * 2010-09-14 2012-03-22 中兴通讯股份有限公司 Method and apparatus for detecting interface of communcation device
CN107797933A (en) * 2017-11-22 2018-03-13 中国银行股份有限公司 Generate the method and device of analog message
CN109189666A (en) * 2018-08-02 2019-01-11 腾讯科技(北京)有限公司 Interface test method, device and computer equipment
CN110532107A (en) * 2019-07-22 2019-12-03 平安付科技服务有限公司 Interface call method, device, computer equipment and storage medium
CN110990276A (en) * 2019-11-29 2020-04-10 泰康保险集团股份有限公司 Automatic testing method and device for interface field and storage medium
CN111159049A (en) * 2019-12-31 2020-05-15 中国银行股份有限公司 Automatic interface testing method and system
CN111679983A (en) * 2020-06-08 2020-09-18 中国银行股份有限公司 JAVA interface static test method and device
CN112416457A (en) * 2020-11-19 2021-02-26 中国建设银行股份有限公司 Interface configuration file generation method and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012034366A1 (en) * 2010-09-14 2012-03-22 中兴通讯股份有限公司 Method and apparatus for detecting interface of communcation device
CN107797933A (en) * 2017-11-22 2018-03-13 中国银行股份有限公司 Generate the method and device of analog message
CN109189666A (en) * 2018-08-02 2019-01-11 腾讯科技(北京)有限公司 Interface test method, device and computer equipment
CN110532107A (en) * 2019-07-22 2019-12-03 平安付科技服务有限公司 Interface call method, device, computer equipment and storage medium
CN110990276A (en) * 2019-11-29 2020-04-10 泰康保险集团股份有限公司 Automatic testing method and device for interface field and storage medium
CN111159049A (en) * 2019-12-31 2020-05-15 中国银行股份有限公司 Automatic interface testing method and system
CN111679983A (en) * 2020-06-08 2020-09-18 中国银行股份有限公司 JAVA interface static test method and device
CN112416457A (en) * 2020-11-19 2021-02-26 中国建设银行股份有限公司 Interface configuration file generation method and device

Also Published As

Publication number Publication date
CN114760236A (en) 2022-07-15

Similar Documents

Publication Publication Date Title
CN107807982B (en) Consistency checking method and device for heterogeneous database
CN113298638A (en) Root cause positioning method, electronic device and storage medium
CN114022151A (en) Block chain data visualization method and system, electronic device and storage medium
CN111400695B (en) Equipment fingerprint generation method, device, equipment and medium
CN114265740A (en) Error information processing method, device, equipment and storage medium
CN114760236B (en) Interface checking method, device, storage medium and equipment
CN111723182B (en) Key information extraction method and device for vulnerability text
CN115879826B (en) Fine chemical process quality inspection method, system and medium based on big data
CN109324963B (en) Method for automatically testing profit result and terminal equipment
CN111045892A (en) Method and device for detecting process state of intelligent contract execution
CN116383052A (en) Automatic testing method, device and equipment for batch processing task and storage medium
CN115599778A (en) Data file processing method and device, electronic equipment and storage medium
CN114661671A (en) File processing method and device, computer readable storage medium and electronic equipment
CN114745452A (en) Equipment management method and device and electronic equipment
CN114595795A (en) NFC tag source tracing data processing method
CN113157583A (en) Test method, device and equipment
CN114021642A (en) Data processing method and device, electronic equipment and storage medium
CN111625455A (en) Program testing method, device, equipment and medium
CN117076546B (en) Data processing method, terminal device and computer readable storage medium
CN110414186B (en) Data asset segmentation verification method and device
CN111968022B (en) Service number generation system and method based on JSON configuration mode
CN117076953B (en) Asynchronous service exception handling method, electronic device and computer readable storage medium
CN118014599B (en) Block chain-based data tracing method, system, equipment and medium
CN115599689A (en) Test logic display method, device, equipment and storage medium
CN116187794A (en) Data calibration method, device, electronic equipment and storage medium

Legal Events

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