CN111382074A - Interface test method and device and electronic equipment - Google Patents

Interface test method and device and electronic equipment Download PDF

Info

Publication number
CN111382074A
CN111382074A CN202010158127.1A CN202010158127A CN111382074A CN 111382074 A CN111382074 A CN 111382074A CN 202010158127 A CN202010158127 A CN 202010158127A CN 111382074 A CN111382074 A CN 111382074A
Authority
CN
China
Prior art keywords
result
field
standard
return result
determining
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.)
Withdrawn
Application number
CN202010158127.1A
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.)
Mobai Beijing Information Technology Co Ltd
Original Assignee
Mobai Beijing Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mobai Beijing Information Technology Co Ltd filed Critical Mobai Beijing Information Technology Co Ltd
Priority to CN202010158127.1A priority Critical patent/CN111382074A/en
Publication of CN111382074A publication Critical patent/CN111382074A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Abstract

The invention discloses an interface testing method, an interface testing device and electronic equipment, wherein the method comprises the following steps: acquiring a target test case for testing a target interface; executing the target test case to obtain an actual return result of the target interface; acquiring a first standard return result and a second standard return result corresponding to a target interface; and detecting the actual return result according to the first standard return result and the second standard return result, and determining the test result of the target interface.

Description

Interface test method and device and electronic equipment
Technical Field
The present invention relates to the field of interface testing technologies, and in particular, to an interface testing method, an interface testing apparatus, and an electronic device.
Background
An application program is a computer program that provides a user with a particular application service. The application program can not be tested in the development process of the application program. As the demand for application functions is becoming more diverse and complex, the testing process of applications is also becoming more complex.
In the prior art, a developer is generally required to write test code to determine whether an interface accessed in the process of running an application program has defects. Specifically, in the process of testing the interface, the actual return result and the expected return result of the interface need to be asserted to determine whether the test of the interface passes or not.
However, this test method requires a developer to write a corresponding test code for each field to be checked in the returned result, which results in low test efficiency.
Disclosure of Invention
One object of the present invention is to provide a new solution for automatically testing an interface.
According to a first aspect of the present invention, there is provided an interface testing method, including:
acquiring a target test case for testing a target interface;
executing the target test case to obtain an actual return result of the target interface;
acquiring a first standard return result and a second standard return result corresponding to the target interface;
detecting the actual return result according to the first standard return result and the second standard return result, and determining the test result of the target interface;
wherein, the return result comprises at least one field and the value corresponding to each field.
Optionally, the detecting the actual returned result according to the first standard returned result and the second standard returned result, and determining the test result of the target interface includes:
determining a target difference field; the target difference field is a field with the same field type but different value in the first standard return result and the second standard return result;
determining an actual difference field; wherein the actual difference field is a field with the same type but different value as the field in the first standard return result;
and determining the test result of the target interface according to the target difference field and the actual difference field.
Optionally, the determining the test result of the target interface according to the target difference field and the actual difference field includes:
removing the target difference field from the actual difference field to obtain a removal result;
and determining that the test result is failed when any field is contained in the rejection result, and determining that the test result is successful when any field is not contained in the rejection result.
Optionally, the detecting the actual returned result according to the first standard returned result and the second standard returned result, and determining the test result of the target interface includes:
determining fields to be verified and the standard value of each field to be verified according to the first standard return result and the second standard return result;
respectively comparing the value of each field to be verified in the actual return result with a corresponding standard value to obtain a comparison result;
and determining the test result according to the comparison result.
Optionally, the determining the fields to be verified and the standard value of each field to be verified according to the first standard return result and the second standard return result includes:
comparing the values of each field in the first standard return result and the second standard result respectively;
determining the fields to be verified according to the comparison result, and taking the value of each field to be verified as a corresponding standard value; the field to be checked is a field with the same field type and value in the first standard return result and the second standard return result.
Optionally, the determining the test result according to the comparison result includes:
determining that the test result is successful under the condition that the comparison result is that the values of all the fields to be verified in the actual returned result are the same as the corresponding standard values;
and determining that the test result is failure when the comparison result is that the value of any field to be verified in the actual return result is different from the corresponding standard value.
Optionally, the method further includes:
under the condition that the first standard return result is not obtained, storing the actual return result as the first standard return result; alternatively, the first and second electrodes may be,
and under the condition that the second standard return result is not obtained, storing the actual return result as the second standard return result.
Optionally, the method further includes:
acquiring a preset neglected field; to determine the test result also from the ignore field.
Optionally, the method further includes:
providing an entry for entering the ignore field;
obtaining the ignore field from the entry.
According to a second aspect of the present invention, there is provided an interface test apparatus comprising:
the case acquisition module is used for acquiring a target test case for testing a target interface;
the case execution module is used for executing the target test case to obtain an actual return result of the target interface;
the standard acquisition module is used for acquiring a first standard return result and a second standard return result corresponding to the target interface;
the result determining module is used for detecting the actual return result according to the first standard return result and the second standard return result and determining the test result of the target interface;
wherein, the return result comprises at least one field and the value corresponding to each field.
According to a third aspect of the present invention, there is provided an electronic apparatus comprising:
the apparatus according to the second aspect of the present invention, or,
a processor and a memory for storing an executable computer program for controlling the processor to perform the method according to the first aspect of the invention.
The method and the device have the advantages that through the embodiment of the invention, developers do not need to write test codes, the test on the target interface can be completed only according to the first standard return result, the second standard return result and the actual return result, and the test efficiency can be improved. Moreover, by the embodiment of the invention, all other fields except the field which is removed and converted in the actual return result can be verified, so that the actual difference between the actual return result and the expected return result is obtained, and whether the target interface has defects or not is accurately judged.
Other features of the present invention and advantages thereof will become apparent from the following detailed description of exemplary embodiments thereof, which proceeds with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description, serve to explain the principles of the invention.
Fig. 1 is a block diagram of one example of a hardware configuration of an electronic device that can be used to implement an embodiment of the present invention.
Fig. 2 is a block diagram of another example of a hardware configuration of an electronic device that may be used to implement an embodiment of the invention.
Fig. 3 is a flow chart illustrating an interface testing method according to an embodiment of the present invention.
FIG. 4 shows a flow chart of one example of an interface testing method of one embodiment of the invention.
FIG. 5 shows a flow diagram of another example of an interface testing method of an embodiment of the invention.
FIG. 6 shows a functional block diagram of an interface test apparatus according to an embodiment of the present invention.
FIG. 7 shows a functional block diagram of an electronic device of one embodiment of the present invention.
Detailed Description
Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that: the relative arrangement of the components and steps, the numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless specifically stated otherwise.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.
Techniques, methods, and apparatus known to those of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate.
In all examples shown and discussed herein, any particular value should be construed as merely illustrative, and not limiting. Thus, other examples of the exemplary embodiments may have different values.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, further discussion thereof is not required in subsequent figures.
< hardware configuration >
Fig. 1 and 2 are block diagrams of hardware configurations of electronic devices that can be used to implement embodiments of the present invention.
In one embodiment, as shown in FIG. 1, the electronic device 1000 may be a server 1100.
The server 1100 is a service point that provides processing, databases, and communications facilities. The server 1100 can be a unitary server or a distributed server across multiple computers or computer data centers. The server may be of various types, such as, but not limited to, a web server, a news server, a mail server, a message server, an advertisement server, a file server, an application server, an interaction server, a database server, or a proxy server. In some embodiments, each server may include hardware, software, or embedded logic components or a combination of two or more such components for performing the appropriate functions supported or implemented by the server.
In an embodiment, the server may be a blade server, a rack server, or a cloud server, or may be a server group composed of a plurality of servers, or may be implemented as a cloud architecture, for example, implemented by a server cluster deployed in a cloud, and may further include one or more of the above types of servers.
In this embodiment, the server 1100 may include a processor 1110, a memory 1120, an interface device 1130, a communication device 1140, a display device 1150, and an input device 1160, as shown in fig. 1.
In this embodiment, the server 1100 may also include a speaker, a microphone, and the like, which are not limited herein.
The processor 1110 may be a dedicated server processor, or may be a desktop processor, a mobile version processor, or the like that meets performance requirements, and is not limited herein. The memory 1120 includes, for example, a ROM (read only memory), a RAM (random access memory), a nonvolatile memory such as a hard disk, and the like. The interface device 1130 includes various bus interfaces such as a serial bus interface (including a USB interface), a parallel bus interface, and the like. The communication device 1140 is capable of wired or wireless communication, for example. The display device 1150 is, for example, a liquid crystal display panel, an LED display panel touch display panel, or the like. Input devices 1160 may include, for example, a touch screen, a keyboard, and the like.
In this embodiment, the memory 1120 of the server 1100 is configured to store instructions for controlling the processor 1110 to operate at least to perform an interface testing method according to any embodiment of the present invention. The skilled person can design the instructions according to the disclosed solution. How the instructions control the operation of the processor is well known in the art and will not be described in detail herein.
Although shown as multiple devices in fig. 1, the present invention may relate to only some of the devices, e.g., server 1100 may relate to only memory 1120 and processor 1110.
In one embodiment, the electronic device 1000 may be a terminal device 1200 such as a PC, a notebook computer, etc. used by an operator, as shown in fig. 2, which is not limited herein.
In this embodiment, referring to fig. 2, the terminal apparatus 1200 may include a processor 1210, a memory 1220, an interface device 1230, a communication device 1240, a display device 1250, an input device 1260, a speaker 1270, a microphone 1280, and the like.
The processor 1210 may be a mobile version processor. The memory 1220 includes, for example, a ROM (read only memory), a RAM (random access memory), a nonvolatile memory such as a hard disk, and the like. The interface device 1230 includes, for example, a USB interface, a headphone interface, and the like. The communication device 1240 may be capable of wired or wireless communication, for example, the communication device 1240 may include a short-range communication device, such as any device that performs short-range wireless communication based on short-range wireless communication protocols, such as the Hilink protocol, WiFi (IEEE 802.11 protocol), Mesh, bluetooth, ZigBee, Thread, Z-Wave, NFC, UWB, LiFi, and the like, and the communication device 1240 may also include a long-range communication device, such as any device that performs WLAN, GPRS, 2G/3G/4G/5G long-range communication. The display device 1250 is, for example, a liquid crystal display, a touch display, or the like. The input device 1260 may include, for example, a touch screen, a keyboard, and the like. A user can input/output voice information through the speaker 1270 and the microphone 1280.
In this embodiment, the memory 1220 of the terminal device 1200 is used to store instructions for controlling the processor 1210 to operate at least to perform an interface test method according to any embodiment of the present invention. The skilled person can design the instructions according to the disclosed solution. How the instructions control the operation of the processor is well known in the art and will not be described in detail herein.
Although a plurality of devices of the terminal apparatus 1200 are shown in fig. 2, the present invention may relate only to some of the devices, for example, the terminal apparatus 1200 relates only to the memory 1220 and the processor 1210 and the display device 1250.
< method examples >
Fig. 3 is a schematic flow chart of a detection method for a network address according to an embodiment of the present invention.
In one example, the method shown in fig. 3 may be implemented by only the server or the terminal device, or may be implemented by both the server and the terminal device. In one embodiment, the terminal device may be the terminal device 1200 as shown in FIG. 2 and the server may be the server 1100 as shown in FIG. 1.
As shown in fig. 3, the method of the present embodiment includes the following steps S3100 to S3400:
step S3100, a target test case for testing the target interface is acquired.
The Test Case (Test Case) refers to the description of a Test task for a specific target, and embodies Test schemes, methods, techniques and strategies. The contents of the test object, the test environment, the input data, the test steps, the expected results, the test scripts and the like are included, and finally, a document is formed. It is simply considered that a test case is a set of test inputs, execution conditions, and expected results tailored for a particular purpose to verify whether a particular requirement is met.
In an embodiment of the present invention, the target test case may be a test case for testing the target interface, and is written in advance by a developer and stored in the electronic device.
In one embodiment of the present invention, the target interface may be a software interface or a hardware interface.
In the process of executing the target test case, the target interface is accessed, and a return result of the target interface is obtained.
At least one field and the corresponding value of each field are included in the return result of the target interface. Specifically, for the returned result obtained by accessing the target interface each time, the fields contained therein may be fixed, but the values corresponding to some of the fields may change.
Step S3200, executing the target test case to obtain an actual return result of the target interface.
And under the condition that the target test case is successfully executed, a return result of the target interface, namely an actual return result, can be obtained. In the case that the target test case fails to be executed, the method of this embodiment may be directly ended, and the developer may be notified to modify the target test case.
And step S3300, obtaining a first standard return result and a second standard return result corresponding to the target test case.
In one embodiment of the present invention, the first criterion return result and the second criterion return result may be return results obtained by accessing the target interface any two times, which are stored in advance before executing step S3100.
In one example, the first standard return result and the second standard return result may be, for example and without limitation, return results obtained by accessing the target interface when the target test case was executed the first two times.
In one embodiment of the present invention, the method may further comprise:
under the condition that the first standard return result is not obtained, storing the actual return result as the first standard return result; alternatively, the first and second electrodes may be,
and under the condition that the second standard return result is not obtained, storing the actual return result as the second standard return result.
In this embodiment, when the first standard return result or the second standard return result is not obtained, step S3400 may not be executed continuously, that is, the target interface is not tested, but only the actual return result is stored for testing the target interface together with the subsequently obtained actual return result.
And step S3400, detecting the actual return result according to the first standard return result and the second standard return result, and determining the test result of the target interface.
By the embodiment of the invention, a developer does not need to write test codes, and the test on the target interface can be completed only according to the first standard return result, the second standard return result and the actual return result, so that the test efficiency can be improved. Moreover, by the embodiment of the invention, all other fields except the field which is removed and converted in the actual return result can be verified, so that the actual difference between the actual return result and the expected return result is obtained, and whether the target interface has defects or not is accurately judged.
In the first embodiment of the present invention, the detecting the actual returned result according to the first standard returned result and the second standard returned result, and the determining the test result of the target interface may include steps S3411 to S3413 as follows:
step S3411, determining a target difference field; the target difference field is a field with the same field type but different value in the first standard return result and the second standard return result.
Specifically, the values of the fields with the same field type in the first standard return result and the second standard return result may be compared, and the fields with the same field type but different values may be used as the target difference fields. I.e., the target difference field differs in value in the first standard return result and the second standard return result.
Step S3412, determining an actual difference field; the actual difference field is a field with the same type but different value as the field in the first standard return result.
Specifically, the values of the fields with the same field type in the first standard returned result and the actual returned result may be compared, and the fields with the same field type but different values may be used as the actual difference fields. I.e. the actual difference field has a different value in the first standard returned result and the actual returned result.
Step S3413, determining a test result of the target interface according to the target difference field and the actual difference field.
In one embodiment of the present invention, determining the test result of the target interface according to the target difference field and the actual difference field includes steps S3414-1 to S3414-2 as follows:
step S3414-1, the target difference field is removed from the actual difference field to obtain a removal result.
Specifically, the target difference field existing in the actual difference field may be removed to obtain a removed result.
For example, the actual difference field may include "field 1, field 2, field 3, and field 4", and the target difference field may include "field 4 and field 5", and then the target difference field is removed from the actual difference field, and the obtained removal result may be "field 1, field 2, and field 3".
For another example, the actual difference field may include "field 1, field 2, field 3, and field 4", and the target difference field may include "field 1, field 2, field 3, and field 4", so that the target difference field is removed from the actual difference field, and the removal result may be "yes".
Step S3414-2, determining that the test result is failed under the condition that any field is contained in the rejection result; and determining that the test result is successful under the condition that any field is not contained in the culling result.
For example, in the example of "field 1, field 2, and field 3" in the culling result, the test result may be determined to be a failure. In the case that the culling result may be "" i.e. no field is included in the culling result, the test result may be determined to be successful.
By the embodiment of the invention, a developer does not need to write test codes, and the test on the target interface can be completed only according to the first standard return result, the second standard return result and the actual return result, so that the test efficiency can be improved. Moreover, by the embodiment of the invention, all other fields except the field which is removed and converted in the actual return result can be verified, so that the actual difference between the actual return result and the expected return result is obtained, and whether the target interface has defects or not is accurately judged.
In the second embodiment of the present invention, determining the test result of the target interface according to the first standard return result, the second standard return result, and the actual return result may include steps S3421 to S3423 as follows:
step S3421, determining the fields to be verified and the standard value of each field to be verified according to the first standard return result and the second standard return result.
In an embodiment of the present invention, determining the fields to be verified and the standard value of each field to be verified according to the first standard return result and the second standard return result may include steps S3421-1 to S3421-2 as follows:
step S3421-1, comparing the values of the corresponding fields in the first standard return result and the second standard result respectively.
Specifically, the fields included in the first standard return result and the second standard return result may be the same, but the corresponding values of each field may be the same or different. Therefore, in this step, the values of each field in the first standard return result and the second standard return result are compared in turn.
Step S3421-2, determining the fields to be verified according to the comparison result, and taking the value of each field to be verified as a corresponding standard value; the field to be checked is a field with the same field type and value in the first standard return result and the second standard return result.
Specifically, if the value of field 1 in the first standard return result and the second standard return result is the same, field 1 may be used as the field to be verified, and the value of field 1 (i.e., the value in the first standard return result and the second standard return result) may be used as the standard value of the field to be verified. And if the value of the field 2 in the first standard return result and the second standard return result is different, the field 2 is not taken as the field to be checked.
Step S3422, comparing the value of each field to be verified in the actual returned result with the corresponding standard value to obtain a comparison result.
Specifically, the comparison result may reflect whether the value of each field to be checked in the time return result is the same as the corresponding standard value.
Step S3423, determining the test result according to the comparison result.
In an embodiment of the present invention, the test result may be determined to be successful when the comparison result is that the values of all the fields to be verified in the actually returned result are the same as the corresponding standard values; and determining that the test result is failure under the condition that the comparison result is that the value of any field to be verified in the actual returned result is different from the corresponding standard value.
By the embodiment of the invention, a developer does not need to write test codes, and the test on the target interface can be completed only according to the first standard return result, the second standard return result and the actual return result, so that the test efficiency can be improved. Moreover, by the embodiment of the invention, all other fields except the field which is removed and converted in the actual return result can be verified, so that the actual difference between the actual return result and the expected return result is obtained, and whether the target interface has defects or not is accurately judged.
In one embodiment of the present invention, the method may further comprise:
acquiring a preset neglected field; to determine the test result also from the ignore field.
On the basis of the first embodiment, determining the test result according to the ignore field further includes: and further eliminating the neglected field from the actual difference field or the elimination result, and determining the test result according to the elimination result after the neglected field is eliminated. Specifically, under the condition that any field is contained in the elimination result after the omitted field is eliminated, the test result is determined to be failed; and determining that the test result is successful under the condition that any field is not included in the elimination result after the omitted field is eliminated.
On the basis of the second embodiment, determining the test result according to the ignore field further includes: eliminating neglected fields from the fields to be verified, and comparing the value of each field to be verified in the actual return result after the neglected fields are eliminated with the corresponding standard value to obtain a comparison result; determining that the test result is successful under the condition that the comparison result is that the values of all the fields to be verified in the actual returned result are the same as the corresponding standard values; and determining that the test result is failure under the condition that the comparison result is that the value of any field to be verified in the actual returned result is different from the corresponding standard value.
In this embodiment, the method may further include:
providing an entry for entering an ignore field; the ignore field is obtained from the entry.
In one embodiment of the invention, the entry may be an input box through which the user may enter the ignore field.
In another embodiment of the present invention, in response to the user clicking the entry, all fields in the returned result corresponding to the target interface are provided for the user to select, and the fields selected by the user are used as the ignored fields.
Through the embodiment, the neglected fields which do not need to be detected can be configured according to the actual requirements of the user, so that the test result of the target interface is more effective and better meets the requirements of the user.
< example 1>
FIG. 4 is a flowchart of an example of an interface testing method according to an embodiment of the present invention.
According to fig. 4, the method may comprise steps S4001 to S4007 as follows:
step S4001, a target test case for testing the target interface is obtained.
Step S4002, executing the target test case to obtain an actual return result of the target interface.
For example, the actual returned result may be as follows:
Figure BDA0002404816870000121
step S4003, a first standard return result and a second standard return result corresponding to the target test case are obtained.
For example, the first criterion returned results may be as follows:
Figure BDA0002404816870000122
Figure BDA0002404816870000131
the second criterion returned results may be as follows:
Figure BDA0002404816870000132
Figure BDA0002404816870000141
step S4004, determining the fields with the same field type but different values in the first standard return result and the second standard return result as target difference fields.
In the first standard return result and the second standard return result, the target difference fields with the same field type but different values may include: [ "/certificate/idcard/verifyImage" ] [ "token" ].
Step S4005, determining a field with the same field type but different value as the field in the first standard returned result as an actual difference field.
The actual returned result and the first standard returned result may include the actual difference fields with the same field type but different values: "/certificate/idcard/verifyImage" ] [ "token" ] and [ "/user.
And step S4006, removing the target difference field from the actual difference field to obtain a removal result.
The rejection result may include [ "/user. userstatesrervice/fireCertifyVerif" ] [ "issucces" ].
Step S4007, determining the test result as failure under the condition that the elimination result contains any field; and determining that the test result is successful under the condition that any field is not contained in the culling result.
Because the culling result also contains a field, the test result of the target interface is a failure.
< example 2>
FIG. 5 is a flowchart of an example of an interface testing method according to an embodiment of the present invention.
As shown in fig. 5, the method may include steps S5001 to S5007 as follows:
step S5001, a target test case for testing the target interface is obtained.
Step S5002, executing the target test case to obtain an actual return result of the target interface.
For example, the actual returned result may be as follows:
Figure BDA0002404816870000151
step S5003, a first standard return result and a second standard return result corresponding to the target test case are obtained.
For example, the first criterion returned results may be as follows:
Figure BDA0002404816870000152
Figure BDA0002404816870000161
the second criterion returned results may be as follows:
Figure BDA0002404816870000162
step S5004, comparing the values of the corresponding fields in the first standard return result and the second standard result respectively.
Step S5005, using the fields of the fields with the same field type and value in the first standard return result and the second standard return result as the fields to be verified, and using the value of each field to be verified as the corresponding standard value.
The fields to be checked in the first standard return result and the second standard return result, which have the same field type and the same value, may include: "certificate/idcard/vertical image" ] [ "token wo" ], [ "/certificate/idcard/vertical image" ] [ ""/certificate/idcard/vertical image "] [" code "], ["/certificate/idcard/vertical image "] [" msg "], ["/certificate/idcard/vertical image "] [" dual spindle "], and ["/user.
The standard value corresponding to the field to be verified [ "/certificate/idcard/verifyImage" ] [ "tokentwo" ] is ""; the standard value corresponding to the field to be verified [ "/verify/idcard/verifyImage" ] [ "loadImgOne" ] is "; the standard value corresponding to the field to be verified [ "/verify/idcard/verifyImage" ] [ "loadImgTwo" ] is ""; the standard value corresponding to the field to be verified [ "/verify/idcard/verifyImage" ] [ "code" ] is 0; the standard value corresponding to the field to be checked [ "/verify/idcard/verifyImage" ] [ "msg" ] is "success"; the standard value corresponding to the field to be verified [ "/verify/idcard/verifyImage" ] [ "duplicate mobile" ] is null; the standard value corresponding to the field to be checked [ "/user.
Step S5006, comparing the value of each field to be verified in the actual returned result with the corresponding standard value to obtain a comparison result.
The value of each field to be verified in the actual returned result is the same as the corresponding standard value, so that the obtained comparison result is that the values of all the fields to be verified in the actual returned result are the same as the corresponding standard values.
Step S5007, determining that the test result is successful under the condition that the comparison result is that the values of all the fields to be verified in the actual returned result are the same as the corresponding standard values; and determining that the test result is failure under the condition that the comparison result is that the value of any field to be verified in the actual returned result is different from the corresponding standard value.
The comparison result is that the values of all the fields to be verified in the actual returned result are the same as the corresponding standard values, so that the test result of the target interface is successful.
< apparatus embodiment >
Corresponding to the method, the invention also provides an interface testing device 6000. As shown in fig. 6, the interface test apparatus 6000 may include a use case acquiring module 6100, a use case executing module 6200, a standard acquiring module 6300, and a result determining module 6400. The case obtaining module 6100 is configured to obtain a target test case for testing a target interface; the case execution module 6200 is configured to execute the target test case to obtain an actual return result of the target interface; the standard obtaining module 6300 is configured to obtain a first standard return result and a second standard return result corresponding to the target interface; the result determining module 6400 is configured to detect an actual returned result according to the first standard returned result and the second standard returned result, and determine a test result of the target interface; wherein, the return result comprises at least one field and a value corresponding to each field.
In one embodiment of the invention, the result determination module 6400 may be configured to:
determining a target difference field; the target difference field is a field with the same field type but different value in the first standard return result and the second standard return result;
determining an actual difference field; the actual difference field is a field with the same type but different value as the field in the actual return result and the first standard return result;
and determining the test result of the target interface according to the target difference field and the actual difference field.
In one embodiment of the present invention, determining the test result of the target interface according to the target difference field and the actual difference field comprises:
removing the target difference field from the actual difference field to obtain a removal result;
and determining that the test result is failed under the condition that any field is contained in the rejection result, and determining that the test result is successful under the condition that any field is not contained in the rejection result.
In one embodiment of the invention, the result determination module 6400 may be further configured to:
determining fields to be verified and the standard value of each field to be verified according to the first standard return result and the second standard return result;
respectively comparing the value of each field to be verified in the actual returned result with the corresponding standard value to obtain a comparison result;
and determining a test result according to the comparison result.
In an embodiment of the present invention, determining the fields to be verified and the standard value of each field to be verified according to the first standard return result and the second standard return result includes:
respectively comparing the values of each field in the first standard return result and the second standard result;
determining fields to be verified according to the comparison result, and taking the value of each field to be verified as a corresponding standard value; the field to be checked is a field with the same field type and value in the first standard return result and the second standard return result.
In one embodiment of the present invention, determining the test result according to the comparison result comprises:
determining that the test result is successful under the condition that the comparison result is that the values of all the fields to be verified in the actual returned result are the same as the corresponding standard values;
and determining that the test result is failure under the condition that the comparison result is that the value of any field to be verified in the actual returned result is different from the corresponding standard value.
In an embodiment of the present invention, the interface test apparatus 6000 may further include:
the module is used for storing the actual return result as the first standard return result under the condition that the first standard return result is not obtained; alternatively, the first and second electrodes may be,
and the module is used for storing the actual return result as the second standard return result under the condition that the second standard return result is not acquired.
In an embodiment of the present invention, the interface test apparatus 6000 may further include:
the method comprises the steps of obtaining a preset neglected field; to determine the module of the test result also from the ignore field.
In an embodiment of the present invention, the interface test apparatus 6000 may further include:
means for providing an entry for entering an ignore field;
means for obtaining an ignore field from the entry.
It will be appreciated by those skilled in the art that the interface test apparatus 6000 can be implemented in various ways. For example, the interface test device 6000 may be implemented by an instruction configuration processor. For example, the interface test apparatus 6000 may be implemented by storing instructions in a ROM and reading the instructions from the ROM into a programmable device when starting up the device. For example, the interface test device 6000 may be cured into a dedicated device (e.g., ASIC). The interface test device 6000 may be divided into units independent of each other, or may be implemented by combining them together. The interface test device 6000 may be implemented by one of the various implementations described above, or may be implemented by a combination of two or more of the various implementations described above.
In this embodiment, the interface testing device 6000 may have various implementation forms, for example, the interface testing device 6000 may be any functional module running in a software product or an application program providing an interface testing function, or a peripheral insert, a plug-in, a patch, etc. of the software product or the application program, or the software product or the application program itself.
By the embodiment of the invention, a developer does not need to write test codes, and the test on the target interface can be completed only according to the first standard return result, the second standard return result and the actual return result, so that the test efficiency can be improved. Moreover, by the embodiment of the invention, all other fields except the field which is removed and converted in the actual return result can be verified, so that the actual difference between the actual return result and the expected return result is obtained, and whether the target interface has defects or not is accurately judged.
< electronic device embodiment >
The invention also provides an electronic device 7000. The electronic device 7000 may be the server 1100 as shown in fig. 1. The electronic device 7000 may also be the terminal device 1200 as shown in fig. 2.
In one example, the electronic device 7000 may include the interface testing apparatus 6000 provided in the foregoing embodiments, for performing the interface testing method according to any of the embodiments of the present invention.
In another example, as shown in FIG. 7, electronic device 7000 may also include processor 7100 and memory 7200, memory 7200 for storing computer programs; the computer program is for controlling the processor 7100 to perform the interface test method of any of the embodiments of the present invention.
By the embodiment of the invention, a developer does not need to write test codes, and the test on the target interface can be completed only according to the first standard return result, the second standard return result and the actual return result, so that the test efficiency can be improved. Moreover, by the embodiment of the invention, all other fields except the field which is removed and converted in the actual return result can be verified, so that the actual difference between the actual return result and the expected return result is obtained, and whether the target interface has defects or not is accurately judged.
The present invention may be a system, method and/or computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied therewith for causing a processor to implement various aspects of the present invention.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present invention may be assembler instructions, Instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or secondary code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, aspects of the present invention are implemented by personalizing an electronic circuit, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA), with state information of computer-readable program instructions, which can execute the computer-readable program instructions.
Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer-readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. It is well known to those skilled in the art that implementation by hardware, by software, and by a combination of software and hardware are equivalent.
Having described embodiments of the present invention, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen in order to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein. The scope of the invention is defined by the appended claims.

