CN115905024A - Interface execution verification method, device and equipment - Google Patents

Interface execution verification method, device and equipment Download PDF

Info

Publication number
CN115905024A
CN115905024A CN202310003279.8A CN202310003279A CN115905024A CN 115905024 A CN115905024 A CN 115905024A CN 202310003279 A CN202310003279 A CN 202310003279A CN 115905024 A CN115905024 A CN 115905024A
Authority
CN
China
Prior art keywords
data
interface
query result
database query
returned
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
CN202310003279.8A
Other languages
Chinese (zh)
Inventor
杨晓慧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Zhongtongji Network Technology Co Ltd
Original Assignee
Shanghai Zhongtongji Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Zhongtongji Network Technology Co Ltd filed Critical Shanghai Zhongtongji Network Technology Co Ltd
Priority to CN202310003279.8A priority Critical patent/CN115905024A/en
Publication of CN115905024A publication Critical patent/CN115905024A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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

Abstract

The invention relates to the technical field of data processing, in particular to an interface execution verification method, an interface execution verification device and interface execution verification equipment.

Description

Interface execution verification method, device and equipment
Technical Field
The invention relates to the technical field of data processing, in particular to an interface execution verification method, device and equipment.
Background
Among many interface automation tools, the number of friends using the meter for interface automation is not few, and a problem is inevitably encountered in the using process: how to verify that this interface execution was successful? Assertions are a common debugging approach in software development, and this mechanism is supported in many development languages. The Jmeter also provides an element, called an assertion, which functions like a checkpoint in loadrunner to check whether response data and the like obtained in the test are in accordance with expectations, to ensure that data interaction during the performance test is in accordance with expectations. In the meter, response assertions are used more often.
However, the response assertion provided by the meter itself is relatively primary, and it cannot be determined whether the return of the interface is consistent with the data stored in the database, so that it cannot be verified whether the interface is successfully executed.
Disclosure of Invention
In view of the above, an object of the present invention is to provide a method, an apparatus and a device for verifying interface execution, so as to overcome the problem that whether the interface execution is successful cannot be verified at present.
In order to achieve the purpose, the invention adopts the following technical scheme:
in a first aspect, the present application provides an interface execution verification method, including:
acquiring database query result data and response data returned by an interface;
comparing the database query result data with the returned response data;
and if the database query result data are consistent with the returned response data, the interface is successfully executed.
Further, the method for acquiring the database query result data and the response data returned by the interface includes:
acquiring the total record number of the database query result and the field value of each record;
and acquiring the total record number returned by the interface and the field value of each record.
Further, before the comparing the database query result data with the returned response data, the method described above further includes:
and converting the obtained database query result data and the response data returned by the interface into the same data format.
Further, the method described above, wherein the comparing the database query result data with the returned response data, comprises:
comparing the total record number of the database query result with the total record number returned by the interface;
and if the comparison result is consistent, comparing the values of different fields in the database query result data and the response data returned by the interface according to the column name contained in the database query result.
Further, the method described above, the data format, includes:
any of an array, a multi-level array, an object, a multi-level object, and a combination of data and objects.
In a second aspect, the present application provides an interface execution verification apparatus, including:
the data acquisition module is used for acquiring database query result data and response data returned by the interface;
the data comparison module is used for comparing the database query result data with the returned response data;
and the result judging module is used for judging that the interface is successfully executed when the database query result data is consistent with the returned response data.
In a third aspect, the present application provides an interface execution verification apparatus, including: a processor and a memory, the processor coupled to the memory:
the processor is used for calling and executing the program stored in the memory;
the memory is used for storing the program, and the program is at least used for executing the interface execution verification method.
The interface execution verification method has the beneficial effects that:
according to the method and the device, the database query result data and the response data returned by the interface are obtained, then the database query result data and the returned response data are compared, and when the database query result data and the returned response data are consistent, the interface is judged to be successfully executed, so that the problem that whether the interface is successfully executed cannot be verified in the prior art is solved.
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 some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flow chart provided by one embodiment of a method for interface execution verification of the present invention;
FIG. 2 is a schematic structural diagram of an interface execution verification apparatus according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram provided by an embodiment of an interface execution verification apparatus according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It should be apparent that the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without any inventive step, are within the scope of the present invention.
Among many tools for interface automation, there are many friends who use a Jmeter for interface automation, and a problem is inevitably encountered during the use process: how to verify that this interface execution was successful? Assertions are a common debugging approach in software development, and this mechanism is supported in many development languages. The meter also provides an element called assertion, which functions similarly to the checkpoint in loadrunner, for checking whether response data and the like obtained in the test are in accordance with expectations, and for ensuring that data interaction during the performance test is in accordance with expectations. In the meter, response assertions are used more often.
However, the response assertion provided by the meter itself is relatively primitive, and it cannot be determined whether the return of the interface is consistent with the data stored in the database, so that it cannot be verified whether the interface is successfully executed.
In view of the above, an object of the present invention is to provide a method, an apparatus and a device for verifying interface execution, so as to overcome the problem that whether the interface execution is successful cannot be verified at present.
Fig. 1 is a flowchart of an interface execution verification method according to an embodiment of the present invention. Referring to fig. 1, the present embodiment may include the following steps:
s1, obtaining database query result data and response data returned by an interface.
And S2, comparing the database query result data with the returned response data.
And S3, if the database query result data are consistent with the returned response data, the interface is successfully executed.
It should be noted that, when the verification comparison result is inconsistent, it is determined that the interface execution fails, and the interface is sent to the user.
It can be understood that, in the embodiment, by obtaining the database query result data and the response data returned by the interface, and then comparing the database query result data with the returned response data, when the database query result data is consistent with the returned response data, the interface is judged to be successfully executed, so that the problem that whether the interface is successfully executed cannot be verified in the prior art is solved.
Preferably, step S1 includes:
acquiring the total record number of the database query result and the field value of each record;
and acquiring the total number of records returned by the interface and the field value of each record.
Preferably, before step S2, the method further includes:
and converting the obtained database query result data and the response data returned by the interface into the same data format.
Preferably, step S2 includes:
comparing the total record number of the database query result with the total record number returned by the interface;
if the comparison result is consistent, comparing the values of different fields in the database query result data and the response data returned by the interface according to the column names contained in the database query result.
It can be understood that, in order to make the verification result more accurate, the total record number of the database query result and the field value of each record, and the total record number returned by the interface and the field value of each record need to be obtained, after the total record number of the database query result and the total record number returned by the interface are verified to be consistent, the value of a certain field is verified, so as to prevent that, when the total record number is inconsistent and the field values of a certain record are compared separately, the verification result is the condition that the interface is successfully executed, and the verification result is inaccurate. Meanwhile, in order to prevent the inaccuracy of the verification result caused by the inconsistency of the data formats of the response data returned by the interface and the database query result, before comparing the data, the data of the database query result is automatically converted into the data with the consistency of the format of the response data returned by the interface according to the format of the response data returned by the interface.
In some alternative embodiments, the converted data format includes, but is not limited to, any of an array, a multi-level array, an object, a multi-level object, and a combination of data and objects.
The invention also provides an interface execution verification device which is used for realizing the method embodiment. Fig. 2 is a schematic structural diagram of an interface execution verification apparatus according to an embodiment of the present invention. As shown in fig. 2, the apparatus of the present embodiment includes:
the data acquisition module 1 is used for acquiring database query result data and response data returned by the interface;
the data comparison module 2 is used for comparing the query result data of the database with the returned response data;
and the result judging module 3 is used for judging that the execution of the interface is successful when the query result data of the database is consistent with the returned response data.
With regard to the apparatus in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be described in detail here.
The invention also provides interface execution verification equipment which is used for realizing the method embodiment. Fig. 3 is a schematic structural diagram provided by an embodiment of an interface execution verification apparatus according to the present invention. As shown in fig. 3, the present embodiment provides an apparatus including a processor 21 and a memory 22, wherein the processor 21 is connected to the memory 22. Wherein, the processor 21 is used for calling and executing the program stored in the memory 22; the memory 22 is used to store the program for executing at least the interface execution verification method in the above embodiment.
The specific implementation provided in the embodiment of the present application may refer to the implementation of the interface execution verification method in any of the above embodiments, and details are not described here.
It is understood that the same or similar parts in the above embodiments may be mutually referred to, and the same or similar contents in other embodiments may be referred to for the contents which are not described in detail in some embodiments.
It should be noted that the terms "first," "second," and the like in the description of the present invention are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. In addition, in the description of the present invention, the meaning of "a plurality" means at least two unless otherwise specified.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description of the specification, reference to the description of "one embodiment," "some embodiments," "an example," "a specific example," or "some examples" or the like means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (7)

