CN113791984B - Automatic interface testing method and device - Google Patents

Automatic interface testing method and device Download PDF

Info

Publication number
CN113791984B
CN113791984B CN202111266757.1A CN202111266757A CN113791984B CN 113791984 B CN113791984 B CN 113791984B CN 202111266757 A CN202111266757 A CN 202111266757A CN 113791984 B CN113791984 B CN 113791984B
Authority
CN
China
Prior art keywords
interface
target
test
field
initial
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
CN202111266757.1A
Other languages
Chinese (zh)
Other versions
CN113791984A (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.)
CCB Finetech Co Ltd
Original Assignee
CCB Finetech 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 CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202111266757.1A priority Critical patent/CN113791984B/en
Publication of CN113791984A publication Critical patent/CN113791984A/en
Application granted granted Critical
Publication of CN113791984B publication Critical patent/CN113791984B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • 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 embodiment of the application provides an interface automatic test method and device, wherein the method comprises the following steps: determining an initial interface which is currently used for carrying out automatic test by adopting a target test case as a target interface, judging whether non-empty flag bits exist in the flag bits corresponding to each field of the current target interface, if so, marking a preposed interface recorded in the non-empty flag bits, updating the current target interface as the preposed interface, and then judging again until the flag bits corresponding to each field of the target interface are empty flag bits; and automatically testing the initial interface and the marked front-end interface based on the target test case. The method and the device can effectively improve the automation degree and the intelligent degree of the interface searching, reduce the data quantity and the data redundancy of the associated interface searching, prevent omission or wrong selection of the associated interface, further effectively improve the efficiency, the automation degree and the reliability of the interface automatic testing process, and effectively save human resources and time cost.

Description