Claims (11)

1. An interface testing method, comprising:
acquiring a target test case for testing a target interface;
executing the target test case to obtain an actual return result of the target interface;
acquiring a first standard return result and a second standard return result corresponding to the target interface;
detecting the actual return result according to the first standard return result and the second standard return result, and determining the test result of the target interface;
wherein, the return result comprises at least one field and the value corresponding to each field.
2. The method of claim 1, wherein the detecting the actual returned result according to the first standard returned result and the second standard returned result, and determining the test result of the target interface comprises:
determining a target difference field; the target difference field is a field with the same field type but different value in the first standard return result and the second standard return result;
determining an actual difference field; wherein the actual difference field is a field with the same type but different value as the field in the first standard return result;
and determining the test result of the target interface according to the target difference field and the actual difference field.
3. The method of claim 2, the determining a test result for the target interface from the target difference field and the actual difference field comprising:
removing the target difference field from the actual difference field to obtain a removal result;
and determining that the test result is failed when any field is contained in the rejection result, and determining that the test result is successful when any field is not contained in the rejection result.
4. The method of claim 1, wherein the detecting the actual returned result according to the first standard returned result and the second standard returned result, and determining the test result of the target interface comprises:
determining fields to be verified and the standard value of each field to be verified according to the first standard return result and the second standard return result;
respectively comparing the value of each field to be verified in the actual return result with a corresponding standard value to obtain a comparison result;
and determining the test result according to the comparison result.
5. The method of claim 4, the determining fields to be verified and a standard value for each of the fields to be verified according to the first standard return result and the second standard return result comprising:
comparing the values of each field in the first standard return result and the second standard result respectively;
determining the fields to be verified according to the comparison result, and taking the value of each field to be verified as a corresponding standard value; the field to be checked is a field with the same field type and value in the first standard return result and the second standard return result.
6. The method of claim 4, the determining the test result from the alignment result comprising:
determining that the test result is successful under the condition that the comparison result is that the values of all the fields to be verified in the actual returned result are the same as the corresponding standard values;
and determining that the test result is failure when the comparison result is that the value of any field to be verified in the actual return result is different from the corresponding standard value.
7. The method of claim 1, further comprising:
under the condition that the first standard return result is not obtained, storing the actual return result as the first standard return result; alternatively, the first and second electrodes may be,
and under the condition that the second standard return result is not obtained, storing the actual return result as the second standard return result.
8. The method of any of claims 1 to 7, further comprising:
acquiring a preset neglected field; to determine the test result also from the ignore field.
9. The method of claim 8, further comprising:
providing an entry for entering the ignore field;
obtaining the ignore field from the entry.
10. An interface test apparatus comprising:
the case acquisition module is used for acquiring a target test case for testing a target interface;
the case execution module is used for executing the target test case to obtain an actual return result of the target interface;
the standard acquisition module is used for acquiring a first standard return result and a second standard return result corresponding to the target interface;
the result determining module is used for detecting the actual return result according to the first standard return result and the second standard return result and determining the test result of the target interface;
wherein, the return result comprises at least one field and the value corresponding to each field.
11. An electronic device, comprising:
the apparatus of claim 10, or,
a processor and a memory for storing an executable computer program for controlling the processor to perform the method according to any of claims 1 to 9.
CN202010158127.1A 2020-03-09 2020-03-09 Interface test method and device and electronic equipment Withdrawn CN111382074A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010158127.1A CN111382074A (en) 2020-03-09 2020-03-09 Interface test method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010158127.1A CN111382074A (en) 2020-03-09 2020-03-09 Interface test method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN111382074A true CN111382074A (en) 2020-07-07