1. An interface execution verification method, comprising:
acquiring database query result data and response data returned by an interface;
comparing the database query result data with the returned response data;
and if the database query result data are consistent with the returned response data, the interface is successfully executed.
2. The method of claim 1, wherein the obtaining database query result data and response data returned by the interface comprises:
acquiring the total record number of the database query result and the field value of each record;
and acquiring the total number of records returned by the interface and the field value of each record.
3. The method of claim 2, further comprising, prior to said comparing said database query result data with said returned response data:
and converting the obtained database query result data and the response data returned by the interface into the same data format.
4. The method of claim 3, wherein said comparing said database query result data with said returned response data comprises:
comparing the total record number of the database query result with the total record number returned by the interface;
and if the comparison result is consistent, comparing the values of different fields in the database query result data and the response data returned by the interface according to the column name contained in the database query result.
5. The method of claim 3, wherein the data format comprises:
any of an array, a multi-level array, an object, a multi-level object, and a combination of data and objects.
6. An interface execution verification apparatus, comprising:
the data acquisition module is used for acquiring database query result data and response data returned by the interface;
the data comparison module is used for comparing the database query result data with the returned response data;
and the result judging module is used for judging that the interface is successfully executed when the database query result data is consistent with the returned response data.
7. An interface execution verification device, comprising: a processor and a memory, the processor coupled to the memory:
the processor is used for calling and executing the program stored in the memory;
the memory for storing the program for executing at least the interface execution authentication method of any one of claims 1 to 5.
CN202310003279.8A 2023-01-03 2023-01-03 Interface execution verification method, device and equipment Pending CN115905024A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310003279.8A CN115905024A (en) 2023-01-03 2023-01-03 Interface execution verification method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310003279.8A CN115905024A (en) 2023-01-03 2023-01-03 Interface execution verification method, device and equipment