Automatic interface testing method and device
Technical Field
The application relates to the technical field of data processing, in particular to an interface automatic testing method and device.
Background
The general flow of the automatic test of the interface, offer interface and test case first, then run in the appointed environment, finally return the test result. When multiple interface services are involved, and in particular, when there is an association relationship between these interfaces, all interfaces need to be selected and executed according to a certain rule.
However, in the existing automatic interface testing method, manual operation is required or other interfaces related to the initial interface are required to be selected according to test cases and the like, the data volume required to be searched in the method is large and long in time consumption, the selection action consumes more manpower resources and time cost, and the test result is easily influenced due to omission or wrong selection.
Disclosure of Invention
Aiming at the problems in the prior art, the application provides the automatic testing method and the automatic testing device for the interfaces, which can effectively improve the automation degree and the intelligent degree of the interface searching, reduce the data quantity and the data redundancy of the associated interface searching, prevent the omission or the wrong selection of the associated interface, further effectively improve the efficiency, the automation degree and the reliability of the automatic testing process of the interfaces, and effectively save the manpower resources and the time cost.
In order to solve the technical problems, the application provides the following technical scheme:
In a first aspect, the present application provides an automated interface testing method, including:
determining an initial interface currently used for carrying out automatic test by adopting a target test case as a target interface, and executing a front-end interface searching step aiming at the target interface;
the front interface searching step comprises the following steps: judging whether non-empty flag bits exist in the flag bits corresponding to each field of the current target interface, if yes, marking a preposed interface recorded in the non-empty flag bits, updating the current target interface into the preposed interface, and then judging whether the non-empty flag bits exist in the flag bits corresponding to each field of the current target interface again until the flag bits corresponding to each field of the target interface are all empty flag bits;
and if the marked front-end interface exists, automatically testing the initial interface and the marked front-end interface based on the target test case in a preset target test environment.
Further, before the initial interface currently used for performing the automated test using the target test case is determined as the target interface, the method further comprises:
respectively setting a flag bit for each field corresponding to each interface corresponding to a service system, wherein the flag bit comprises a null flag bit and a non-null flag bit; the non-empty flag bit is used for storing the corresponding relation between the front interface and the field.
Further, the determining the initial interface currently used for performing the automated test by using the target test case as the target interface, and executing the pre-interface searching step for the target interface includes:
receiving an interface test request aiming at a service system, wherein the interface test request comprises a unique identifier of an interface to be tested, a unique identifier of a target test case and a unique identifier of a target test environment;
selecting the target test case from a preset test case library according to the unique identifier of the target test case, and searching the target test environment from the preset test environment library according to the unique identifier of the target test environment;
and carrying out network connectivity verification on the target test environment, if the network connectivity verification is passed, determining an initial interface to be tested currently based on the unique identifier of the interface to be tested, determining the initial interface as a target interface, and executing a pre-interface searching step aiming at the target interface.
Further, before the receiving the interface test request for the service system, the method further includes:
storing each test case corresponding to the service system and the unique identifier of each test case to a test case library for online editing, and storing each test environment corresponding to the service system and the unique identifier of each test environment to a test environment library for online editing, wherein the test environments comprise corresponding network address information.
Further, the method further comprises the following steps:
and adding test cases into the test case library in a mode of importing or adding pages, wherein the values of all fields in the test cases can be null or non-null.
Further, the method further comprises the following steps:
and directly adding the test environment which is not subjected to network connectivity verification into the test environment library in a leading-in or page newly-added mode.
Further, before the step of performing the pre-interface lookup for the target interface, the method further includes:
coding the initial interface based on a preset coding rule;
correspondingly, the marking the front interface recorded in the non-empty flag bit comprises the following steps:
based on the coding rule, coding a front interface recorded in the non-empty flag bit, so that the coding value of the front interface is larger than that of the initial interface; and if other interfaces exist between the front interface and the initial interface, the coding value of the front interface is larger than that of the other interfaces.
Further, before the automatic testing of the initial interface and the marked front interface based on the target test case in the preset target test environment if the marked front interface exists, the method further includes:
And based on a preset coding rule, coding the initial interface and each pre-interface which are sequentially associated with the initial interface from small to large in value, so that the initial interface and each pre-interface which are sequentially associated with the initial interface correspond to unique coding values respectively.
Further, if the marked front-end interface exists, in a preset target test environment, automatically testing the initial interface and the marked front-end interface based on the target test case, including:
if the marked front-end interface exists, writing the data of the initial interface and the marked front-end interface into the target test case;
searching a flag bit of a field of an interface corresponding to the case field aiming at the case field with the value being empty in the target test case, and if the flag bit is a non-empty flag bit, determining a field value corresponding to a preposed field stored in the flag bit as a target value of the current case field; if the flag bit is a null flag bit, setting the target value of the use case field to be null;
aiming at the use case field with the non-empty value in the target test case, determining the value as a target value of the use case field;
And in a preset target test environment, according to the coding values of the initial interface and the marked front interfaces, executing the automatic test tasks corresponding to the target test cases in the marked front interfaces and the initial interface in sequence from big to small.
In a second aspect, the present application provides an automated interface testing apparatus comprising:
the front-end searching module is used for determining an initial interface which is currently used for carrying out automatic test by adopting a target test case as a target interface, and executing a front-end interface searching step aiming at the target interface;
the front interface searching step comprises the following steps: judging whether non-empty flag bits exist in the flag bits corresponding to each field of the current target interface, if yes, marking a preposed interface recorded in the non-empty flag bits, updating the current target interface into the preposed interface, and then judging whether the non-empty flag bits exist in the flag bits corresponding to each field of the current target interface again until the flag bits corresponding to each field of the target interface are all empty flag bits;
and the interface test module is used for automatically testing the initial interface and the marked front interface based on the target test case in a preset target test environment if the marked front interface exists.
Further, the method further comprises the following steps:
the system comprises a flag bit setting module, a flag bit setting module and a control module, wherein the flag bit setting module is used for respectively setting flag bits for each field corresponding to each interface corresponding to a service system before the initial interface for performing automatic test by adopting a target test case is determined as a target interface, and the flag bits comprise empty flag bits and non-empty flag bits; the non-empty flag bit is used for storing the corresponding relation between the front interface and the field.
Further, the pre-search module is further configured to encode the initial interface based on a preset encoding rule before the pre-interface search step is performed for the target interface;
correspondingly, the prepositive searching module comprises a coding unit;
the coding unit is used for coding the front interface recorded in the non-empty marker bit based on the coding rule, so that the coding value of the front interface is larger than that of the initial interface; and if other interfaces exist between the front interface and the initial interface, the coding value of the front interface is larger than that of the other interfaces.
Further, the method further comprises the following steps:
and the coding module is used for coding the initial interface and each front interface which are sequentially associated with the initial interface from small to large according to a preset coding rule before the initial interface and the marked front interfaces are automatically tested based on the target test case in a preset target test environment, so that the initial interface and each front interface which are sequentially associated with the initial interface correspond to unique coding values.
Further, the interface test module is configured to execute the following contents:
if the marked front-end interface exists, writing the data of the initial interface and the marked front-end interface into the target test case;
searching a flag bit of a field of an interface corresponding to the case field aiming at the case field with the value being empty in the target test case, and if the flag bit is a non-empty flag bit, determining a field value corresponding to a preposed field stored in the flag bit as a target value of the current case field; if the flag bit is a null flag bit, setting the target value of the use case field to be null;
aiming at the use case field with the non-empty value in the target test case, determining the value as a target value of the use case field;
and in a preset target test environment, according to the coding values of the initial interface and the marked front interfaces, executing the automatic test tasks corresponding to the target test cases in the marked front interfaces and the initial interface in sequence from big to small.
In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the interface automation test method when executing the program.
In a fourth aspect, the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the interface automation test method.
According to the technical scheme, the interface automatic testing method and device provided by the application comprise the following steps: determining an initial interface currently used for carrying out automatic test by adopting a target test case as a target interface, and executing a front-end interface searching step aiming at the target interface; the front interface searching step comprises the following steps: judging whether non-empty flag bits exist in the flag bits corresponding to each field of the current target interface, if yes, marking a preposed interface recorded in the non-empty flag bits, updating the current target interface into the preposed interface, and then judging whether the non-empty flag bits exist in the flag bits corresponding to each field of the current target interface again until the flag bits corresponding to each field of the target interface are all empty flag bits; if the marked front-end interface exists, in a preset target test environment, automatically testing the initial interface and the marked front-end interface based on the target test case, judging whether the non-empty flag bit exists in the flag bit corresponding to each field of the current target interface, if so, marking the front-end interface recorded in the non-empty flag bit, updating the current target interface into the front-end interface, and then judging whether the non-empty flag bit exists in the flag bit corresponding to each field of the current target interface again until all the flag bits corresponding to each field of the target interface are empty, so that the automation degree and the intelligent degree of searching for the associated interface can be effectively improved from the aspect of the interface, the data quantity and the data redundancy of searching for the associated interface can be effectively reduced by constructing the flag bit, the omission or the wrong selection of the associated interface can be prevented, the efficiency and the automation test process of the interface can be effectively improved, the labor resource and the time cost can be effectively saved, the reliability of the automation test of the interface can be effectively improved, and the user experience can be effectively improved.
Drawings
In order to more clearly illustrate the embodiments of the present 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, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of a relationship between an interface automation test device and a client device in an embodiment of the present application.
Fig. 2 is a schematic flow chart of a first method for automated testing of interfaces in an embodiment of the present application.
Fig. 3 is a second flowchart of an interface automation test method in an embodiment of the present application.
Fig. 4 is a flowchart illustrating step 100 in the method for automated testing of interfaces in an embodiment of the present application.
Fig. 5 is a third flow chart of an interface automation test method in an embodiment of the present application.
Fig. 6 is a fourth flowchart of an interface automation test method in an embodiment of the present application.
Fig. 7 is a fifth flowchart of an interface automation test method in an embodiment of the present application.
Fig. 8 is a flowchart illustrating step 200 in the method for automated testing of interfaces in an embodiment of the present application.
Fig. 9 is a schematic diagram of a first configuration of an interface automation test device in an embodiment of the present application.
Fig. 10 is a schematic diagram of a second configuration of an interface automation test device in an embodiment of the present application.
Fig. 11 is a schematic diagram of a third configuration of an interface automation test device in an embodiment of the present application.
Fig. 12 is a schematic structural diagram of a fourth interface automation test device in an embodiment of the present application.
Fig. 13 is a schematic flow chart of an automated testing method provided by an application example of the present application.
FIG. 14 is an exemplary schematic diagram of an execution test case provided by an application instance of the present application.
Fig. 15 is a schematic structural diagram of an automated testing apparatus provided by an application example of the present application.
Fig. 16 is a schematic structural diagram of an electronic device in an embodiment of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
Aiming at the problems that in the existing automatic interface test mode, manual operation is needed or other interfaces related to an initial interface are selected according to test cases and the like, the data size to be searched in the mode is large and the time consumption is long, more human resources and time cost are consumed in the selection action, and the test result is easily influenced due to omission or wrong selection.
Based on the foregoing, the present application further provides an interface automation testing device for implementing the interface automation testing method provided in one or more embodiments of the present application, where the interface automation testing device may be a server, see fig. 1, and the interface automation testing device may be connected to each client device by itself or through a third party server or the like in a sequential communication manner, and may receive an interface automation testing instruction sent by the client device, and determine, according to the interface automation testing instruction, an initial interface currently used for performing an automation test using a target test case as a target interface, and execute a pre-interface searching step with respect to the target interface; the front interface searching step comprises the following steps: judging whether non-empty flag bits exist in the flag bits corresponding to each field of the current target interface, if yes, marking a preposed interface recorded in the non-empty flag bits, updating the current target interface into the preposed interface, and then judging whether the non-empty flag bits exist in the flag bits corresponding to each field of the current target interface again until the flag bits corresponding to each field of the target interface are all empty flag bits; if the marked front-end interface exists, in a preset target test environment, automatically testing the initial interface and the marked front-end interface based on the target test case, and sending automatic test result data to client equipment of a user by the interface automatic test device.
In another practical application, the foregoing part of the interface automation testing device for performing the interface automation test may be executed in a server as described above, or all operations may be completed in the client device. The selection may be specifically performed according to the processing capability of the ue and the limitation of the usage scenario of the user. The present application is not limited in this regard. If all operations are completed in the ue, the ue may further include a processor for specific processing of the interface automation test.
It is understood that the mobile terminal may include any mobile device capable of loading applications, such as a smart phone, a tablet electronic device, a network set top box, a portable computer, a Personal Digital Assistant (PDA), a vehicle-mounted device, a smart wearable device, etc. Wherein, intelligent wearing equipment can include intelligent glasses, intelligent wrist-watch, intelligent bracelet etc..
The mobile terminal may have a communication module (i.e. a communication unit) and may be in communication connection with a remote server, so as to implement data transmission with the server. The server may include a server on the side of the task scheduling center, and in other implementations may include a server of an intermediate platform, such as a server of a third party server platform having a communication link with the task scheduling center server. The server may include a single computer device, a server cluster formed by a plurality of servers, or a server structure of a distributed device.
Any suitable network protocol may be used for communication between the server and the mobile terminal, including those not yet developed at the filing date of this application. The network protocols may include, for example, TCP/IP protocol, UDP/IP protocol, HTTP protocol, HTTPS protocol, etc. Of course, the network protocol may also include, for example, RPC protocol (Remote Procedure Call Protocol ), REST protocol (Representational State Transfer, representational state transfer protocol), etc. used above the above-described protocol.
In one or more embodiments of the present application, AICT is an abbreviation for AI Cloud Test, chinese name is Intelligent Cloud testing platform.
In one or more embodiments of the present application, a flag bit is a flag set for each field in the format A: B, where A represents the A interface and B represents the interface field. If the flag bit is null, the field value is independent of other interface fields.
The following embodiments and application examples are described in detail.
In order to solve the problems that in the existing automatic interface testing mode, manual operation is needed or other interfaces related to an initial interface are needed to be selected according to a test case and the like, the data size to be searched in the mode is large, the time consumption is long, more manpower resources and time cost are consumed in the selecting operation, the test result is easily influenced due to omission or wrong selection, and the like, the embodiment of the automatic interface testing method is provided, and referring to fig. 2, the automatic interface testing method based on the execution of the automatic interface testing device specifically comprises the following steps:
Step 100: determining an initial interface currently used for carrying out automatic test by adopting a target test case as a target interface, and executing a front-end interface searching step aiming at the target interface; the front interface searching step comprises the following steps: judging whether non-empty flag bits exist in the flag bits corresponding to the fields of the current target interface, if yes, marking a leading interface recorded in the non-empty flag bits, updating the current target interface into the leading interface, and then judging whether the non-empty flag bits exist in the flag bits corresponding to the fields of the current target interface again until the flag bits corresponding to the fields of the target interface are all empty flag bits.
It will be appreciated that the test interface may be added by way of import or page add-on. When the test interface is added, besides the existing information of the test interface, a flag bit is set for each field, and the flag bit is used for representing other interface fields on which the field value depends. The format is A-B, wherein A represents the dependent preamble A and B represents the fields of the preamble. If the flag bit is null, the field value is independent of other interface fields.
Step 200: and if the marked front-end interface exists, automatically testing the initial interface and the marked front-end interface based on the target test case in a preset target test environment.
It is understood that test cases may be added by way of import or page add-on. The values of the fields in the test case can be null or non-null when added. When the test case is executed, the transmitted request data is equal to the corresponding value in the test case for the non-empty field in the test case. For the field with the null field value in the test case, the field flag bit of the corresponding interface needs to be judged. If the interface field flag bit is null, the field value in the request sent when the test case is executed is also null. If the interface field flag bit is not null, the corresponding value in the test case of the interface represented by the field flag bit is taken. For example: assuming that the interface A has a field B, the value of B in the test case of the interface A is abc 001; the interface C has a field D, the field flag bit of the field D is A to B, and the value of the field D in the test case of the interface C is null. Then the value of field D is "abc001" when executing the test case of C. When the field value is empty, the field flag bit of the interface corresponding to the test case needs to be checked, and if the field flag bit is not empty, the field value is equal to the value of the field corresponding to the front interface represented by the flag bit. The field content, i.e. the value of the field, is the value set by the corresponding field in the test case or the value corresponding to the front test case on which the field depends.
As can be seen from the foregoing description, in the method for automatically testing an interface provided in the embodiment of the present application, by determining whether there is a non-empty flag bit in the flag bit corresponding to each field of the current target interface, if yes, marking the front interface recorded in the non-empty flag bit, updating the current target interface to the front interface, and then determining whether there is a non-empty flag bit in the flag bit corresponding to each field of the current target interface again, until the flag bit corresponding to each field of the target interface is empty, it is possible to effectively improve the automation degree and the intellectualization degree of searching for the associated interface from the aspect of the interface, and by constructing the flag bit, it is possible to effectively reduce the data amount and the data redundancy of searching for the associated interface, and prevent omission or misselection of the associated interface, so as to effectively improve the efficiency and the automation degree of the automated testing process of the interface, effectively save manpower resources and time cost, and effectively improve the reliability and the effectiveness of the automated testing of the interface, and improve the user experience of the tester.
In order to improve reliability and efficiency of the subsequent pre-interface searching step, in an embodiment of the interface automation test method provided in the present application, referring to fig. 3, before step 100 of the interface automation test method, the following is further specifically included:
Step 010: respectively setting a flag bit for each field corresponding to each interface corresponding to a service system, wherein the flag bit comprises a null flag bit and a non-null flag bit; the non-empty flag bit is used for storing the corresponding relation between the front interface and the field.
As can be seen from the above description, according to the method for automatically testing the interface provided by the embodiment of the application, by presetting the empty flag bit and the non-empty flag bit, the reliability and efficiency of the subsequent pre-interface searching step can be effectively improved, the efficiency and the automation degree of the automatic testing process of the interface can be further improved, the manpower resources and the time cost can be effectively saved, and the reliability and the effectiveness of the automatic testing of the interface can be effectively improved.
In order to directly select the required data according to the interface test request, in one embodiment of the interface automation test method provided in the present application, referring to fig. 4, step 100 of the interface automation test method specifically includes the following:
step 110: and receiving an interface test request aiming at the service system, wherein the interface test request comprises a unique identifier of an interface to be tested, a unique identifier of a target test case and a unique identifier of a target test environment.
Step 120: selecting the target test case from a preset test case library according to the unique identifier of the target test case, and searching the target test environment from the preset test environment library according to the unique identifier of the target test environment.
Step 130: and carrying out network connectivity verification on the target test environment, if the network connectivity verification is passed, determining an initial interface to be tested currently based on the unique identifier of the interface to be tested, determining the initial interface as a target interface, and executing a pre-interface searching step aiming at the target interface.
As can be seen from the above description, according to the method for automatically testing the interface provided by the embodiment of the application, by setting the test case library, the test environment library and the like, the user does not need to search and select the test case library by himself, and the required data can be directly selected according to the interface test request, so that the efficiency and the automation degree of the interface automatic test process can be further improved, the manpower resources and the time cost can be effectively saved, and the reliability and the effectiveness of the interface automatic test can be effectively improved.
In order to improve the convenience of modifying the test case and the test environment, in one embodiment of the interface automation test method provided in the present application, referring to fig. 5, the following are specifically included between step 100 or step 200 of the interface automation test method:
Step 020: storing each test case corresponding to the service system and the unique identifier of each test case to a test case library for online editing, and storing each test environment corresponding to the service system and the unique identifier of each test environment to a test environment library for online editing, wherein the test environments comprise corresponding network address information.
As can be seen from the above description, according to the automatic interface test method provided by the embodiment of the present application, by presetting the test case library and the test environment library, and both the test case library and the test environment library support online editing by a user, the subsequent selection of the target test case from the preset test case library according to the unique identifier of the target test case can be effectively improved, the efficiency and reliability of the target test environment can be searched from the preset test environment library according to the unique identifier of the target test environment, the convenience of modifying the test case and the test environment can be effectively improved, the efficiency and the automation degree of the automatic interface test process can be further improved, the manpower resources and the time cost can be effectively saved, the reliability and the effectiveness of the automatic interface test can be effectively improved, and the user experience of a tester can be further improved.
In order to improve the flexibility and the application universality of the setting of the test cases stored in the test case library, in one embodiment of the interface automation test method provided by the application, the interface automation test method further specifically comprises the following contents:
step 300: and adding test cases into the test case library in a mode of importing or adding pages, wherein the values of all fields in the test cases can be null or non-null.
As can be seen from the above description, according to the interface automation test method provided by the embodiment of the present application, by adding test cases in the test case library in a manner of importing or newly adding pages, the setting flexibility and the applicability of the test cases stored in the test case library can be effectively improved, so that the efficiency and the reliability of selecting the target test case from the preset test case library according to the unique identifier of the target test case can be effectively improved, the efficiency and the automation degree of the interface automation test process can be further improved, the manpower resources and the time cost can be effectively saved, and the reliability and the effectiveness of the interface automation test can be effectively improved.
In order to improve the setting flexibility and the application universality of the test environment stored in the test environment library, in one embodiment of the interface automation test method provided by the application, the interface automation test method further specifically comprises the following contents:
Step 400: and directly adding the test environment which is not subjected to network connectivity verification into the test environment library in a leading-in or page newly-added mode.
As can be seen from the foregoing description, according to the method for automatically testing an interface provided in the embodiments of the present application, by adding a test environment in the test environment library in a manner of importing or adding a page, the setting flexibility and the application universality of the test environment stored in the test environment library can be effectively improved, so that the efficiency and the reliability of selecting the target test environment from the preset test environment library according to the unique identifier of the target test environment can be effectively improved, the efficiency and the automation degree of an automatic interface testing process can be further improved, the manpower resources and the time cost can be effectively saved, and the reliability and the effectiveness of the automatic interface testing can be effectively improved. And network connectivity verification is not performed in the test environment importing stage, so that the efficiency of newly adding and storing the test environment can be further improved.
In order to improve the validity and reliability of automatic batch approval, in one embodiment of the method for automatically testing interfaces provided in the present application, before the step 100 of the method for automatically testing interfaces performs the step of searching for the front interface with respect to the target interface, the method further includes the following steps:
And encoding the initial interface based on a preset encoding rule.
Correspondingly, the preceding interface described in the marking the non-empty flag bit in the step 100 includes: based on the coding rule, coding a front interface recorded in the non-empty flag bit, so that the coding value of the front interface is larger than that of the initial interface; and if other interfaces exist between the front interface and the initial interface, the coding value of the front interface is larger than that of the other interfaces.
Based on this, referring to fig. 6, the step 100 may be replaced with a step 500: determining an initial interface for performing automatic test by using a target test case as a target interface, and encoding the initial interface based on a preset encoding rule; a front-end interface searching step is executed aiming at the target interface; the front interface searching step comprises the following steps: judging whether a non-empty flag bit exists in the flag bit corresponding to each field of the current target interface, if so, coding a front interface recorded in the non-empty flag bit based on the coding rule, so that the coding value of the front interface is larger than that of the initial interface; if other interfaces exist between the front interface and the initial interface, the encoding value of the front interface is larger than the encoding value of other interfaces, the current target interface is updated to the front interface, and then whether non-empty flag bits exist in the flag bits corresponding to the fields of the current target interface is judged again until the flag bits corresponding to the fields of the target interface are all empty flag bits.
As can be seen from the above description, in the method for automatically testing an interface provided in the embodiments of the present application, a pre-interface recorded in the non-empty flag bit is encoded, so that the encoding value of the pre-interface is greater than that of the initial interface; if other interfaces are arranged between the front interface and the initial interface, the coding value of the front interface is larger than that of the other interfaces, so that the coding operation of the front interfaces can be realized in the process of marking the front interfaces recorded in the non-empty mark bits, the coding reliability can be effectively improved, and omission is prevented; and the coding values of the front interfaces are sequentially increased, so that the comprehensiveness, convenience and reliability of the subsequently executed test cases can be effectively improved, and interface omission is effectively prevented.
In another embodiment, in order to improve the execution efficiency of the encoding step, in one embodiment of the interface automation test method provided in the present application, fig. 7 further specifically includes the following between step 100 and step 200 in the interface automation test method:
step 140: and based on a preset coding rule, coding the initial interface and each pre-interface which are sequentially associated with the initial interface from small to large in value, so that the initial interface and each pre-interface which are sequentially associated with the initial interface correspond to unique coding values respectively.
As can be seen from the above description, in the method for automatically testing interfaces provided in the embodiments of the present application, after the process of marking the front interfaces recorded in the non-empty flag bit, the initial interfaces and the front interfaces sequentially associated with the initial interfaces are sequentially encoded from small to large, so that the execution efficiency of the encoding step can be effectively improved, the encoding values of the associated interfaces are sequentially increased, the comprehensiveness, convenience and reliability of the subsequent execution test cases can be effectively improved, and interface omission is effectively prevented.
In order to write the data of the initial interface and the marked front interface into the target test case and enable the target test case to determine the execution sequence according to the serial numbers of the interfaces, in one embodiment of the interface automation test method provided in the application, fig. 8, step 200 in the interface automation test method specifically includes the following contents:
step 210: and if the marked front-end interface exists, writing the data of the initial interface and the marked front-end interface into the target test case.
Step 220: searching a flag bit of a field of an interface corresponding to the case field aiming at the case field with the value being empty in the target test case, and if the flag bit is a non-empty flag bit, determining a field value corresponding to a preposed field stored in the flag bit as a target value of the current case field; if the flag bit is a null flag bit, the target value of the use case field is set to be null.
Step 230: and aiming at the use case field with the non-empty value in the target test case, determining the value as the target value of the use case field.
Step 240: and in a preset target test environment, according to the coding values of the initial interface and the marked front interfaces, executing the automatic test tasks corresponding to the target test cases in the marked front interfaces and the initial interface in sequence from big to small.
As can be seen from the above description, in the method for automatically testing interfaces provided in the embodiments of the present application, after the process of marking the front interfaces recorded in the non-empty flag bit, the initial interfaces and the front interfaces sequentially associated with the initial interfaces are sequentially encoded from small to large, so that the execution efficiency of the encoding step can be effectively improved, the encoding values of the associated interfaces are sequentially increased, the comprehensiveness, convenience and reliability of the subsequent execution test cases can be effectively improved, and interface omission is effectively prevented.
In order to solve the problems that in the existing automatic interface testing method, manual operation is needed or other interfaces related to an initial interface are needed to be selected according to a test case and the like, the data volume needed to be searched in the method is large and time consuming, the selecting operation consumes more manpower resources and time cost, and the testing result is easily influenced by omission or wrong selection, and the like, the application provides an embodiment of an automatic interface testing device for executing all or part of the content in the automatic interface testing method, and referring to fig. 9, the automatic interface testing device specifically comprises the following contents:
The pre-search module 10 is configured to determine an initial interface currently used for performing an automated test using a target test case as a target interface, and execute a pre-interface search step for the target interface; the front interface searching step comprises the following steps: judging whether non-empty flag bits exist in the flag bits corresponding to each field of the current target interface, if yes, marking a preposed interface recorded in the non-empty flag bits, updating the current target interface into the preposed interface, and then judging whether the non-empty flag bits exist in the flag bits corresponding to each field of the current target interface again until the flag bits corresponding to each field of the target interface are all empty flag bits;
and the interface test module 20 is configured to automatically test the initial interface and the marked front interface based on the target test case in a preset target test environment if the marked front interface exists.
The embodiment of the interface automation testing device provided in the present application may be specifically used to execute the processing flow of the embodiment of the interface automation testing method in the above embodiment, and the functions thereof are not described herein again, and reference may be made to the detailed description of the above method embodiment.
As can be seen from the foregoing description, the interface automation test device provided in this embodiment of the present application determines whether there is a non-empty flag bit in the flag bit corresponding to each field of the current target interface, if yes, marks the front interface recorded in the non-empty flag bit, updates the current target interface to the front interface, and then determines whether there is a non-empty flag bit in the flag bit corresponding to each field of the current target interface again, until the flag bit corresponding to each field of the target interface is empty, so that from the aspect of the interface, the automation degree and the intelligentization degree of searching for the associated interface can be effectively improved, and by constructing the flag bit, the data amount and the data redundancy of searching for the associated interface can be effectively reduced, and omission or misselection of the associated interface can be prevented, so that the efficiency and the automation test process of the interface can be effectively improved, the manpower resource and the time cost can be effectively saved, and the reliability and the user experience of the interface automation test can be effectively improved.
In order to improve reliability and efficiency of the subsequent pre-interface searching step, in an embodiment of the interface automation testing device provided in the present application, referring to fig. 10, the interface automation testing device further specifically includes the following contents:
The flag bit setting module 01 is configured to set flag bits for respective fields corresponding to respective interfaces corresponding to the service system before the initial interface currently used for performing an automated test by using the target test case is determined as the target interface, where the flag bits include an empty flag bit and a non-empty flag bit; the non-empty flag bit is used for storing the corresponding relation between the front interface and the field.
From the above description, it can be seen that, by presetting the empty flag bit and the non-empty flag bit, the automatic interface testing device provided in the embodiment of the application can effectively improve the reliability and efficiency of the subsequent preceding interface searching step, further can further improve the efficiency and the automation degree of the automatic interface testing process, effectively saves human resources and time cost, and can effectively improve the reliability and the effectiveness of the automatic interface testing.
In order to improve the validity and reliability of automatic batch approval, in one embodiment of the interface automation test device provided in the present application, referring to fig. 11, the pre-search module 10 is further configured to encode the initial interface based on a preset encoding rule before the pre-interface search step is performed for the target interface;
Correspondingly, the pre-search module 10 comprises an encoding unit 11;
the encoding unit 11 is configured to encode, based on the encoding rule, a preamble interface recorded in the non-null flag bit, so that an encoding value of the preamble interface is greater than that of the initial interface; and if other interfaces exist between the front interface and the initial interface, the coding value of the front interface is larger than that of the other interfaces.
As can be seen from the above description, in the automatic interface testing device provided in the embodiment of the present application, the front interface recorded in the non-empty flag bit is encoded, so that the encoded value of the front interface is greater than that of the initial interface; if other interfaces are arranged between the front interface and the initial interface, the coding value of the front interface is larger than that of the other interfaces, so that the coding operation of the front interfaces can be realized in the process of marking the front interfaces recorded in the non-empty mark bits, the coding reliability can be effectively improved, and omission is prevented; and the coding values of the front interfaces are sequentially increased, so that the comprehensiveness, convenience and reliability of the subsequently executed test cases can be effectively improved, and interface omission is effectively prevented.
In another embodiment, in order to improve the execution efficiency of the encoding step, in one embodiment of the interface automation testing device provided in the present application, referring to fig. 12, further includes:
the encoding module 14 is configured to, before the automatic testing is performed on the initial interface and the marked pre-interfaces based on the target test case in the preset target test environment, sequentially encode the initial interface and each pre-interface sequentially associated with the initial interface from small to large based on a preset encoding rule, so that the initial interface and each pre-interface sequentially associated with the initial interface each correspond to a unique encoding value.
As can be seen from the above description, in the automatic interface testing device provided in the embodiment of the present application, after the process of marking the front interfaces recorded in the non-empty flag bit, for the initial interfaces and the front interfaces sequentially associated with the initial interfaces, the encoding is sequentially performed from small to large, so that the execution efficiency of the encoding step can be effectively improved, the encoding values of the associated interfaces are sequentially increased, and further, the comprehensiveness, convenience and reliability of the subsequent execution test cases can be effectively improved, and interface omission is effectively prevented.
In order to write the data of the initial interface and the marked front interface into the target test case and enable the target test case to determine the execution sequence according to the serial numbers of the respective interfaces, in one embodiment of the interface automation test device provided in the present application, the interface test module 20 in the interface automation test device is specifically configured to execute the following contents:
step 210: and if the marked front-end interface exists, writing the data of the initial interface and the marked front-end interface into the target test case.
Step 220: searching a flag bit of a field of an interface corresponding to the case field aiming at the case field with the value being empty in the target test case, and if the flag bit is a non-empty flag bit, determining a field value corresponding to a preposed field stored in the flag bit as a target value of the current case field; if the flag bit is a null flag bit, the target value of the use case field is set to be null.
Step 230: and aiming at the use case field with the non-empty value in the target test case, determining the value as the target value of the use case field.
Step 240: and in a preset target test environment, according to the coding values of the initial interface and the marked front interfaces, executing the automatic test tasks corresponding to the target test cases in the marked front interfaces and the initial interface in sequence from big to small.
As can be seen from the above description, in the automatic interface testing device provided in the embodiment of the present application, after the process of marking the front interfaces recorded in the non-empty flag bit, for the initial interfaces and the front interfaces sequentially associated with the initial interfaces, the encoding is sequentially performed from small to large, so that the execution efficiency of the encoding step can be effectively improved, the encoding values of the associated interfaces are sequentially increased, and further, the comprehensiveness, convenience and reliability of the subsequent execution test cases can be effectively improved, and interface omission is effectively prevented.
In order to further explain the scheme, the application example provides an interface automation test method, on an automation test platform, a flag bit is set for each interface field, the content of the flag bit can be empty or non-empty, and when the content of the flag bit is non-empty, the meaning points to the field value which is dependent or required by the flag bit; when the automated test platform executes the interface, the pre-interface on which the automated test platform needs to depend is executed first, and the interface is executed after the dependent field value is acquired. When the flag bits of all fields in one interface are empty, the direct execution can be performed. The application example can solve the problem of dependence when the interface is called, saves the time of writing the test case or selecting the front interface, and particularly relates to the technical field of computer automation test.
In order to reduce the above-mentioned cost problems due to manual operations. The application example provides an automatic test method and device, which can utilize the relation among interfaces to set the front interfaces on which the interfaces are automatically searched, and reduce part of work of manually designing the test case by multiplexing the associated field values. Meanwhile, a function of modifying the dependence among interfaces on line is provided, so that the dependence can be flexibly changed according to the requirements of a service system. In addition, when a test environment is selected, a network connectivity verification function is provided so as to discover test environment problems in advance.
Referring to fig. 13, as an embodiment of the application example of the present application, the automated test method includes the following steps:
step S101, selecting a test interface, wherein the test interface exists in a test interface library and supports online editing. Each test interface has information such as a request address path, a request field, a response field, a field type, a flag bit, and the like.
Step S102, selecting test cases, wherein the test cases exist in a test case library and support online editing. Each test case has a request field value therein.
Step S103, selecting a test environment, wherein the test environment exists in a test environment library and supports online editing. The test environment contains only network address information related to the interface.
Step S104, executing the test cases in the corresponding test interfaces, and acquiring and displaying test results. When executing, firstly testing each field flag bit of the interface, if the flag bit which is not empty exists, backtracking upwards until all the test interface flag bits are empty. Then the test case is executed downwards, and the test result is returned to the required field.
FIG. 14 is an example of executing a test case. And when the test interface is executed, tracing the dependent interfaces upwards according to the direction of the flag bit, and coding each interface until the field flag bit of the current interface is empty. The test interface is then executed from large to small according to the coding order.
Firstly, coding the test interface into 1, judging that 3 non-empty flag bits exist in the test interface, wherein two flag bits point to the same test interface, namely 2 front test interfaces of the test interface 1 at the moment; then coding the two front interfaces into 21 and 22 respectively, checking the field flag bits, if the field flag bits are not empty, continuing to trace upwards and code until the field flag bits of the current test interface are all empty; and finally, executing according to the obtained coding list from large to small and recording a corresponding test result.
Referring to fig. 15, the automated test apparatus includes: an interface management module 151, a use case management module 152, an environment management module 153, and a test result management module 154; the functions of the above modules will be described in detail below.
(1) The interface management module 151 may add test interfaces by way of import or page add-on. When the test interface is added, besides the existing information of the test interface, a flag bit is set for each field, and the flag bit is used for representing other interface fields on which the field value depends. The format is A-B, wherein A represents the dependent front interface A and B represents the interface field. If the flag bit is null, the field value is independent of other interface fields.
(2) The case management module 152 may add test cases by way of import or page add-on. The values of the fields in the test case can be null or non-null when added. When the test case is executed, the transmitted request data is equal to the corresponding value in the test case for the non-empty field in the test case. For the field with the null field value in the test case, the field flag bit of the corresponding interface needs to be judged. If the interface field flag bit is null, the field value in the request sent when the test case is executed is also null. If the interface field flag bit is not null, the corresponding value in the test case of the interface represented by the field flag bit is taken. For example: assuming that the interface A has a field B, the value of B in the test case of the interface A is abc 001; the interface C has a field D, the field flag bit of the field D is A to B, and the value of the field D in the test case of the interface C is null. Then the value of field D is "abc001" when executing the test case of C. When the field value is empty, the field flag bit of the interface corresponding to the test case needs to be checked, and if the field flag bit is not empty, the field value is equal to the value of the field corresponding to the front interface represented by the flag bit. The field content, i.e. the value of the field, is the value set by the corresponding field in the test case or the value corresponding to the front test case on which the field depends.
(3) The environment management module 153 may add the test environment by way of import or page addition. AICT when added does not verify network connectivity with the test environment. Only when the automatic test is carried out by selecting the test environment from the environment management library, the AICT can verify the network connectivity between the AICT and the test environment, and a corresponding prompt is given according to the verification result.
(4) The test result management module 154 is responsible for acquiring the response results of the test interface and displaying the response results in the form of test results.
Based on the above, the method for implementing the application example comprises the following steps:
the method comprises the steps of obtaining interfaces of a tested system and corresponding test case information, selecting available test environments, analyzing interface fields and the test case information, sending information contained in the test cases to the corresponding interfaces, obtaining response results of the interfaces and displaying the response results in the form of test results.
The interface information exists in the interface library, and the interface can be newly added to the interface library by means of import or manual input. Each newly added interface field contains a flag bit for indicating that the value of the field depends on the value of the interface field indicated by the flag bit.
The test cases exist in the test case library, and the test cases can be newly added to the test case library by means of importing or manually inputting. The contents of each field in the test case can be null or non-null. When the field content is empty and the corresponding interface field flag bit is empty, the field value is equal to the value of the corresponding field of the front interface represented by the flag bit. When the field content is not empty, the value is equal to the value defined in the test case.
The test environment exists in the test environment library, and the test environment can be newly added into the test environment library by means of importing or manually inputting. When a test environment is selected, network connectivity between the environment and the AICT is first determined, and only the test environment where the network can communicate can be used.
When the automatic test of the interface is executed, firstly analyzing the front interface on which the selected interface depends through each field flag bit, and if the field flag bit of the front interface is not null, backtracking upwards until all the field flag bits of the current interface are null. And then sequentially executing the interfaces from the current interface until all the dependent data required by the selected interface are acquired and written into the test case. And finally, sending the data contained in the test case to the selected interface, acquiring a response result of the interface and displaying the response result in a test result form. The dependent data is the data of all other interfaces with association relation with the selected interface, and can contain the identifiers of the interfaces and the corresponding unique codes; since the initial interface that is executed last is unique. It requires only one test case. Some of the data in this test case is data that depends on other interfaces. When this initial interface is executed, the data that its test cases depend on is already collected intact.
Specifically, when an interface execution test case is selected, the interface execution test case is encoded into 1, and if one or more non-empty field flag bits exist in the interface, the interface pointed by the field flag bits needs to be searched one by one and the marks are encoded layer by layer. This process is looped until the field flag bit in the found interface is empty. Then, the test case is executed from the interface with the largest code until the interface with the code 1 is executed.
And starting from the currently selected interface, each interface needing to be traced back upwards is encoded, and the method is executed according to the order of the encoded numbers from large to small. Specifically, after the test cases are written in the dependent data of the selected interface, the current target test cases are formed, and at the moment, the target test cases have determined the execution sequence according to the serial numbers of the interfaces, so that in the process of tracing back the interfaces upwards, all the encoding work related to the interfaces is completed; and then the target test case is sent to the interface with the largest code, so that the sequential execution test task of each interface can be realized, and the test case is executed according to the number size of the code from large to small.
In order to solve the problems that in the existing automatic interface testing mode, manual operation is needed or other interfaces related to an initial interface are needed to be selected according to a test case and the like, the data size to be searched in the mode is large, the time consumption is long, more manpower resources and time cost are consumed in the selecting operation, the testing result is easily influenced due to omission or wrong selection, and the like, the embodiment of the electronic equipment for realizing all or part of the content in the automatic interface testing method is provided, and the electronic equipment specifically comprises the following contents:
Fig. 16 is a schematic block diagram of a system configuration of an electronic device 9600 of an embodiment of the present application. As shown in fig. 16, the electronic device 9600 may include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. Notably, this fig. 16 is exemplary; other types of structures may also be used in addition to or in place of the structures to implement telecommunications functions or other functions.
In one embodiment, the interface automation test function may be integrated into the central processor. Wherein the central processor may be configured to control:
step 100: determining an initial interface currently used for carrying out automatic test by adopting a target test case as a target interface, and executing a front-end interface searching step aiming at the target interface; the front interface searching step comprises the following steps: judging whether non-empty flag bits exist in the flag bits corresponding to the fields of the current target interface, if yes, marking a leading interface recorded in the non-empty flag bits, updating the current target interface into the leading interface, and then judging whether the non-empty flag bits exist in the flag bits corresponding to the fields of the current target interface again until the flag bits corresponding to the fields of the target interface are all empty flag bits.
Step 200: and if the marked front-end interface exists, automatically testing the initial interface and the marked front-end interface based on the target test case in a preset target test environment.
As can be seen from the foregoing description, in the electronic device provided in this embodiment of the present application, by determining whether there is a non-empty flag bit in the flag bit corresponding to each field of the current target interface, if yes, the pre-interface recorded in the non-empty flag bit is marked, and after updating the current target interface to the pre-interface, whether there is a non-empty flag bit in the flag bit corresponding to each field of the current target interface is determined again, until the flag bit corresponding to each field of the target interface is empty, the automation degree and the intelligence degree of searching for the associated interface can be effectively improved from the aspect of the interface, and by constructing the flag bit, the data volume and the data redundancy of searching for the associated interface can be effectively reduced, and omission or misselection of the associated interface can be prevented, so that the efficiency and the automation testing process of the interface can be effectively improved, the manpower resources and the time cost can be effectively saved, and the reliability and the effectiveness of the automated testing of the interface can be effectively improved, and the user experience of the tester can be improved.
In another embodiment, the interface automation test device may be configured separately from the central processor 9100, for example, the interface automation test device may be configured as a chip connected to the central processor 9100, and the interface automation test function is implemented by control of the central processor.
As shown in fig. 16, the electronic device 9600 may further include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is noted that the electronic device 9600 need not include all of the components shown in fig. 16; in addition, the electronic device 9600 may further include components not shown in fig. 16, and reference may be made to the related art.
As shown in fig. 16, the central processor 9100, sometimes also referred to as a controller or operational control, may include a microprocessor or other processor device and/or logic device, which central processor 9100 receives inputs and controls the operation of the various components of the electronic device 9600.
The memory 9140 may be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information about failure may be stored, and a program for executing the information may be stored. And the central processor 9100 can execute the program stored in the memory 9140 to realize information storage or processing, and the like.
The input unit 9120 provides input to the central processor 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to provide power to the electronic device 9600. The display 9160 is used for displaying display objects such as images and characters. The display may be, for example, but not limited to, an LCD display.
The memory 9140 may be a solid state memory such as Read Only Memory (ROM), random Access Memory (RAM), SIM card, etc. But also a memory which holds information even when powered down, can be selectively erased and provided with further data, an example of which is sometimes referred to as EPROM or the like. The memory 9140 may also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application/function storage portion 9142, the application/function storage portion 9142 storing application programs and function programs or a flow for executing operations of the electronic device 9600 by the central processor 9100.
The memory 9140 may also include a data store 9143, the data store 9143 for storing data, such as contacts, digital data, pictures, sounds, and/or any other data used by an electronic device. The driver storage portion 9144 of the memory 9140 may include various drivers of the electronic device for communication functions and/or for performing other functions of the electronic device (e.g., messaging applications, address book applications, etc.).
The communication module 9110 is a transmitter/receiver 9110 that transmits and receives signals via an antenna 9111. A communication module (transmitter/receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, as in the case of conventional mobile communication terminals.
Based on different communication technologies, a plurality of communication modules 9110, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, etc., may be provided in the same electronic device. The communication module (transmitter/receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide audio output via the speaker 9131 and to receive audio input from the microphone 9132 to implement usual telecommunications functions. The audio processor 9130 can include any suitable buffers, decoders, amplifiers and so forth. In addition, the audio processor 9130 is also coupled to the central processor 9100 so that sound can be recorded locally through the microphone 9132 and sound stored locally can be played through the speaker 9131.
The embodiments of the present application further provide a computer readable storage medium capable of implementing all the steps in the interface automation test method in the above embodiments, where the computer readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements all the steps in the interface automation test method in the above embodiments in which the execution subject is a server or a client, for example, the processor implements the following steps when executing the computer program:
Step 100: determining an initial interface currently used for carrying out automatic test by adopting a target test case as a target interface, and executing a front-end interface searching step aiming at the target interface; the front interface searching step comprises the following steps: judging whether non-empty flag bits exist in the flag bits corresponding to the fields of the current target interface, if yes, marking a leading interface recorded in the non-empty flag bits, updating the current target interface into the leading interface, and then judging whether the non-empty flag bits exist in the flag bits corresponding to the fields of the current target interface again until the flag bits corresponding to the fields of the target interface are all empty flag bits.
Step 200: and if the marked front-end interface exists, automatically testing the initial interface and the marked front-end interface based on the target test case in a preset target test environment.
As can be seen from the foregoing description, the computer readable storage medium provided in this embodiment of the present application determines whether there is a non-empty flag bit in the flag bit corresponding to each field of the current target interface, if yes, marks the front interface recorded in the non-empty flag bit, updates the current target interface to the front interface, and then determines whether there is a non-empty flag bit in the flag bit corresponding to each field of the current target interface again, until each flag bit corresponding to each field of the target interface is empty, so that from the aspect of the interface, the automation degree and the intelligentization degree of searching for the associated interface can be effectively improved, and by constructing the flag bit, the data amount and the data redundancy of searching for the associated interface can be effectively reduced, and omission or wrong selection of the associated interface can be prevented, so that the efficiency and the automation degree of the interface automation test process can be effectively improved, the manpower resources and the time cost can be effectively saved, the reliability and the effectiveness of the interface automation test can be effectively improved, and the user experience of the tester can be improved.
It will be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, 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 specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The principles and embodiments of the present invention have been described in detail with reference to specific examples, which are provided to facilitate understanding of the method and core ideas of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (12)

1. An automated interface testing method, comprising:
respectively setting a flag bit for each field corresponding to each interface corresponding to a service system, wherein the flag bit comprises a null flag bit and a non-null flag bit; the non-empty flag bit is used for storing the corresponding relation between the front interface and the field;
determining an initial interface currently used for carrying out automatic test by adopting a target test case as a target interface, and executing a front-end interface searching step aiming at the target interface;
the front interface searching step comprises the following steps: judging whether non-empty flag bits exist in the flag bits corresponding to each field of the current target interface, if yes, marking a preposed interface recorded in the non-empty flag bits, updating the current target interface into the preposed interface, and then judging whether the non-empty flag bits exist in the flag bits corresponding to each field of the current target interface again until the flag bits corresponding to each field of the target interface are all empty flag bits;
based on a preset coding rule, coding the initial interfaces and the pre-interfaces which are sequentially associated with the initial interfaces from small to large in value in sequence, so that the initial interfaces and the pre-interfaces which are sequentially associated with the initial interfaces correspond to unique coding values respectively;
And if the marked front-end interface exists, automatically testing the initial interface and the marked front-end interface based on the target test case in a preset target test environment.
2. The method according to claim 1, wherein determining an initial interface currently used for performing an automated test using a target test case as a target interface, performing a pre-interface search step for the target interface, comprises:
receiving an interface test request aiming at a service system, wherein the interface test request comprises a unique identifier of an interface to be tested, a unique identifier of a target test case and a unique identifier of a target test environment;
selecting the target test case from a preset test case library according to the unique identifier of the target test case, and searching the target test environment from the preset test environment library according to the unique identifier of the target test environment;
and carrying out network connectivity verification on the target test environment, if the network connectivity verification is passed, determining an initial interface to be tested currently based on the unique identifier of the interface to be tested, determining the initial interface as a target interface, and executing a pre-interface searching step aiming at the target interface.
3. The method of automated interface testing according to claim 2, further comprising, prior to said receiving an interface test request for a business system:
storing each test case corresponding to the service system and the unique identifier of each test case to a test case library for online editing, and storing each test environment corresponding to the service system and the unique identifier of each test environment to a test environment library for online editing, wherein the test environments comprise corresponding network address information.
4. The automated interface testing method of claim 3, further comprising:
and adding test cases into the test case library in a mode of importing or adding pages, wherein the values of all fields in the test cases can be null or non-null.
5. The automated interface testing method of claim 3, further comprising:
and directly adding the test environment which is not subjected to network connectivity verification into the test environment library in a leading-in or page newly-added mode.
6. The method of automated interface testing according to claim 1, further comprising, prior to said performing a pre-interface lookup step for said target interface:
Coding the initial interface based on a preset coding rule;
correspondingly, the marking the front interface recorded in the non-empty flag bit comprises the following steps:
based on the coding rule, coding a front interface recorded in the non-empty flag bit, so that the coding value of the front interface is larger than that of the initial interface; and if other interfaces exist between the front interface and the initial interface, the coding value of the front interface is larger than that of the other interfaces.
7. The method according to claim 6, wherein if the marked front interface exists, automatically testing the initial interface and the marked front interface based on the target test case in a preset target test environment, including:
if the marked front-end interface exists, writing the data of the initial interface and the marked front-end interface into the target test case;
searching a flag bit of a field of an interface corresponding to the case field aiming at the case field with the value being empty in the target test case, and if the flag bit is a non-empty flag bit, determining a field value corresponding to a preposed field stored in the flag bit as a target value of the current case field; if the flag bit is a null flag bit, setting the target value of the use case field to be null;
Aiming at the use case field with the non-empty value in the target test case, determining the value as a target value of the use case field;
and in a preset target test environment, according to the coding values of the initial interface and the marked front interfaces, executing the automatic test tasks corresponding to the target test cases in the marked front interfaces and the initial interface in sequence from big to small.
8. An automated interface testing apparatus, comprising:
the system comprises a flag bit setting module, a flag bit setting module and a flag bit setting module, wherein the flag bit setting module is used for setting flag bits for each field corresponding to each interface corresponding to a service system, and the flag bits comprise empty flag bits and non-empty flag bits; the non-empty flag bit is used for storing the corresponding relation between the front interface and the field;
the front-end searching module is used for determining an initial interface which is currently used for carrying out automatic test by adopting a target test case as a target interface, and executing a front-end interface searching step aiming at the target interface;
the front interface searching step comprises the following steps: judging whether non-empty flag bits exist in the flag bits corresponding to each field of the current target interface, if yes, marking a preposed interface recorded in the non-empty flag bits, updating the current target interface into the preposed interface, and then judging whether the non-empty flag bits exist in the flag bits corresponding to each field of the current target interface again until the flag bits corresponding to each field of the target interface are all empty flag bits;
The coding module is used for coding the initial interfaces and the pre-interfaces which are sequentially associated with the initial interfaces from small to large in sequence based on a preset coding rule so that the initial interfaces and the pre-interfaces which are sequentially associated with the initial interfaces correspond to unique coding values respectively;
and the interface test module is used for automatically testing the initial interface and the marked front interface based on the target test case in a preset target test environment if the marked front interface exists.
9. The automated interface test equipment of claim 8, wherein the pre-lookup module is further configured to encode the initial interface based on a preset encoding rule prior to the pre-interface lookup step performed for the target interface;
correspondingly, the prepositive searching module comprises a coding unit;
the coding unit is used for coding the front interface recorded in the non-empty marker bit based on the coding rule, so that the coding value of the front interface is larger than that of the initial interface; and if other interfaces exist between the front interface and the initial interface, the coding value of the front interface is larger than that of the other interfaces.
10. The automated interface testing apparatus of claim 9, wherein the interface testing module is configured to:
if the marked front-end interface exists, writing the data of the initial interface and the marked front-end interface into the target test case;
searching a flag bit of a field of an interface corresponding to the case field aiming at the case field with the value being empty in the target test case, and if the flag bit is a non-empty flag bit, determining a field value corresponding to a preposed field stored in the flag bit as a target value of the current case field; if the flag bit is a null flag bit, setting the target value of the use case field to be null;
aiming at the use case field with the non-empty value in the target test case, determining the value as a target value of the use case field;
and in a preset target test environment, according to the coding values of the initial interface and the marked front interfaces, executing the automatic test tasks corresponding to the target test cases in the marked front interfaces and the initial interface in sequence from big to small.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the interface automation test method of any of claims 1 to 7 when the computer program is executed by the processor.
12. A computer readable storage medium having stored thereon a computer program, characterized in that the computer program, when executed by a processor, implements the interface automation test method of any of claims 1 to 7.
CN202111266757.1A 2021-10-28 2021-10-28 Automatic interface testing method and device Active CN113791984B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111266757.1A CN113791984B (en) 2021-10-28 2021-10-28 Automatic interface testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111266757.1A CN113791984B (en) 2021-10-28 2021-10-28 Automatic interface testing method and device

Publications (2)

Publication Number Publication Date
CN113791984A CN113791984A (en) 2021-12-14
CN113791984B true CN113791984B (en) 2023-06-09

Family

ID=78878318

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111266757.1A Active CN113791984B (en) 2021-10-28 2021-10-28 Automatic interface testing method and device

Country Status (1)

Country Link
CN (1) CN113791984B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115292205B (en) * 2022-10-08 2022-12-09 四川无限智达科技有限公司 Method and device for generating relational topological graph of interface, electronic equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857667A (en) * 2019-02-03 2019-06-07 苏州市龙测智能科技有限公司 Automatic interface testing method, test device, test equipment and storage medium
CN112162924A (en) * 2020-09-27 2021-01-01 平安信托有限责任公司 Interface automation test method and device, computer equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857667A (en) * 2019-02-03 2019-06-07 苏州市龙测智能科技有限公司 Automatic interface testing method, test device, test equipment and storage medium
CN112162924A (en) * 2020-09-27 2021-01-01 平安信托有限责任公司 Interface automation test method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN113791984A (en) 2021-12-14

Similar Documents

Publication Publication Date Title
CN110413528B (en) Intelligent configuration method and system for test environment
CN110990228A (en) Data interface monitoring method and device
CN112615753B (en) Link abnormity tracking method, first node, second node and link
CN112463634A (en) Software testing method and device under micro-service architecture
CN112394932A (en) Automatic browser webpage skin changing method and device
CN111679811B (en) Web service construction method and device
CN114785685A (en) Software differential upgrading method and device, electronic equipment and readable storage medium
US20170132001A1 (en) Code based configuration of mobile devices
CN112784112A (en) Message checking method and device
CN111679790A (en) Remote software development storage space distribution method and device
CN113791984B (en) Automatic interface testing method and device
CN114153856A (en) Host data double-writing method and device
CN113342330A (en) Front-end engineering generation method and device
CN115495519A (en) Report data processing method and device
CN113050985B (en) Front-end engineering dependency automatic registration method and device
CN114637531A (en) Method and device for dynamically generating application program interface
CN113076262B (en) Webpage automatic testing method and device
CN112766827A (en) Automatic processing method and device for asset inventory data
CN112102058A (en) Management system parameter configuration method and device
CN113515447B (en) Automatic testing method and device for system
CN111695936B (en) Information binding method, device and equipment
CN113050936B (en) Front-end data processing method and device based on integrated development environment
CN111158744B (en) Cross-platform heterogeneous data integration method and device
CN113050937A (en) Front-end data processing method and device based on command line
CN113419953A (en) Test data processing method, device and system

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