CN113791984A - Automatic interface testing method and device - Google Patents

Automatic interface testing method and device Download PDF

Info

Publication number
CN113791984A
CN113791984A CN202111266757.1A CN202111266757A CN113791984A CN 113791984 A CN113791984 A CN 113791984A CN 202111266757 A CN202111266757 A CN 202111266757A CN 113791984 A CN113791984 A CN 113791984A
Authority
CN
China
Prior art keywords
interface
target
test
field
zone bit
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.)
Granted
Application number
CN202111266757.1A
Other languages
Chinese (zh)
Other versions
CN113791984B (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 automatic interface testing method and device, and 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 a non-empty zone bit exists in a zone bit corresponding to each field of the current target interface, if so, marking a front interface recorded in the non-empty zone bit, updating the current target interface into the front interface, and judging again until the zone bit corresponding to each field of the target interface is an empty zone bit; and automatically testing the initial interface and the marked preposed 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 volume and the data redundancy of the related interface searching, prevent omission or wrong selection of the related interface, further effectively improve the efficiency, the automation degree and the reliability of the automatic interface testing process, and effectively save manpower 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 automatic interface testing method and device.
Background
The general flow of the interface automation test is that an interface and a test case are provided firstly, then the interface and the test case run in a specified environment, and finally a test result is returned. When a plurality of interface services are involved, especially when there is an association relationship between these interfaces, all the interfaces need to be selected and executed according to a certain rule.
However, in the existing interface automated testing method, manual operation or selection of other interfaces associated with the initial interface according to test cases and the like is required, the method needs to search large amount of data and takes long time, the selection action consumes much human resources and time cost, and the test result is easily influenced by omission or wrong selection.
Disclosure of Invention
Aiming at the problems in the prior art, the application provides an automatic interface testing method and device, which can effectively improve the automation degree and the intelligent degree of interface searching, reduce the data volume and the data redundancy of the related interface searching, prevent the omission or wrong selection of the related interface, further effectively improve the efficiency, the automation degree and the reliability of the automatic interface testing process, and effectively save human resources and time cost.
In order to solve the technical problem, the application provides the following technical scheme:
in a first aspect, the present application provides an interface automation test method, including:
determining an initial interface which is currently used for carrying out automatic testing by adopting a target test case as a target interface, and executing a preposed interface searching step aiming at the target interface;
wherein the front interface searching step comprises: judging whether a non-empty zone bit exists in the zone bit corresponding to each field of the current target interface, if so, marking the pre-interface recorded in the non-empty zone bit, updating the current target interface to the pre-interface, and then judging whether the non-empty zone bit exists in the zone bit corresponding to each field of the current target interface again until the zone bit corresponding to each field of the target interface is an empty zone bit;
and 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.
Further, before determining the initial interface currently used for the automated test using the target test case as the target interface, the method further includes:
setting a zone bit for each field corresponding to each interface corresponding to a service system respectively, wherein the zone bit comprises an empty zone bit and a non-empty zone bit; and the non-empty zone bit is used for storing the corresponding relation between the preposed interface and the field.
Further, the step of determining the current initial interface for performing the automated test by using the target test case as the target interface, and performing a pre-interface search for the target interface includes:
receiving an interface test request aiming at a business 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 of the current test based on the unique identifier of the interface to be tested, determining the initial interface as a target interface, and executing a preposed interface searching step aiming at the target interface.
Further, before the receiving an interface test request for a service system, the method further includes:
and 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 environment comprises corresponding network address information.
Further, still include:
and adding test cases in the test case library in a mode of importing or adding pages, wherein the value of each field in the test cases can be null or non-null.
Further, still include:
and directly adding a test environment without network connectivity verification in the test environment library in an importing or page adding mode.
Further, before the step of performing a pre-interface lookup on the target interface, the method further includes:
coding the initial interface based on a preset coding rule;
correspondingly, the marking of the pre-interface recorded in the non-empty flag bit includes:
based on the coding rule, coding a front interface recorded in the non-empty zone bit to enable the coding value of the front interface to be larger than that of the initial interface; if other interfaces exist between the preposed interface and the initial interface, the code value of the preposed interface is larger than that of the other interfaces.
Further, before the automatically testing the initial interface and the marked pre-interface based on the target test case in a preset target test environment if the marked pre-interface exists, the method further includes:
and based on a preset coding rule, sequentially coding the initial interface and each preposed interface sequentially associated with the initial interface from small to large so that the initial interface and each preposed interface sequentially associated with the initial interface respectively correspond to a unique coding value.
Further, if there is a marked front end interface, in a preset target test environment, performing an automated test on the initial interface and the marked front end interface based on the target test case, including:
if the marked preposed interface exists, writing the data of the initial interface and the marked preposed interface into the target test case;
aiming at the case field with the null value in the target test case, searching the zone bit of the field of the interface corresponding to the case field, and if the zone bit is a non-null zone bit, determining the field value corresponding to the front field stored in the zone bit as the target value of the current case field; if the flag bit is a null flag bit, setting the target value of the case field to null;
determining a value of the target test case as a target value of a case field aiming at the case field with the non-empty value in the target test case;
and in a preset target test environment, according to the code numerical values of the initial interface and the marked preposed interfaces, sequentially executing the automatic test tasks corresponding to the target test cases in the marked preposed interfaces and the initial interfaces in the order of the code numerical values from large to small.
In a second aspect, the present application provides an interface automation test apparatus, including:
the system comprises a preposed searching module, a target interface searching module and a control module, wherein the preposed searching module is used for determining an initial interface which is currently used for carrying out automatic testing by adopting a target test case as the target interface and executing a preposed interface searching step aiming at the target interface;
wherein the front interface searching step comprises: judging whether a non-empty zone bit exists in the zone bit corresponding to each field of the current target interface, if so, marking the pre-interface recorded in the non-empty zone bit, updating the current target interface to the pre-interface, and then judging whether the non-empty zone bit exists in the zone bit corresponding to each field of the current target interface again until the zone bit corresponding to each field of the target interface is an empty zone bit;
and the interface testing module is used for automatically testing the initial interface and the marked preposed interface based on the target test case in a preset target testing environment if the marked preposed interface exists.
Further, still include:
a flag bit setting module, configured to set flag bits for respective fields corresponding to respective interfaces corresponding to a service system before the initial interface currently used for performing an automated test using a target test case is determined to be a target interface, where the flag bits include an empty flag bit and a non-empty flag bit; and the non-empty zone bit is used for storing the corresponding relation between the preposed interface and the field.
Further, the pre-lookup module is further configured to encode the initial interface based on a preset encoding rule before the pre-interface lookup step is performed on the target interface;
correspondingly, the preposed searching module comprises a coding unit;
the coding unit is used for coding a front interface recorded in the non-empty zone bit based on the coding rule, so that the coding numerical value of the front interface is larger than that of the initial interface; if other interfaces exist between the preposed interface and the initial interface, the code value of the preposed interface is larger than that of the other interfaces.
Further, still include:
and the coding module is used for sequentially coding the initial interface and each pre-interface sequentially associated with the initial interface according to a preset coding rule before automatically testing the initial interface and the marked pre-interfaces based on the target test case in a preset target test environment, so that the initial interface and each pre-interface sequentially associated with the initial interface respectively correspond to a unique coding value.
Further, the interface testing module is configured to execute the following:
if the marked preposed interface exists, writing the data of the initial interface and the marked preposed interface into the target test case;
aiming at the case field with the null value in the target test case, searching the zone bit of the field of the interface corresponding to the case field, and if the zone bit is a non-null zone bit, determining the field value corresponding to the front field stored in the zone bit as the target value of the current case field; if the flag bit is a null flag bit, setting the target value of the case field to null;
determining a value of the target test case as a target value of a case field aiming at the case field with the non-empty value in the target test case;
and in a preset target test environment, according to the code numerical values of the initial interface and the marked preposed interfaces, sequentially executing the automatic test tasks corresponding to the target test cases in the marked preposed interfaces and the initial interfaces in the order of the code numerical values from large to small.
In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements 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 method for automated testing of an interface.
According to the technical scheme, the interface automatic testing method and device provided by the application comprise the following steps: determining an initial interface which is currently used for carrying out automatic testing by adopting a target test case as a target interface, and executing a preposed interface searching step aiming at the target interface; wherein the front interface searching step comprises: judging whether a non-empty zone bit exists in the zone bit corresponding to each field of the current target interface, if so, marking the pre-interface recorded in the non-empty zone bit, updating the current target interface to the pre-interface, and then judging whether the non-empty zone bit exists in the zone bit corresponding to each field of the current target interface again until the zone bit corresponding to each field of the target interface is an empty zone bit; if the marked preposed interface exists, automatically testing the initial interface and the marked preposed interface based on the target test case in a preset target test environment, judging whether a non-empty zone bit exists in the zone bit corresponding to each field of the current target interface, if so, marking the preposed interface recorded in the non-empty zone bit, updating the current target interface to the preposed interface, judging whether the non-empty zone bit exists in the zone bit corresponding to each field of the current target interface again until the zone bit corresponding to each field of the target interface is empty, starting from the angle of the interface, effectively improving the automation degree and the intellectualization degree of searching of the associated interface, and effectively reducing the data volume and the data redundancy of the associated interface by constructing the zone bit, the omission or wrong selection of the associated interface can be prevented, the efficiency and the automation degree of the interface automatic test process can be effectively improved, the human resources and the time cost can be effectively saved, the reliability and the effectiveness of the interface automatic test can be effectively improved, and the user experience of testers can be improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram of a relationship between an interface automation test apparatus and a client device in an embodiment of the present application.
Fig. 2 is a first flowchart of an interface automated testing method in an embodiment of the present application.
Fig. 3 is a second flowchart of an interface automated testing method in the embodiment of the present application.
Fig. 4 is a flowchart illustrating step 100 of the interface automated testing method in the embodiment of the present application.
Fig. 5 is a third flowchart of an interface automated testing method in the embodiment of the present application.
Fig. 6 is a fourth flowchart illustrating an interface automated testing method according to an embodiment of the present application.
Fig. 7 is a fifth flowchart illustrating an interface automated testing method according to an embodiment of the present application.
Fig. 8 is a flowchart illustrating step 200 of the interface automated testing method in the embodiment of the present application.
Fig. 9 is a schematic structural diagram of a first configuration of an interface automation test device in an embodiment of the present application.
Fig. 10 is a schematic structural diagram of a second configuration of an interface automation test device in an embodiment of the present application.
Fig. 11 is a third structural schematic diagram of an interface automation test device in the embodiment of the present application.
Fig. 12 is a schematic structural diagram of a fourth interface automation test apparatus in the embodiment of the present application.
Fig. 13 is a schematic flowchart of an automated testing method provided in an application example of the present application.
FIG. 14 is a schematic diagram of an example of executing a test case provided by an application example of the present application.
Fig. 15 is a schematic structural diagram of an automated testing apparatus provided in an application example of the present application.
Fig. 16 is a schematic structural diagram of an electronic device in the embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, 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 obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Aiming at the problems that in the existing interface automatic test mode, manual operation is needed or other interfaces associated with an initial interface need to be selected according to test cases and the like, the mode needs large data volume and long time consumption, the selection action consumes more human resources and time cost, and the test result is easily influenced by omission or wrong selection, the embodiment of the application provides an interface automatic test mode, by judging whether non-empty flag bits exist in flag bits corresponding to all fields of the current target interface, if so, marking a preposed interface recorded in the non-empty flag bits, updating the current target interface to the preposed interface, then judging whether non-empty flag bits exist in the flag bits corresponding to all the fields of the current target interface again until all the flag bits corresponding to all the fields of the target interface are empty, the interface can be followed, the degree of automation and the intelligent degree that the correlation interface looked for are effectively improved, and through constructing the zone bit, the data volume and the data redundancy that the correlation interface looked for can effectively be reduced, and can prevent omission or the wrong selection of correlation interface, and then can effectively improve the efficiency and the degree of automation of the automatic test procedure of interface, effectively use manpower sparingly resource and time cost, and can effectively improve the reliability and the validity of the automatic test of interface, improve testers' user experience.
Based on the above, the present application further provides an interface automation test apparatus for implementing the interface automation test method provided in one or more embodiments of the present application, where the interface automation test apparatus may be a server, see fig. 1, the interface automation test apparatus may be in communication connection with each client device by itself or through a third-party server, and the interface automation test apparatus may receive an interface automation test instruction sent by the client device, determine an initial interface currently used for an automation test using a target test case as a target interface according to the interface automation test instruction, and perform a pre-interface search step for the target interface; wherein the front interface searching step comprises: judging whether a non-empty zone bit exists in the zone bit corresponding to each field of the current target interface, if so, marking the pre-interface recorded in the non-empty zone bit, updating the current target interface to the pre-interface, and then judging whether the non-empty zone bit exists in the zone bit corresponding to each field of the current target interface again until the zone bit corresponding to each field of the target interface is an empty zone bit; if the marked preposed interface exists, the initial interface and the marked preposed interface are automatically tested based on the target test case in a preset target test environment, and the interface automatic testing device can also send automatic testing result data to client equipment of a user and the like.
In another practical application scenario, the interface automation test device may perform part of the interface automation test in the server as described above, or all operations may be performed in the user end device. Specifically, the selection may be performed according to the processing capability of the user end device, the limitation of the user usage scenario, and the like. This is not a limitation of the present application. If all the operations are completed in the customer premise equipment, the customer premise equipment may further include a processor for performing specific processing of the interface automation test.
It is understood that the mobile terminal may include any mobile device capable of loading an application, 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, and the like. Wherein, intelligence 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 communicatively connected to a remote server to implement data transmission with the server. The server may include a server on the task scheduling center side, and in other implementation scenarios, the server may also include a server on an intermediate platform, for example, a server on a third-party server platform that is communicatively linked to the task scheduling center server. The server may include a single computer device, or may include a server cluster formed by a plurality of servers, or a server structure of a distributed apparatus.
The server and the mobile terminal may communicate using any suitable network protocol, including network protocols not yet developed at the filing date of this application. The network protocol may include, for example, a TCP/IP protocol, a UDP/IP protocol, an HTTP protocol, an HTTPS protocol, or the like. Of course, the network Protocol may also include, for example, an RPC Protocol (Remote Procedure Call Protocol), a REST Protocol (Representational State Transfer Protocol), and the like used above the above Protocol.
In one or more embodiments of the present application, AICT is an abbreviation of AI Cloud Test, herein named intelligent Cloud Test platform.
In one or more embodiments of the present application, the flag bit is a flag set for each field, and is in the format of a: B, where a represents an a interface and B represents an interface field. If the flag bit is empty, it indicates that the value of the field is not dependent on other interface fields.
The following embodiments and application examples are specifically and individually described in detail.
In order to solve the problems that in the existing interface automatic testing method, manual operation is required or other interfaces associated with an initial interface need to be selected according to test cases and the like, the method needs to search large data volume and consumes long time, the selection action consumes more human resources and time cost, and the test result is easily affected by omission or wrong selection, and the like, the application provides an embodiment of the interface automatic testing method, which is shown in fig. 2, and the interface automatic testing method executed based on the interface automatic testing device specifically comprises the following contents:
step 100: determining an initial interface which is currently used for carrying out automatic testing by adopting a target test case as a target interface, and executing a preposed interface searching step aiming at the target interface; wherein the front interface searching step comprises: judging whether a non-empty zone bit exists in the zone bit corresponding to each field of the current target interface, if so, marking the pre-interface recorded in the non-empty zone bit, updating the current target interface to the pre-interface, and then judging whether the non-empty zone bit exists in the zone bit corresponding to each field of the current target interface again until the zone bit corresponding to each field of the target interface is an empty zone bit.
It is understood that the test interface may be added by way of import or page addition. When adding, besides the information already existing in the test interface itself, it also needs to set a flag bit for each field, and the flag bit is used to indicate 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 field of the front interface. If the flag bit is empty, it indicates that the value of the field is not dependent on other interface fields.
Step 200: and 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.
It can be understood that the test cases can be added by importing or adding pages. When adding, each field value in the test case can be null or non-null. When the test case is executed, the sent request data is equal to the corresponding value in the test case for the non-empty field in the test case. For a field with an empty field value in the test case, the field flag bit of the corresponding interface needs to be determined. If the interface field flag bit is null, the field value in the request sent when the test case is executed is also null. And if the interface field zone bit is not null, taking the corresponding value in the test case of the interface represented by the field zone bit. 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 D is A: B, and the value of the D in the test case of the interface C is null. Then the value of field D is "abc 001" when executing the test case of C. When the field value is null, the field flag bit of the interface corresponding to the test case needs to be checked, and if the field flag bit is not null, the field value is equal to the value of the field corresponding to the pre-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 preceding test case on which the field depends.
As can be seen from the above description, the interface automation test method provided in the embodiment of the present application determines whether a non-empty flag bit exists in the flag bit corresponding to each field of the current target interface, if yes, marks the pre-interface recorded in the non-empty flag bit, and determines whether a non-empty flag bit exists in the flag bit corresponding to each field of the current target interface again after the current target interface is updated to the pre-interface until each field of the target interface is empty, so as to effectively improve the automation degree and the intelligence degree of the correlation interface search from the perspective of the interface, and by constructing the flag bit, the data amount and the data redundancy of the correlation interface search can be effectively reduced, and the omission or wrong selection of the correlation interface can be prevented, so as to effectively improve the efficiency and the automation degree of the interface automation test process, manpower resources and time cost are effectively saved, reliability and effectiveness of automatic interface testing can be effectively improved, and user experience of testers is improved.
In order to improve the reliability and efficiency of the subsequent pre-interface searching step, in an embodiment of the interface automated testing method provided by the present application, referring to fig. 3, before step 100 of the interface automated testing method, the following steps are further included:
step 010: setting a zone bit for each field corresponding to each interface corresponding to a service system respectively, wherein the zone bit comprises an empty zone bit and a non-empty zone bit; and the non-empty zone bit is used for storing the corresponding relation between the preposed interface and the field.
As can be seen from the above description, the interface automation test method provided in the embodiment of the present application can effectively improve the reliability and efficiency of the subsequent pre-interface search step by presetting the empty flag bit and the non-empty flag bit, so as to further improve the efficiency and automation degree of the interface automation test process, effectively save human resources and time cost, and effectively improve the reliability and effectiveness of the interface automation test.
In order to directly select the required data according to the interface test request, referring to fig. 4, in an embodiment of the interface automated test method provided in the present application, step 100 of the interface automated test method specifically includes the following steps:
step 110: receiving an interface test request aiming at a business 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: and 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 of the current test based on the unique identifier of the interface to be tested, determining the initial interface as a target interface, and executing a preposed interface searching step aiming at the target interface.
As can be seen from the above description, the interface automation test method provided in the embodiment of the present application can directly select the required data according to the interface test request without self-search and selection by setting the test case library, the test environment library, and the like, so as to further improve the efficiency and the automation degree of the interface automation test process, effectively save human resources and time cost, and effectively improve the reliability and the effectiveness of the interface automation test.
In order to improve convenience of modifying test cases and test environments, referring to fig. 5, in an embodiment of the interface automated test method provided in the present application, the following is further specifically included between step 100 and step 200 of the interface automated test method:
step 020: and 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 environment comprises corresponding network address information.
As can be seen from the above description, the interface automation test method provided in the embodiments of the present application, by presetting the test case library and the test environment library, and the test case library and the test environment library both support the on-line editing of the user, so that the 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 searching 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 convenience of modifying the test case and the test environment can be effectively improved, further improving the efficiency and automation degree of the automatic interface test process, effectively saving human resources and time cost, and the reliability and the effectiveness of the automatic interface test can be effectively improved, and the user experience of testers is further improved.
In order to improve the flexibility of setting and the applicability of the test cases stored in the test case library, in an embodiment of the interface automated testing method provided by the present application, the interface automated testing method further includes the following steps:
step 300: and adding test cases in the test case library in a mode of importing or adding pages, wherein the value of each field 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 in the embodiment of the present application, the test cases are added to the test case library in a manner of importing or adding a new page, so that the flexibility of setting and the applicability of the test cases stored in the test case library can be effectively improved, 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 human 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 flexibility of setting and the applicability of the test environment stored in the test environment library, in an embodiment of the interface automated test method provided by the present application, the interface automated test method further includes the following steps:
step 400: and directly adding a test environment without network connectivity verification in the test environment library in an importing or page adding mode.
As can be seen from the above description, the interface automation test method provided in the embodiment of the present application can effectively improve the flexibility of setting and the applicability of the test environment stored in the test environment library by adding the test environment to the test environment library in a manner of importing or adding a new page, and further can effectively improve the efficiency and reliability of subsequently selecting the target test environment from the preset test environment library according to the unique identifier of the target test environment, and further can further improve the efficiency and automation degree of the interface automation test process, effectively save human resources and time cost, and can effectively improve the reliability and effectiveness of the interface automation test. 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 effectiveness and reliability of the automatic batch approval, in an embodiment of the interface automation test method provided by the present application, before the step 100 of executing the pre-interface search step for the target interface, the method further includes the following steps:
and coding the initial interface based on a preset coding rule.
Correspondingly, the marking of the pre-interface recorded in the non-empty flag bit in step 100 includes: based on the coding rule, coding a front interface recorded in the non-empty zone bit to enable the coding value of the front interface to be larger than that of the initial interface; if other interfaces exist between the preposed interface and the initial interface, the code value of the preposed interface is larger than that of the other interfaces.
Based on this, referring to fig. 6, the step 100 can be replaced by the step 500: determining an initial interface which is currently used for carrying out automatic test by adopting a target test case as a target interface, and coding the initial interface based on a preset coding rule; executing a pre-interface searching step aiming at the target interface; wherein the front interface searching step comprises: judging whether a non-empty zone bit exists in zone bits corresponding to each field of the current target interface, if so, coding a front interface recorded in the non-empty zone bit based on the coding rule, and enabling the coding value of the front interface to be larger than that of the initial interface; if other interfaces exist between the front interface and the initial interface, the coding numerical value of the front interface is larger than that of the other interfaces, and after the current target interface is updated to the front interface, whether non-empty zone bits exist in zone bits corresponding to each field of the current target interface is judged again until the zone bits corresponding to each field of the target interface are empty zone bits.
As can be seen from the above description, in the interface automation test method provided in the embodiment of the present application, the coding value of the pre-interface is greater than that of the initial interface by coding the pre-interface recorded in the non-empty flag bit; if other interfaces exist between the preposed interface and the initial interface, the coding numerical value of the preposed interface is larger than that of the other interfaces, so that the coding operation of the preposed interfaces can be realized in the process of marking the preposed interfaces recorded in the non-empty zone bits, the coding reliability can be effectively improved, and omission is prevented; and the coding values of the preposed interfaces are sequentially increased, so that the comprehensiveness, convenience and reliability of the subsequent execution test cases can be effectively improved, and the omission of the interfaces can be effectively prevented.
In another embodiment, in order to improve the execution efficiency of the encoding step, in an embodiment of the interface automation test method provided in the present application, fig. 7, the following contents are further specifically included between step 100 and step 200 in the interface automation test method:
step 140: and based on a preset coding rule, sequentially coding the initial interface and each preposed interface sequentially associated with the initial interface from small to large so that the initial interface and each preposed interface sequentially associated with the initial interface respectively correspond to a unique coding value.
As can be seen from the above description, according to the interface automation test method provided in the embodiment of the present application, after the process of marking the pre-interfaces recorded in the non-empty flag bit, the initial interface and each of the pre-interfaces sequentially associated therewith are sequentially encoded, so that the execution efficiency of the encoding step can be effectively improved, the encoded values of the associated interfaces are sequentially increased, the comprehensiveness, convenience, and reliability of the subsequently executed test cases can be effectively improved, and interface omission can be effectively prevented.
In order to write the data of the initial interface and the marked pre-interface into the target test case and enable the target test case to determine an execution sequence according to the serial numbers of the interfaces, in an embodiment of the interface automated testing method provided by the present application, fig. 8, a step 200 in the interface automated testing method specifically includes the following contents:
step 210: and if the marked front interface exists, writing the data of the initial interface and the marked front interface into the target test case.
Step 220: aiming at the case field with the null value in the target test case, searching the zone bit of the field of the interface corresponding to the case field, and if the zone bit is a non-null zone bit, determining the field value corresponding to the front field stored in the zone bit as the 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 null.
Step 230: and determining the value as the target value of the case field aiming at the case field with the value of the target test case being non-null.
Step 240: and in a preset target test environment, according to the code numerical values of the initial interface and the marked preposed interfaces, sequentially executing the automatic test tasks corresponding to the target test cases in the marked preposed interfaces and the initial interfaces in the order of the code numerical values from large to small.
As can be seen from the above description, according to the interface automation test method provided in the embodiment of the present application, after the process of marking the pre-interfaces recorded in the non-empty flag bit, the initial interface and each of the pre-interfaces sequentially associated therewith are sequentially encoded, so that the execution efficiency of the encoding step can be effectively improved, the encoded values of the associated interfaces are sequentially increased, the comprehensiveness, convenience, and reliability of the subsequently executed test cases can be effectively improved, and interface omission can be effectively prevented.
In terms of software, in order to solve the problems that in the existing interface automated testing method, manual operation is required or other interfaces associated with an initial interface need to be selected according to test cases, and the method needs to search a large amount of data and consumes a long time, the selection action consumes a lot of human resources and time cost, and the test result is easily affected by omission or wrong selection, the application provides an embodiment of an interface automated testing apparatus for executing all or part of the contents in the interface automated testing method, which is shown in fig. 9 and specifically includes 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; wherein the front interface searching step comprises: judging whether a non-empty zone bit exists in the zone bit corresponding to each field of the current target interface, if so, marking the pre-interface recorded in the non-empty zone bit, updating the current target interface to the pre-interface, and then judging whether the non-empty zone bit exists in the zone bit corresponding to each field of the current target interface again until the zone bit corresponding to each field of the target interface is an empty zone bit;
and the interface testing module 20 is configured to, if the marked pre-interface exists, perform an automated test on the initial interface and the marked pre-interface based on the target test case in a preset target testing environment.
The embodiment of the interface automated testing apparatus provided in the present application may be specifically configured to execute the processing flow of the embodiment of the interface automated testing method in the foregoing embodiment, and the functions of the embodiment are not described herein again, and refer to the detailed description of the embodiment of the method.
As can be seen from the above description, the interface automation test apparatus provided in the embodiment of the present application, by determining whether a non-empty flag bit exists in the flag bit corresponding to each field of the current target interface, if yes, marking the pre-interface recorded in the non-empty flag bit, and after updating the current target interface to the pre-interface, determining whether a non-empty flag bit exists in the flag bit corresponding to each field of the current target interface again, until each field of the target interface is empty, can effectively improve the automation degree and the intelligence degree of the correlation interface search from the perspective of the interface, and can effectively reduce the data amount and the data redundancy of the correlation interface search and prevent omission or wrong selection of the correlation interface by constructing the flag bit, thereby effectively improving the efficiency and the automation degree of the interface automation test process, manpower resources and time cost are effectively saved, reliability and effectiveness of automatic interface testing can be effectively improved, and user experience of testers is improved.
In order to improve the reliability and efficiency of the subsequent pre-interface searching step, referring to fig. 10, an embodiment of the interface automatic testing apparatus provided in the present application further includes the following contents:
a flag bit setting module 01, configured to set flag bits for respective fields corresponding to respective interfaces corresponding to a service system before determining, as a target interface, an initial interface currently used for performing an automated test using a target test case, where the flag bits include an empty flag bit and a non-empty flag bit; and the non-empty zone bit is used for storing the corresponding relation between the preposed interface and the field.
As can be seen from the above description, the interface automation test device provided in the embodiment of the present application can effectively improve the reliability and efficiency of the subsequent pre-interface search step by presetting the empty flag bit and the non-empty flag bit, so as to further improve the efficiency and automation degree of the interface automation test process, effectively save human resources and time cost, and effectively improve the reliability and effectiveness of the interface automation test.
In order to improve the effectiveness and reliability of the automatic batch approval, in an embodiment of the interface automation testing apparatus provided in the present application, referring to fig. 11, the pre-lookup module 10 is further configured to encode the initial interface based on a preset encoding rule before the pre-interface lookup step is performed on the target interface;
correspondingly, the pre-lookup module 10 includes an encoding unit 11;
the encoding unit 11 is configured to encode a pre-interface recorded in the non-empty flag based on the encoding rule, so that an encoded numerical value of the pre-interface is greater than that of the initial interface; if other interfaces exist between the preposed interface and the initial interface, the code value of the preposed interface is larger than that of the other interfaces.
As can be seen from the above description, the interface automation test apparatus provided in the embodiment of the present application encodes the pre-interface recorded in the non-empty flag bit, so that the encoded value of the pre-interface is greater than that of the initial interface; if other interfaces exist between the preposed interface and the initial interface, the coding numerical value of the preposed interface is larger than that of the other interfaces, so that the coding operation of the preposed interfaces can be realized in the process of marking the preposed interfaces recorded in the non-empty zone bits, the coding reliability can be effectively improved, and omission is prevented; and the coding values of the preposed interfaces are sequentially increased, so that the comprehensiveness, convenience and reliability of the subsequent execution test cases can be effectively improved, and the omission of the interfaces can be effectively prevented.
In another embodiment, in order to improve the execution efficiency of the encoding step, an embodiment of the interface automation test apparatus provided in the present application, referring to fig. 12, further includes:
and the coding module 14 is configured to, before the automatic testing of the initial interface and the marked pre-interfaces is performed based on the target test case in the preset target test environment, sequentially perform coding with values from small to large for the initial interface and each pre-interface sequentially associated therewith based on a preset coding rule, so that the initial interface and each pre-interface sequentially associated therewith each correspond to a unique coding value.
As can be seen from the above description, the interface automation test device provided in the embodiment of the present application sequentially performs coding with a gradually increasing numerical value for each initial interface and its sequentially associated pre-interfaces after the process of marking the pre-interfaces recorded in the non-empty flag bit, so as to effectively improve the execution efficiency of the coding step, and sequentially increase the coding numerical values of the associated interfaces, thereby effectively improving the comprehensiveness, convenience, and reliability of the subsequently executed test cases, and effectively preventing interface omission.
In order to write the data of the initial interface and the marked pre-interface into the target test case and enable the target test case to determine an execution sequence according to the serial numbers of the respective interfaces, in an embodiment of the interface automation test apparatus provided in the present application, an interface test module 20 in the interface automation test apparatus is specifically configured to execute the following:
step 210: and if the marked front interface exists, writing the data of the initial interface and the marked front interface into the target test case.
Step 220: aiming at the case field with the null value in the target test case, searching the zone bit of the field of the interface corresponding to the case field, and if the zone bit is a non-null zone bit, determining the field value corresponding to the front field stored in the zone bit as the 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 null.
Step 230: and determining the value as the target value of the case field aiming at the case field with the value of the target test case being non-null.
Step 240: and in a preset target test environment, according to the code numerical values of the initial interface and the marked preposed interfaces, sequentially executing the automatic test tasks corresponding to the target test cases in the marked preposed interfaces and the initial interfaces in the order of the code numerical values from large to small.
As can be seen from the above description, the interface automation test device provided in the embodiment of the present application sequentially performs coding with a gradually increasing numerical value for each initial interface and its sequentially associated pre-interfaces after the process of marking the pre-interfaces recorded in the non-empty flag bit, so as to effectively improve the execution efficiency of the coding step, and sequentially increase the coding numerical values of the associated interfaces, thereby effectively improving the comprehensiveness, convenience, and reliability of the subsequently executed test cases, and effectively preventing interface omission.
In order to further explain the scheme, the application example of the application provides an interface automatic testing method, on an automatic testing platform, a flag bit is set for each interface field, the content of the flag bit can be null or non-null, and when the content of the flag bit is non-null, the meaning of the flag bit points to the field value depending on or required by the flag bit; when the automated test platform executes the interface, the required pre-interface must be executed first, and the interface is executed after the dependent field value is acquired. When the flag bits of all fields in an interface are empty, the execution can be directly performed. The application example can solve the problem of dependence when the interface is called, saves the time for compiling a test case or selecting a front interface, and particularly relates to the technical field of computer automation test.
In order to reduce the cost problem caused by manual operation. The application example of the application provides an automatic testing method and device, the front-end interface which is depended by the automatic searching can be set by using the relation between the interfaces, and partial work of manually designing a test case is reduced by multiplexing related field values. Meanwhile, the function of modifying the dependence between the interfaces on line is provided, so that the change can be flexibly carried out according to the requirements of a service system. In addition, when the test environment is selected, a network connectivity verification function is provided so as to discover the test environment problem in advance.
Referring to fig. 13, as an embodiment of an application example of the present application, the automated testing method includes the following steps:
and 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 request address path, request field, response field, field type, flag bit, etc.
And S102, selecting a test case, wherein the test case exists in a test case library and supports online editing. Each test case has a request field value.
And S103, selecting a test environment, wherein the test environment exists in a test environment library and supports online editing. Only the network address information associated with the interface is included in the test environment.
And step S104, executing the test case in the corresponding test interface, and acquiring and displaying the test result. During execution, each field zone bit of the interface is firstly tested, if the zone bit which is not empty exists, the tracing is carried out upwards until all the zone bits of the test interface are empty. The test case is then executed downward and the test results are returned to the required fields.
FIG. 14 is an example of executing a test case. When the test interface is executed, the dependent interface is traced upwards and each interface is coded according to the guidance of the zone bit until the field zone bit of the current interface is empty. And then executing the test interface from big to small according to the coding sequence.
Firstly, coding the test interface to be 1, judging that 3 non-empty zone bits exist in the test interface, wherein two zone bits point to the same test interface, namely 2 prepositive test interfaces of the test interface 1 at the moment; then coding the two preposed interfaces into 21 and 22 respectively, checking field flag bits of the two preposed interfaces, if the field flag bits are not empty, continuously backtracking upwards and coding until the field flag bits of the current test interface are all empty; and finally, executing according to the obtained coding list and the coding sequence from big to small, and recording the corresponding test result.
Referring to fig. 15, the automated testing 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-described modules will be described in detail below.
(1) The interface management module 151 may add a test interface by importing or adding a new page. When adding, besides the information already existing in the test interface itself, it also needs to set a flag bit for each field, and the flag bit is used to indicate 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 empty, it indicates that the value of the field is not dependent on other interface fields.
(2) The use case management module 152 may add the test use case by importing or adding a new page. When adding, each field value in the test case can be null or non-null. When the test case is executed, the sent request data is equal to the corresponding value in the test case for the non-empty field in the test case. For a field with an empty field value in the test case, the field flag bit of the corresponding interface needs to be determined. If the interface field flag bit is null, the field value in the request sent when the test case is executed is also null. And if the interface field zone bit is not null, taking the corresponding value in the test case of the interface represented by the field zone bit. 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 D is A: B, and the value of the D in the test case of the interface C is null. Then the value of field D is "abc 001" when executing the test case of C. When the field value is null, the field flag bit of the interface corresponding to the test case needs to be checked, and if the field flag bit is not null, the field value is equal to the value of the field corresponding to the pre-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 preceding test case on which the field depends.
(3) The environment management module 153 may add the test environment by importing or adding a new page. Upon addition, AICT does not verify network connectivity with the test environment. Only when the test environment is selected from the environment management library for automatic test, the AICT verifies the network connectivity with the test environment and gives a corresponding prompt according to the verification result.
(4) The test result management module 154 is responsible for obtaining the response result of the test interface and displaying the response result in the form of the test result.
Based on this, the method that this application example realized includes:
the method comprises the steps of obtaining an interface of a tested system and corresponding test case information, selecting an available test environment, analyzing an interface field and the test case information, sending information contained in the test case to the corresponding interface, obtaining a response result of the interface and displaying the response result in a test result mode.
The interface information is stored in the interface library, and an interface can be newly added to the interface library in an importing or manual input mode. Each additional interface field includes a flag bit 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 through an importing or manual inputting mode. 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 pre-interface represented by the flag bit. When the field content is non-empty, its value equals the value defined in the test case.
The test environment exists in the test environment library, and the test environment can be newly added to the test environment library through an importing mode or a manual input mode. When the test environment is selected, the network connectivity between the environment and the AICT is firstly judged, and only the test environment in which the network can be connected can be used.
When the automatic test of the interface is executed, for the selected interface, the front interface which the selected interface depends on is firstly analyzed through each field zone bit, if the field zone bit of the front interface is not null, the back tracing is carried out upwards until all the field zone bits of the current interface are null. And then sequentially executing from the current interface until all the dependent data required by the selected interface is acquired and written into the test case. And finally, sending the data contained in the test case to the selected interface, acquiring the response result of the interface and displaying the response result in the form of the test result. The dependency data refers to data of all other interfaces having an association relation with the selected interface, and may include an identifier of the interfaces and a corresponding unique code; since the last executed initial interface is unique. It only requires 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 on which its test cases depend is already collected.
Specifically, when an interface is selected to execute a test case, the test case is encoded to 1, and if one or more non-empty field flag bits exist in the interface, the interfaces pointed by the field flag bits need to be searched one by one and the marks need to be encoded layer by layer. This process is looped until the field flags in the found interface are all empty. And then executing the test case from the interface with the largest code until the interface with the code of 1 is executed.
And (4) coding each interface needing to backtrack upwards from the currently selected interface, and executing according to the coding number in the descending order during execution. Specifically, after the test case writes the dependent data of the selected interface, a current target test case is formed, and at this time, the target test case determines the execution sequence according to the serial numbers of the interfaces, so that all coding work related to the interfaces is completed in the process of tracing back the interfaces upwards; and then the target test case is sent to the interface with the largest code, so that the sequential execution of the test tasks of all the interfaces can be realized, and the test case is executed according to the number of the code from large to small when executed.
In terms of hardware, in order to solve the problems that in an existing interface automated testing method, manual operation is required or other interfaces associated with an initial interface need to be selected according to test cases, and the method needs to search for a large amount of data and consumes a long time, a selection action consumes a lot of human resources and time cost, and test results are easily affected by omission or wrong selection, the application provides an embodiment of an electronic device for implementing all or part of contents in the interface automated testing method, and the electronic device specifically includes the following contents:
fig. 16 is a schematic block diagram of a system configuration of an electronic device 9600 according to an embodiment of the present application. As shown in fig. 16, the electronic device 9600 can 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 structure to implement telecommunications 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 which is currently used for carrying out automatic testing by adopting a target test case as a target interface, and executing a preposed interface searching step aiming at the target interface; wherein the front interface searching step comprises: judging whether a non-empty zone bit exists in the zone bit corresponding to each field of the current target interface, if so, marking the pre-interface recorded in the non-empty zone bit, updating the current target interface to the pre-interface, and then judging whether the non-empty zone bit exists in the zone bit corresponding to each field of the current target interface again until the zone bit corresponding to each field of the target interface is an empty zone bit.
Step 200: and 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.
As can be seen from the above description, in the electronic device provided in the embodiment of the present application, by determining whether a non-empty flag bit exists in flag bits corresponding to each field of a current target interface, if yes, marking a pre-interface recorded in the non-empty flag bit, and after updating the current target interface to the pre-interface, determining whether a non-empty flag bit exists in 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 empty, from the perspective of the interface, an automation degree and an intelligence degree of a correlation interface search can be effectively improved, and by constructing the flag bits, a data amount and data redundancy of the correlation interface search can be effectively reduced, omission or wrong selection of the correlation interface can be prevented, and thus efficiency and an automation degree of an interface automation test process can be effectively improved, manpower resources and time cost are effectively saved, reliability and effectiveness of automatic interface testing can be effectively improved, and user experience of testers is improved.
In another embodiment, the interface automatic testing apparatus may be configured separately from the central processing unit 9100, for example, the interface automatic testing apparatus may be configured as a chip connected to the central processing unit 9100, and the interface automatic testing function is realized by the control of the central processing unit.
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 also does not necessarily include all of the components shown in fig. 16; further, the electronic device 9600 may further include components not shown in fig. 16, which can be referred to in the related art.
As shown in fig. 16, a central processor 9100, sometimes referred to as a controller or operational control, can include a microprocessor or other processor device and/or logic device, which central processor 9100 receives input and controls the operation of the various components of the electronic device 9600.
The memory 9140 can 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 relating to the failure may be stored, and a program for executing the information may be stored. And the central processing unit 9100 can execute the program stored in the memory 9140 to realize information storage or processing, or 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. Power supply 9170 is used to provide power to electronic device 9600. The display 9160 is used for displaying display objects such as images and characters. The display may be, for example, an LCD display, but is not limited thereto.
The memory 9140 can be a solid state memory, e.g., Read Only Memory (ROM), Random Access Memory (RAM), a SIM card, or the like. There may also be a memory that holds information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes called an EPROM or the like. The memory 9140 could also be some other type of device. 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 being used for storing application programs and function programs or for executing a flow of operations of the electronic device 9600 by the central processor 9100.
The memory 9140 can also include a data store 9143, the data store 9143 being used to store 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 for the electronic device for communication functions and/or for performing other functions of the electronic device (e.g., messaging applications, contact book applications, etc.).
The communication module 9110 is a transmitter/receiver 9110 that transmits and receives signals via an antenna 9111. The communication module (transmitter/receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as in the case of a conventional mobile communication terminal.
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, 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 receive audio input from the microphone 9132, thereby implementing ordinary telecommunications functions. The audio processor 9130 may include any suitable buffers, decoders, amplifiers and so forth. In addition, the audio processor 9130 is also coupled to the central processor 9100, thereby enabling recording locally through the microphone 9132 and enabling locally stored sounds to be played through the speaker 9131.
An embodiment of the present application further provides a computer-readable storage medium capable of implementing all the steps in the interface automation test method in the foregoing embodiment, 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 of the interface automation test method in which an execution subject is a server or a client, for example, when the processor executes the computer program, the processor implements the following steps:
step 100: determining an initial interface which is currently used for carrying out automatic testing by adopting a target test case as a target interface, and executing a preposed interface searching step aiming at the target interface; wherein the front interface searching step comprises: judging whether a non-empty zone bit exists in the zone bit corresponding to each field of the current target interface, if so, marking the pre-interface recorded in the non-empty zone bit, updating the current target interface to the pre-interface, and then judging whether the non-empty zone bit exists in the zone bit corresponding to each field of the current target interface again until the zone bit corresponding to each field of the target interface is an empty zone bit.
Step 200: and 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.
As can be seen from the above description, the computer-readable storage medium provided in this embodiment of the present application, by determining whether a non-empty flag bit exists in flag bits corresponding to each field of a current target interface, if yes, marking a pre-interface recorded in the non-empty flag bit, and after updating the current target interface to the pre-interface, determining whether a non-empty flag bit exists in 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 empty, can effectively improve an automation degree and an intelligence degree of a correlation interface search from an interface perspective, and by constructing the flag bits, can effectively reduce a data amount and data redundancy of the correlation interface search, and can prevent omission or wrong selection of the correlation interface, thereby effectively improving an efficiency and an automation degree of an interface automation test process, manpower resources and time cost are effectively saved, reliability and effectiveness of automatic interface testing can be effectively improved, and user experience of testers is improved.
As will be appreciated by one skilled in the art, 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 flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams 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 principle and the implementation mode of the invention are explained by applying specific embodiments in the invention, and the description of the embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (16)

1. An automated interface testing method, comprising:
determining an initial interface which is currently used for carrying out automatic testing by adopting a target test case as a target interface, and executing a preposed interface searching step aiming at the target interface;
wherein the front interface searching step comprises: judging whether a non-empty zone bit exists in the zone bit corresponding to each field of the current target interface, if so, marking the pre-interface recorded in the non-empty zone bit, updating the current target interface to the pre-interface, and then judging whether the non-empty zone bit exists in the zone bit corresponding to each field of the current target interface again until the zone bit corresponding to each field of the target interface is an empty zone bit;
and 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.
2. The method according to claim 1, wherein before determining the initial interface currently used for the automated testing using the target test case as the target interface, the method further comprises:
setting a zone bit for each field corresponding to each interface corresponding to a service system respectively, wherein the zone bit comprises an empty zone bit and a non-empty zone bit; and the non-empty zone bit is used for storing the corresponding relation between the preposed interface and the field.
3. The method according to claim 1, wherein the step of determining an initial interface currently used for automated testing using a target test case as a target interface, and performing a pre-interface search for the target interface includes:
receiving an interface test request aiming at a business 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 of the current test based on the unique identifier of the interface to be tested, determining the initial interface as a target interface, and executing a preposed interface searching step aiming at the target interface.
4. The method for automated interface testing according to claim 3, further comprising, before said receiving an interface test request for a service system:
and 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 environment comprises corresponding network address information.
5. The automated interface testing method of claim 4, further comprising:
and adding test cases in the test case library in a mode of importing or adding pages, wherein the value of each field in the test cases can be null or non-null.
6. The automated interface testing method of claim 4, further comprising:
and directly adding a test environment without network connectivity verification in the test environment library in an importing or page adding mode.
7. The method for automated testing of interfaces of claim 1, further comprising, prior to the performing a pre-interface lookup step for the target interface:
coding the initial interface based on a preset coding rule;
correspondingly, the marking of the pre-interface recorded in the non-empty flag bit includes:
based on the coding rule, coding a front interface recorded in the non-empty zone bit to enable the coding value of the front interface to be larger than that of the initial interface; if other interfaces exist between the preposed interface and the initial interface, the code value of the preposed interface is larger than that of the other interfaces.
8. The method according to claim 1, wherein before the automatically testing the initial interface and the marked pre-interface based on the target test case in a preset target test environment if the marked pre-interface exists, the method further comprises:
and based on a preset coding rule, sequentially coding the initial interface and each preposed interface sequentially associated with the initial interface from small to large so that the initial interface and each preposed interface sequentially associated with the initial interface respectively correspond to a unique coding value.
9. The method according to claim 7 or 8, wherein if there is a marked front end interface, automatically testing the initial interface and the marked front end interface based on the target test case in a preset target test environment, includes:
if the marked preposed interface exists, writing the data of the initial interface and the marked preposed interface into the target test case;
aiming at the case field with the null value in the target test case, searching the zone bit of the field of the interface corresponding to the case field, and if the zone bit is a non-null zone bit, determining the field value corresponding to the front field stored in the zone bit as the target value of the current case field; if the flag bit is a null flag bit, setting the target value of the case field to null;
determining a value of the target test case as a target value of a case field aiming at the case field with the non-empty value in the target test case;
and in a preset target test environment, according to the code numerical values of the initial interface and the marked preposed interfaces, sequentially executing the automatic test tasks corresponding to the target test cases in the marked preposed interfaces and the initial interfaces in the order of the code numerical values from large to small.
10. An automated interface testing device, comprising:
the system comprises a preposed searching module, a target interface searching module and a control module, wherein the preposed searching module is used for determining an initial interface which is currently used for carrying out automatic testing by adopting a target test case as the target interface and executing a preposed interface searching step aiming at the target interface;
wherein the front interface searching step comprises: judging whether a non-empty zone bit exists in the zone bit corresponding to each field of the current target interface, if so, marking the pre-interface recorded in the non-empty zone bit, updating the current target interface to the pre-interface, and then judging whether the non-empty zone bit exists in the zone bit corresponding to each field of the current target interface again until the zone bit corresponding to each field of the target interface is an empty zone bit;
and the interface testing module is used for automatically testing the initial interface and the marked preposed interface based on the target test case in a preset target testing environment if the marked preposed interface exists.
11. The interface automation test device of claim 10 further comprising:
a flag bit setting module, configured to set flag bits for respective fields corresponding to respective interfaces corresponding to a service system before the initial interface currently used for performing an automated test using a target test case is determined to be a target interface, where the flag bits include an empty flag bit and a non-empty flag bit; and the non-empty zone bit is used for storing the corresponding relation between the preposed interface and the field.
12. The device according to claim 10, wherein the pre-lookup module is further configured to encode the initial interface based on a preset encoding rule before the pre-interface lookup step is performed on the target interface;
correspondingly, the preposed searching module comprises a coding unit;
the coding unit is used for coding a front interface recorded in the non-empty zone bit based on the coding rule, so that the coding numerical value of the front interface is larger than that of the initial interface; if other interfaces exist between the preposed interface and the initial interface, the code value of the preposed interface is larger than that of the other interfaces.
13. The interface automation test device of claim 10 further comprising:
and the coding module is used for sequentially coding the initial interface and each pre-interface sequentially associated with the initial interface according to a preset coding rule before automatically testing the initial interface and the marked pre-interfaces based on the target test case in a preset target test environment, so that the initial interface and each pre-interface sequentially associated with the initial interface respectively correspond to a unique coding value.
14. The automated interface testing apparatus according to claim 12 or 13, wherein the interface testing module is configured to perform the following:
if the marked preposed interface exists, writing the data of the initial interface and the marked preposed interface into the target test case;
aiming at the case field with the null value in the target test case, searching the zone bit of the field of the interface corresponding to the case field, and if the zone bit is a non-null zone bit, determining the field value corresponding to the front field stored in the zone bit as the target value of the current case field; if the flag bit is a null flag bit, setting the target value of the case field to null;
determining a value of the target test case as a target value of a case field aiming at the case field with the non-empty value in the target test case;
and in a preset target test environment, according to the code numerical values of the initial interface and the marked preposed interfaces, sequentially executing the automatic test tasks corresponding to the target test cases in the marked preposed interfaces and the initial interfaces in the order of the code numerical values from large to small.
15. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the method for automated testing of an interface of any of claims 1 to 9 when executing the computer program.
16. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method for automated testing of an interface of any one of claims 1 to 9.
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 true CN113791984A (en) 2021-12-14
CN113791984B 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)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115292205A (en) * 2022-10-08 2022-11-04 四川无限智达科技有限公司 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

Cited By (2)

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

Also Published As

Publication number Publication date
CN113791984B (en) 2023-06-09

Similar Documents

Publication Publication Date Title
CN110413528B (en) Intelligent configuration method and system for test environment
CN111786885A (en) Distributed full-link gray level routing method and device
CN112463634B (en) Software testing method and device under micro-service architecture
CN110990228A (en) Data interface monitoring method and device
CN112615753A (en) Link abnormity tracking method, first node, second node and link
CN112394932A (en) Automatic browser webpage skin changing method and device
CN112784112A (en) Message checking 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
CN112035676B (en) User operation behavior knowledge graph construction method and device
CN113076262B (en) Webpage automatic testing method and device
CN115495519A (en) Report data processing method and device
CN113050985A (en) Front-end engineering dependence automatic registration method and device
CN112905464B (en) Application running environment data processing method and device
CN114637531A (en) Method and device for dynamically generating application program interface
CN114510305A (en) Model training method and device, storage medium and electronic equipment
CN113377385A (en) Client automatic deployment method and device
CN113742212A (en) New and old system migration test 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
CN113419953A (en) Test data processing method, device and system
CN113050936B (en) Front-end data processing method and device based on integrated development environment
CN113515447A (en) System automation test method and device

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