Family

ID=71219871

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010158127.1A Withdrawn CN111382074A (en) 2020-03-09 2020-03-09 Interface test method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111382074A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112199297A (en) * 2020-10-30 2021-01-08 久瓴(江苏)数字智能科技有限公司 Data testing method and device, nonvolatile storage medium and processor
CN112783791A (en) * 2021-02-08 2021-05-11 中国工商银行股份有限公司 Interface test case generation method and device
WO2023123943A1 (en) * 2021-12-27 2023-07-06 深圳前海微众银行股份有限公司 Interface automation testing method and apparatus, and medium, device and program

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030097650A1 (en) * 2001-10-04 2003-05-22 International Business Machines Corporation Method and apparatus for testing software
CN104657270A (en) * 2015-02-28 2015-05-27 北京嘀嘀无限科技发展有限公司 Method and system for testing
CN108694104A (en) * 2017-04-12 2018-10-23 北京京东尚科信息技术有限公司 A kind of interface function contrast test method, apparatus, electronic equipment and storage medium
CN109446071A (en) * 2018-09-26 2019-03-08 深圳壹账通智能科技有限公司 Interface test method, interface test device, electronic equipment and storage medium
CN109889402A (en) * 2019-01-23 2019-06-14 北京字节跳动网络技术有限公司 Method and apparatus for generating information

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030097650A1 (en) * 2001-10-04 2003-05-22 International Business Machines Corporation Method and apparatus for testing software
CN104657270A (en) * 2015-02-28 2015-05-27 北京嘀嘀无限科技发展有限公司 Method and system for testing
CN108694104A (en) * 2017-04-12 2018-10-23 北京京东尚科信息技术有限公司 A kind of interface function contrast test method, apparatus, electronic equipment and storage medium
CN109446071A (en) * 2018-09-26 2019-03-08 深圳壹账通智能科技有限公司 Interface test method, interface test device, electronic equipment and storage medium
CN109889402A (en) * 2019-01-23 2019-06-14 北京字节跳动网络技术有限公司 Method and apparatus for generating information

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112199297A (en) * 2020-10-30 2021-01-08 久瓴(江苏)数字智能科技有限公司 Data testing method and device, nonvolatile storage medium and processor
CN112783791A (en) * 2021-02-08 2021-05-11 中国工商银行股份有限公司 Interface test case generation method and device
WO2023123943A1 (en) * 2021-12-27 2023-07-06 深圳前海微众银行股份有限公司 Interface automation testing method and apparatus, and medium, device and program