Publications (1)

Publication Number Publication Date
CN115905024A true CN115905024A (en) 2023-04-04

Family

ID=86489682

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310003279.8A Pending CN115905024A (en) 2023-01-03 2023-01-03 Interface execution verification method, device and equipment

Country Status (1)

Country Link
CN (1) CN115905024A (en)

Similar Documents

Publication Publication Date Title
WO2020000706A1 (en) Database comparison-based interface testing method and system, device and storage medium
CN107122296B (en) Method and apparatus for data assertion for test interface
WO2017000424A1 (en) Protocol detection method and apparatus
US7293204B2 (en) Computer peripheral connecting interface system configuration debugging method and system
US20230394208A1 (en) Device verification method, uvm verification platform, electronic apparatus and storage medium
CN111639026A (en) Interface test method, device and system
CN116089285A (en) Database testing method and device, electronic equipment and readable medium
EP1643400A2 (en) Electronic device connectivity analysis methods and systems
CN112148599A (en) Performance pressure measurement method, device and equipment
US20060036422A1 (en) Methods and systems for electronic device modelling
CN115905024A (en) Interface execution verification method, device and equipment
CN115495082B (en) TLV format data automatic conversion method and related equipment
CN115617819B (en) Data storage method, system, computer device and storage medium
CN115470125B (en) Log file-based debugging method, device and storage medium
US20130311962A1 (en) Instruction-by-instruction checking on acceleration platforms
CN114915643A (en) Configuration method, device, equipment and medium of railway signal centralized monitoring system
CN111581088B (en) Spark-based SQL program debugging method, device, equipment and storage medium
CN109697161A (en) A kind of test method of storing process, storage medium and database server
CN112631905A (en) Execution process data management method and device, computer equipment and storage medium
CN113673189A (en) DUT (device under test) surrogate model based verification method, device, equipment and medium
CN112486810A (en) Interface verification method, system, computer and storage medium of Jmeter platform
CN111581080A (en) Method, device, equipment and storage medium for generating interface test data
CN112187708A (en) Automatic completion method and device for certificate chain of digital certificate
CN117076182B (en) Error reporting method, system on chip, computer equipment and storage medium
CN112612707B (en) Method and device for running test script, equipment and computer readable storage medium

Legal Events

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