Similar Documents

Publication Publication Date Title
CN109683953B (en) Method and device for processing configuration file based on visual interface
CN111382074A (en) Interface test method and device and electronic equipment
CN107193681B (en) Data verification method and device
US9104796B2 (en) Correlation of source code with system dump information
US10331947B2 (en) Automatic detection on string and column delimiters in tabular data files
CN110489087B (en) Method, device, medium and electronic equipment for generating fractal structure
US10216617B2 (en) Automatically complete a specific software task using hidden tags
US10650272B2 (en) On demand testing as a service for base text direction verification testing
EP3570170A1 (en) Error detection method and apparatus for transaction system, storage medium and computer device
CN113014445B (en) Operation and maintenance method, device and platform for server and electronic equipment
CN111190791A (en) Application exception reporting method and device and electronic equipment
US20190236269A1 (en) Detecting third party software elements
CN110580156A (en) Page processing method and device and electronic equipment
CN113705827B (en) Model evaluation method and device and electronic equipment
CN112069071B (en) Method and device for determining program suitability
CN112395194B (en) Method and device for accessing test platform
CN111125015B (en) Method, apparatus, terminal and medium for dump file classification
US10231095B2 (en) Mobile community driven help for software applications
CN103326892A (en) Web interface operation method and device
CN113342553A (en) Data acquisition method and device, electronic equipment and storage medium
US9473440B1 (en) Hyperlink validation
CN113296878A (en) Container processing method and device, electronic equipment and system
CN113010365A (en) System running state monitoring method, system running state detection device, electronic equipment and storage medium
CN111162960A (en) Method and server for starting debugging panel
CN111914148A (en) Switching method and device of search engine and electronic equipment

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
WW01 Invention patent application withdrawn after publication

Application publication date: 20200707

WW01 Invention patent application withdrawn after publication