CN109857667B - Interface automation test method, test device, test equipment and storage medium - Google Patents

Interface automation test method, test device, test equipment and storage medium Download PDF

Info

Publication number
CN109857667B
CN109857667B CN201910108589.XA CN201910108589A CN109857667B CN 109857667 B CN109857667 B CN 109857667B CN 201910108589 A CN201910108589 A CN 201910108589A CN 109857667 B CN109857667 B CN 109857667B
Authority
CN
China
Prior art keywords
interface
test
node
interface node
parameter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910108589.XA
Other languages
Chinese (zh)
Other versions
CN109857667A (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.)
Suzhou Dragon Testing Intelligent Technology Co ltd
Original Assignee
Suzhou Dragon Testing Intelligent Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Dragon Testing Intelligent Technology Co ltd filed Critical Suzhou Dragon Testing Intelligent Technology Co ltd
Priority to CN201910108589.XA priority Critical patent/CN109857667B/en
Publication of CN109857667A publication Critical patent/CN109857667A/en
Priority to PCT/CN2019/118701 priority patent/WO2020155778A1/en
Application granted granted Critical
Publication of CN109857667B publication Critical patent/CN109857667B/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

Abstract

The invention discloses an interface automatic test method, a test device, test equipment and a storage medium, wherein the test method comprises the following steps: acquiring interface set information of an object to be tested, wherein the interface set information comprises each interface node and interface description thereof; arranging the related interface nodes in sequence according to functions to be tested, and establishing association between the output parameter of the previous interface node and the input parameter of the next interface node in the two adjacent interface nodes to obtain an interface flow chart; performing deep traversal on the interface flow chart by combining preset input parameters of interface nodes, and generating a test code corresponding to each backward complete branch path from a traversal starting node, wherein the test code comprises a program for calling the interface nodes; and running the test code in the test running environment to obtain a test result. The invention utilizes the interface endpoint flow and the configured parameters to automatically generate the test code for testing the interface, and the automatic test can be completed by running the code in the test environment.

Description

Interface automation test method, test device, test equipment and storage medium
Technical Field
The invention relates to the technical field of computer testing, in particular to an interface automatic testing method, a testing device, testing equipment and a storage medium.
Background
With the development of software technology, more and more software provides services for users through platforms, and a third party can customize required services according to platform provided interfaces, so that the software often relates to interface testing nowadays. Interfaces are predefined functions that are intended to provide applications and developers the ability to access a set of routines based on certain software or hardware without having to access source code or understand the details of the internal workings. The interface test is a test of submitting input data to an interface, obtaining a return result and analyzing whether the result meets expectations.
The interface test method in the prior art is as follows: the method comprises the steps that a tester writes a test case corresponding to an interface to be tested in advance, sends an interface request message corresponding to the test case to the interface to be tested, receives a response message fed back by the interface to be tested, and determines a test result according to the interface request message and the response message corresponding to the test case. In practical application, each interface corresponds to a parameter, each parameter may have a plurality of values, and each test case includes values of all the parameters. In order to ensure the comprehensiveness of the interface test, a tester needs to write a plurality of test cases so that the plurality of test cases can cover the combination of all parameter values.
Because in the prior art, a tester needs to manually compile test cases, when the parameters of an interface are more, the tester needs to manually compile dozens of or even hundreds of test cases, so that the efficiency of compiling the test cases is lower, the efficiency of testing the interface is lower, the test cases are easy to miss, and the interface testing process cannot be effectively traced.
Disclosure of Invention
In order to solve the problems in the prior art, the invention provides an interface automatic test method, a test device, test equipment and a storage medium, which automatically generate a test code for testing an interface of software to be tested by using interface flow and configured parameters and generate a clear test report, wherein the technical scheme is as follows:
in one aspect, the present invention provides an interface automation test method, including the following steps:
acquiring interface set information of an object to be tested, wherein the interface set information comprises each interface node and interface description corresponding to each interface node, and the interface description comprises input parameters and output parameters;
arranging the related interface nodes in sequence according to functions to be tested, and establishing association between the output parameter of the previous interface node and the input parameter of the next interface node in the two adjacent interface nodes to obtain an interface flow chart;
performing deep traversal on the interface flow chart by combining the parameter type and the parameter value of the input parameter of a preset interface node, and generating a test code corresponding to each complete branch path from a traversal starting node to the backward direction, wherein the test code comprises a program for calling each interface node;
and running the test code in a test running environment to obtain a test result.
Further, the method also comprises the steps of obtaining an assertion setting result before or after obtaining the interface flow chart, wherein the assertion setting result is an expected value set for an output parameter output after calling the corresponding interface node;
generating the test code includes: the program of the assertion judgment operation is referred to after calling the interface node corresponding to the setting of the expected value.
Further, the method further includes obtaining an initialization parameter configuration result after obtaining the interface flowchart, where the initialization parameter configuration result includes a test start interface node, and the initialization parameter configuration result is used to implement parameter initialization when generating a test code, and includes: initializing the traversal starting node as the test starting interface node, where the test starting interface node may be any interface node in the interface flowchart.
Further, the initialization parameter configuration result further includes a test depth value, and the configuration value of the test depth value is greater than or equal to the longest depth value of the flowchart starting from the configured test start interface node.
Further, the method also comprises the steps of obtaining an input parameter configuration result before or after obtaining the interface flow chart, wherein the input parameter configuration result comprises parameters required to be input for realizing calling of the interface node;
generating the test code includes: and assigning the configuration result of the input parameter to the program of the input parameter at the corresponding calling interface node.
Further, the step of establishing the interface flowchart comprises the following operations:
based on the condition that different interface nodes correspond to the same previous interface node, setting the different interface nodes in different branch paths, and/or
And based on the condition that the first interface node is a previous interface node of the second interface node and the second interface node is a previous interface node of the third interface node, setting the first interface node, the second interface node and the third interface node in the same branch path.
Further, some or all of the interface flow diagrams may be capable of moving, copying, cutting, and/or pasting operations.
Optionally, the step of running the test code in the test running environment includes a local running mode and/or a cloud running mode, where the local running mode includes: downloading the test code from a cloud end to a local computer, and running the test code in test software in the computer to obtain a test result;
the cloud operation mode comprises: sending an operation request to a cloud end, wherein the operation request comprises information of an object to be tested; acquiring a corresponding test code according to the operation request; and receiving a test result obtained by running the test code in the test software of the cloud based on the running request.
Further, the test report of the test result includes a description of a test failure case, where the test failure case includes a case of an interface call error and/or an assertion judgment error.
Further, the flow information and the data information in each test case obtained by running the test code in the test running environment are associated and stored separately.
In another aspect, the present invention provides an interface automation testing apparatus, including the following modules:
the system comprises a target module to be tested, a target module to be tested and a target module, wherein the target module to be tested is used for acquiring interface set information of an object to be tested, the interface set information comprises each interface node and an interface description corresponding to each interface node, and the interface description comprises input parameters and output parameters;
the flow chart module is used for arranging the related interface nodes in sequence according to the functions to be tested, and establishing association between the output parameter of the previous interface node and the input parameter of the next interface node in the two adjacent interface nodes to obtain an interface flow chart;
the code generation module is used for performing deep traversal on the interface flow chart by combining the parameter type and the parameter value of the input parameter of a preset interface node, and generating a test code corresponding to each complete branch path from a traversal starting node to the backward direction, wherein the test code comprises a program for calling each interface node;
and the running module is used for running the test code in a test running environment to obtain a test result.
In another aspect, the present invention provides an interface automation test device, including a processor and a memory, where the memory stores a program, and when the processor executes the program, the processor performs the following operations:
acquiring interface set information of an object to be tested, wherein the interface set information comprises each interface node and interface description corresponding to each interface node, and the interface description comprises input parameters and output parameters;
arranging the related interface nodes in sequence according to functions to be tested, and establishing association between the output parameter of the previous interface node and the input parameter of the next interface node in the two adjacent interface nodes to obtain an interface flow chart;
performing deep traversal on the interface flow chart by combining the parameter type and the parameter value of the input parameter of a preset interface node, and generating a test code corresponding to each complete branch path from a traversal starting node to the backward direction, wherein the test code comprises a program for calling each interface node;
and running the test code in a test running environment to obtain a test result.
In yet another aspect, the present invention provides a storage medium storing a program that, when executed, performs the following:
acquiring interface set information of an object to be tested, wherein the interface set information comprises each interface node and interface description corresponding to each interface node, and the interface description comprises input parameters and output parameters;
arranging the related interface nodes in sequence according to functions to be tested, and establishing association between the output parameter of the previous interface node and the input parameter of the next interface node in the two adjacent interface nodes to obtain an interface flow chart;
performing deep traversal on the interface flow chart by combining the parameter type and the parameter value of the input parameter of a preset interface node, and generating a test code corresponding to each complete branch path from a traversal starting node to the backward direction, wherein the test code comprises a program for calling each interface node;
and running the test code in a test running environment to obtain a test result.
The technical scheme provided by the invention has the following beneficial effects:
a. the interface flow chart strengthens semantic support for the test software;
b. automatically generating a test code by using a code automatic generation engine;
c. the flow and the data in the test case are stored separately and effectively displayed on the product, so that the use convenience of a tester is improved;
d. the automatic testing system can automatically test interfaces in computer network pages, mobile terminal web pages, mobile terminal apps, wechat applets, wechat public numbers, PC application programs and industrial control software, and has a wide application range;
e. the test report is comprehensive and accurate, the traceability of the test process is strong, and the test result is clear at a glance.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, 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 flow chart of a method for automated testing of an interface according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a flow chart of an interface provided by an embodiment of the invention;
FIG. 3 is a flowchart of an automated interface testing method for adding parameter configuration and assertion according to an embodiment of the present invention;
FIG. 4 is a block diagram of an interface automatic test apparatus according to an embodiment of the present invention;
FIG. 5 is a block diagram of the interface automated test equipment with the interrupt setting and input parameter configuration of FIG. 4 placed after the flowchart is established.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the 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 invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, apparatus, article, or device that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or device.
In an embodiment of the present invention, an interface automation testing method is provided, and with reference to fig. 1, the method includes the following processes:
and S1, acquiring interface set information of the object to be tested.
The invention discloses a technology for interface testing, and an interface generally refers to a way for interaction between a front end and a background, for example, taking a travel to book a hotel, the front end needs to input parameters such as a destination (such as Shanghai) and stay-in time, and the background returns a hotel list at the destination. The objects to be tested related to the interfaces comprise interfaces in mobile APP, web pages, WeChat applets, WeChat public numbers, PC application programs, industrial control software and the like, and the interfaces are hereinafter referred to as interfaces or interface nodes.
Specifically, the interface set information includes each interface node and an interface description corresponding to each interface node, where the interface description includes input parameters and output parameters, such as: taking the portable network application as an example, when testing the hotel ordering function, the related interfaces include a hotel query interface, a hotel list interface, a hotel order interface and an order payment interface.
And S2, establishing an interface flow chart.
Specifically, according to the function to be tested, the related interface nodes are arranged in sequence, and the output parameter of the previous interface node in the two adjacent interface nodes is associated with the input parameter of the next interface node, and the specific establishing process is as follows:
after taking the whole interface set of the software (such as a portable network station) and taking the interface description (input parameters and output parameters) of each interface, according to the software requirements, the relevant interfaces are arranged and organized in order for a certain function (such as a portable hotel booking function), and then a certain field in the output of the previous interface is described on the line of each two interfaces and corresponds to a certain parameter in the input of the next interface. When all functions have been drawn, the interface flow diagram is complete.
Based on the condition that different interface nodes correspond to the same previous interface node, the different interface nodes are arranged in different branch paths, for example, a take-away home page interface corresponds to a plurality of sub-interfaces: hotel inquiry interface, air ticket inquiry interface, train ticket inquiry interface, sight spot ticket inquiry interface, etc.;
based on the situation that the first interface node is the previous interface node of the second interface node and the second interface node is the previous interface node of the third interface node, the first interface node, the second interface node and the third interface node are arranged in the same branch path, taking the interface with the hotel booking function as an example: for the hotel query interface, the input parameters are query conditions (destination, time, additional conditions and the like), and the output parameters are hotel lists obtained by querying under the specific query conditions; the hotel list parameters output by the hotel query interface are used as input parameters of the hotel list interface, and if a user selects a piece of hotel information in the hotel list, the hotel list interface outputs the piece of hotel information as output parameters; the hotel information (including hotel name, check-in date, price and the like) is used as an input parameter of a hotel order interface, and if a user selects a payment mode on the hotel order interface, the hotel order interface outputs the payment mode and payment amount as an output parameter; the output parameters of the payment mode and the payment amount are used as the input parameters of the order payment interface, and finally the interface flow chart shown in fig. 2 is obtained, wherein the names of the interface name and the input/output parameter in the chart are only schematic, and the name named in the bottom layer interface script is taken as the standard.
And S3, performing deep traversal on the interface flow chart, and generating a corresponding test code according to each backward complete branch path from the traversal starting node.
Specifically, the process of generating the test code by using the code engine is actually a process of traversing an interface flowchart by the code engine, and the test code includes a program for calling each interface node: in the traversing process, when an interface node is detected, the parameter type and the parameter value of a preset input parameter of the interface node are obtained to call the interface node, a direct call interface can call an interface, such as an interface getHotel List (String destination), then, according to the input data destination being Shanghai, when the operation is carried out, data is transmitted to the getHotel List (), so that the interface is triggered, the parameter value of the output parameter is obtained, then, a field is matched from the output parameter to be used as the input parameter of the next interface node, and therefore, the interface node on each complete branch path from the traversal starting node to the next interface node in the traversal path is completed.
And S4, running the test code in the test running environment to obtain a test result.
And placing the test codes into a test operation environment in a template form meeting the operation conditions, and operating the test codes to obtain a test result. The modes of operation include, but are not limited to, the following two modes:
cloud operation mode: sending an operation request to a cloud end, wherein the operation request comprises information of an object to be tested; the cloud server obtains a test code corresponding to the information of the object to be tested according to the operation request, puts the test code into a project template, and makes the test code meet the operation requirement of a cloud test environment, for example, the test code is copied to a folder with an appointed address, a source configuration file of the object to be tested is called, parameters in the project template are automatically filled according to the source configuration file, the filled project template including the test code can be put into the test software of the cloud to operate, and a test result obtained by operating the test code in the test software of the cloud based on the operation request is received;
the local operation mode is as follows: the method comprises the steps of downloading corresponding test codes from a cloud end to a local computer, running the test codes in test software in the computer, similarly configuring items of the test codes before running the test codes, wherein the configuration mode of the test codes is consistent with the operation of putting the test codes into a project template in the cloud end running mode. It should be noted that, if the carrier of the information of the object to be tested is a mobile terminal, the mobile terminal needs to be connected with a local computer first.
The testing software includes but is not limited to JMeter, Postman, both of which can be applied to testing android, iOS system, Web or PC interface.
For most of the objects requiring testing, the initialization parameters, the input parameters, and the assertion conditions need to be configured before the code is automatically generated, the flow of the method is shown in fig. 3, and the initialization of the parameters before the corresponding test code is generated in step S3 is described as follows:
after obtaining the interface flowchart, performing initialization parameter configuration, where the initialization parameter configuration result includes a test start interface node, and the initialization parameter configuration result is used to implement parameter initialization when generating a test code, and includes: initializing the traversal starting node as the test starting interface node, where the test starting interface node may be any interface node in the interface flow chart, and it can be seen that the traversal starting node may be a root interface node of the interface flow chart, or may be a middle (not last) interface node in the interface flow chart, each complete branch path from the traversal starting node to the back includes traversing to the last interface node, in an embodiment of the present invention, the interface flow chart is a flow tree structure (one-way), or in a preferred embodiment of the present invention, two interface nodes in the interface flow chart may be called in two ways, for example, in fig. 2, a user calls a hotel order interface after selecting a certain piece of hotel information in the hotel list, and calls the hotel order interface again through an input parameter back after calling the hotel order interface, and calling the hotel order interface again after reselecting the hotel information, wherein in the case, the interface node flow under the complete traversal path with the hotel query interface as the traversal starting node is the hotel query interface → the hotel list interface → the hotel order interface → the order payment interface. The traversal starting node can select any node in the middle of the process, so that when a new function is added and needs to be tested, the new test is not needed from the beginning, and only the interface node added with the new function is used as the traversal starting node, and the test efficiency is effectively improved. The automatic test system in the prior art cannot realize local test only aiming at the added new functions, so that the automatic test efficiency is low, and the test process is long.
In addition to the test start interface node, the initialization parameter configuration result further includes a test depth value, and a configuration value of the test depth value is greater than or equal to a longest depth value of the flow chart starting from the configured test start interface node, where the depth configuration value is equal to the longest depth value of the flow chart starting from the configured test start interface node, which can ensure that each branch path flow starting from the test start interface node can be completely traversed; if there is interaction between multiple branch paths, for example, in the loan App, there is a loan service flow interface and a repayment service flow interface, there is interaction between the loan service and the repayment service, for example, the loan is first and then the repayment should be performed, so that if the interaction function between two branch paths is to be tested, the page depth needs to be set to be the sum of the depth values of the two branch paths.
The following describes the input parameter configuration before the corresponding test code is generated in step S3:
before or after the interface flowchart is obtained, obtaining an input parameter configuration result (see fig. 4 and fig. 5), where the input parameter configuration result includes parameters that need to be input for invoking an interface node, such as an inquiry interface at a hotel, the input parameters that need to be configured include a hotel name, a target city, a check-in date and a price, and may further include a screening condition, such as a house type, an area size, a rental type, and the like, and further, for example, at a hotel order interface, it needs to set selection entry information, such as entering the hotel order interface after selecting a second piece of hotel information to click. Through the preset input parameters corresponding to each interface, in the process of generating the test code, the code engine sets the input parameters of the user at a proper position, namely, the configuration result of the input parameters is assigned to the input parameter elements at the corresponding called interface node so as to complete the matching of the input parameters to the next interface node.
The following explains an assertion arrangement before the corresponding test code is generated in step S3:
performing assertion setting before or after obtaining the interface flowchart (see fig. 4 and 5), wherein the assertion setting result is an expected value set for a certain field in an output parameter output after calling the corresponding interface node; in the code generation process, after a certain interface node preset with assertion configuration is called, assertion judgment is carried out by referring to assertion operation, for example, for a hotel query interface, if input parameters of the hotel query interface are 2 months, 14 days to 2 months, 15 days, Beijing and four seasons of a hotel, in the process of automatically generating test codes, a list table of a hotel list interface is called from a background, configuration can be known according to the list table, a first column of the list is stay-in time information, a second column is leaving time information, a third column is hotel address information, a fourth column is hotel name information, assertion judgment inserted in the test codes can be judgment whether a first column value of the list table is equal to '02-14', a second column value is equal to '02-15', or judgment whether a fourth column value is equal to 'four seasons', if not, assertion is failed, as is the case with the failure test case.
The test result comprises a test report in a text form, the test report comprises a test failure case description, such as the interface calling error and/or the assertion judgment error, a fail mark is corresponding, if the fail mark is clicked, specific failure details appear, and fields which do not accord with expected values in the text report are preferably displayed in a highlight form. In addition, the test report may further include a performance indicator test result, such as a start time of the test initiated by each interface, a return time of the interface, and a time difference between the start time and the return time is a time spent by the interface, and this time may be used to detect whether it is a bottleeck of the entire system.
In a preferred embodiment of the present invention, part or all of the interface flow chart can perform the operations of moving, copying, cutting and/or pasting, which provides great convenience in establishing the interface flow chart and reduces the repeated work.
Further, the flow information and the data information in each test case obtained by running the test code in the test running environment are associated and stored separately, and are effectively displayed on the product. The process and the data are stored in different folders, so that the arrangement is clear, the tester is clear at a glance, and the working efficiency of the tester can be obviously improved no matter the process or the data is checked or modified.
In one embodiment of the present invention, there is provided an interface automation test apparatus, see fig. 4, comprising the following modules:
the system comprises a target module to be tested, a target module to be tested and a target module, wherein the target module to be tested is used for acquiring interface set information of an object to be tested, the interface set information comprises each interface node and an interface description corresponding to each interface node, and the interface description comprises input parameters and output parameters;
the flow chart module is used for arranging the related interface nodes in sequence according to the functions to be tested, and establishing association between the output parameter of the previous interface node and the input parameter of the next interface node in the two adjacent interface nodes to obtain an interface flow chart;
the code generation module is used for performing deep traversal on the interface flow chart by combining the parameter type and the parameter value of the input parameter of a preset interface node, and generating a test code corresponding to each complete branch path from a traversal starting node to the backward direction, wherein the test code comprises a program for calling each interface node;
and the running module is used for running the test code in a test running environment to obtain a test result.
In general, the test working process of the interface automation test module is as follows: the method comprises the steps that a target module to be tested obtains interface set information of an object to be tested, wherein the interface set information comprises interface nodes and input parameters and output parameters corresponding to the interface nodes, information needing to be filled in the interface nodes is preset as the input parameters, and assertion setting is set on the interface nodes; then, an interface flow chart is established according to the interface information, then a node is selected as a test initial interface node in the interface flow chart, and a test depth value is initialized; and then traversing the flow chart and automatically generating a code, wherein the essence of automatically generating the code is that a code engine is utilized to traverse to an interface node, if assertion setting exists, assertion judgment is carried out, if assertion setting does not exist, input parameters of the current interface node are added into the code, after the input parameters are completed, the interface is called and a return value is received, then a value of a certain field in the preset return value is matched with the input parameters required by the next interface node, and the next interface node is called until the last interface node on the branch path is called (corresponding assertion judgment is completed, if the interface has assertion setting).
It should be noted that: in the above-described embodiment, when performing the interface automatic test, the interface automatic test apparatus is only illustrated by dividing the functional modules, and in practical applications, the function distribution may be completed by different functional modules according to needs, that is, the internal structure of the interface automatic test apparatus is divided into different functional modules to complete all or part of the functions described above. In addition, the embodiment of the interface automatic testing apparatus provided in this embodiment and the interface automatic testing method provided in the above embodiment belong to the same concept, and specific implementation processes thereof are described in detail in the method embodiment and are not described herein again.
In an embodiment of the present invention, an interface automation test device is provided, which includes a processor and a memory, wherein the memory stores a program, and when the processor executes the program, the following operations are performed:
acquiring interface set information of an object to be tested, wherein the interface set information comprises each interface node and interface description corresponding to each interface node, and the interface description comprises input parameters and output parameters;
arranging the related interface nodes in sequence according to functions to be tested, and establishing association between the output parameter of the previous interface node and the input parameter of the next interface node in the two adjacent interface nodes to obtain an interface flow chart;
performing deep traversal on the interface flow chart by combining the parameter type and the parameter value of the input parameter of a preset interface node, and generating a test code corresponding to each complete branch path from a traversal starting node to the backward direction, wherein the test code comprises a program for calling each interface node;
and running the test code in a test running environment to obtain a test result.
In one embodiment of the present invention, there is provided a storage medium storing a program that, when executed, performs the operations of:
acquiring interface set information of an object to be tested, wherein the interface set information comprises each interface node and interface description corresponding to each interface node, and the interface description comprises input parameters and output parameters;
arranging the related interface nodes in sequence according to functions to be tested, and establishing association between the output parameter of the previous interface node and the input parameter of the next interface node in the two adjacent interface nodes to obtain an interface flow chart;
performing deep traversal on the interface flow chart by combining the parameter type and the parameter value of the input parameter of a preset interface node, and generating a test code corresponding to each complete branch path from a traversal starting node to the backward direction, wherein the test code comprises a program for calling each interface node;
and running the test code in a test running environment to obtain a test result.
The above embodiments of the interface automatic test device and the corresponding storage medium belong to the same concept as the interface automatic test method provided by the above embodiments, and the specific implementation process thereof is described in detail in the method embodiments and will not be described herein again.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (10)

1. An automatic interface testing method is characterized by comprising the following steps:
acquiring interface set information of an object to be tested, wherein the interface set information comprises each interface node and interface description corresponding to each interface node, and the interface description comprises input parameters and output parameters;
arranging related interface nodes in sequence according to functions to be tested, establishing association between an output parameter of a previous interface node and an input parameter of a next interface node in two adjacent interface nodes, and describing a parameter in a field in the output of the previous interface corresponding to the input of the next interface on a line of every two interfaces to obtain an interface flow chart; setting different interface nodes in different branch paths based on the condition that the different interface nodes correspond to the same previous interface node;
the method comprises the steps that the interface flow diagram is subjected to deep traversal by combining the parameter type and the parameter value of an input parameter of a preset interface node, any node in the middle of the flow is selected as a traversal starting node in the process of traversing the interface flow diagram by using a code engine, when the interface node is detected, the parameter type and the parameter value of the input parameter of the preset interface node are obtained to call the interface node, a test code corresponding to the interface node is generated according to each backward complete branch path from the traversal starting node, and the test code comprises a program for calling each interface node;
running the test code in a test running environment to obtain a test result, wherein the test result comprises: selecting a source configuration file of a test code to be tested called by a cloud server, and automatically filling parameters in a project template according to the source configuration file; or, a local user downloads a project template and a source configuration file, manually completes project configuration, obtains a template form corresponding to the test code and meeting the operating condition, and enables the test code to be placed in a test operating environment in the template form meeting the operating condition to operate to obtain a test result;
performing assertion setting before or after obtaining the interface flow chart, wherein the assertion setting result is an expected value set for a certain field in output parameters output after calling corresponding interface nodes;
generating the test code includes: calling a program for judging the assertion after calling an interface node corresponding to a set expected value;
acquiring an initialization parameter configuration result after obtaining the interface flow chart, wherein the initialization parameter configuration result comprises a test starting interface node, and the initialization parameter configuration result is used for realizing parameter initialization when generating a test code, and comprises the following steps: initializing the traversal starting node as the test starting interface node, wherein the test starting interface node is any one interface node in the interface flow chart;
the initialization parameter configuration result also comprises a test depth value, and the configuration value of the test depth value is greater than or equal to the longest depth value of the flow chart taking the configured test starting interface node as a starting point; the depth configuration value is equal to the longest depth value of the flow chart taking the configured test starting interface node as a starting point, so that each branch path flow taking the test starting interface node as the starting point is completely traversed; when interaction exists between a plurality of branch paths and the interaction function between two branch paths is tested, the page depth is set to be the sum of the depth values of the two branch flows.
2. The method for automatically testing the interface according to claim 1, further comprising obtaining an input parameter configuration result before or after obtaining the interface flowchart, wherein the input parameter configuration result comprises parameters required to be input for realizing the calling of the interface node;
generating the test code includes: and assigning the configuration result of the input parameter to the program of the input parameter at the corresponding calling interface node.
3. The method for automatically testing the interface of claim 1, wherein the step of establishing the interface flowchart comprises the operations of:
based on the condition that different interface nodes correspond to the same previous interface node, setting the different interface nodes in different branch paths, and/or
And based on the condition that the first interface node is a previous interface node of the second interface node and the second interface node is a previous interface node of the third interface node, setting the first interface node, the second interface node and the third interface node in the same branch path.
4. The automated interface testing method of claim 3, wherein part or all of the interface flow graph is capable of move, copy, cut, and/or paste operations.
5. The automated interface testing method according to claim 1, wherein the step of running the test code in the test running environment comprises a local running mode and/or a cloud running mode, and the local running mode comprises: downloading the test code from a cloud end to a local computer, and running the test code in test software in the computer to obtain a test result;
the cloud operation mode comprises: sending an operation request to a cloud end, wherein the operation request comprises information of an object to be tested; acquiring a corresponding test code according to the operation request; and receiving a test result obtained by running the test code in the test software of the cloud based on the running request.
6. The method according to claim 1, wherein the test report of the test result includes a description of a test failure case, and the test failure case includes a case of an interface call error and/or an assertion judgment error.
7. The automated interface testing method according to claim 1, wherein the flow information and the data information in each test case obtained by running the test code in the test running environment are associated and stored separately.
8. An automatic interface testing device is characterized by comprising the following modules:
the system comprises a target module to be tested, a target module to be tested and a target module, wherein the target module to be tested is used for acquiring interface set information of an object to be tested, the interface set information comprises each interface node and an interface description corresponding to each interface node, and the interface description comprises input parameters and output parameters;
the flow chart module is used for arranging the related interface nodes in sequence according to functions to be tested, establishing association between the output parameter of the previous interface node and the input parameter of the next interface node in the two adjacent interface nodes, and describing the parameter of the field in the output of the previous interface corresponding to the input of the next interface on the line of every two interfaces to obtain an interface flow chart; setting different interface nodes in different branch paths based on the condition that the different interface nodes correspond to the same previous interface node;
the code generation module is used for performing deep traversal on the interface flow chart by combining the parameter type and the parameter value of the input parameter of a preset interface node, selecting any node in the middle of the flow as a traversal starting node in the process of traversing the interface flow chart by using a code engine, acquiring the parameter type and the parameter value of the input parameter of the preset interface node when the interface node is detected so as to call the interface node, and generating a test code corresponding to the interface node according to each backward complete branch path from the traversal starting node, wherein the test code comprises a program for calling each interface node;
the running module is used for running the test code in a test running environment to obtain a test result, and comprises: selecting a source configuration file of a test code to be tested called by a cloud server, and automatically filling parameters in a project template according to the source configuration file; or, a local user downloads a project template and a source configuration file, manually completes project configuration, obtains a template form corresponding to the test code and meeting the operating condition, and enables the test code to be placed in a test operating environment in the template form meeting the operating condition to operate to obtain a test result;
the interface automatic testing device also comprises an assertion setting unit which is used for carrying out assertion setting before or after the interface flow chart is obtained, wherein the assertion setting result is an expected value set for a certain field in output parameters which are output after the corresponding interface nodes are called;
generating the test code includes: calling a program for judging the assertion after calling an interface node corresponding to a set expected value;
acquiring an initialization parameter configuration result after obtaining the interface flow chart, wherein the initialization parameter configuration result comprises a test starting interface node, and the initialization parameter configuration result is used for realizing parameter initialization when generating a test code, and comprises the following steps: initializing the traversal starting node as the test starting interface node, wherein the test starting interface node is any one interface node in the interface flow chart;
the initialization parameter configuration result also comprises a test depth value, and the configuration value of the test depth value is greater than or equal to the longest depth value of the flow chart taking the configured test starting interface node as a starting point; the depth configuration value is equal to the longest depth value of the flow chart taking the configured test starting interface node as a starting point, so that each branch path flow taking the test starting interface node as the starting point is completely traversed; when interaction exists between a plurality of branch paths and the interaction function between two branch paths is tested, the page depth is set to be the sum of the depth values of the two branch flows.
9. An interface automation test device comprising a processor and a memory, the memory having a program stored therein, wherein when the processor executes the program, the following operations are performed:
acquiring interface set information of an object to be tested, wherein the interface set information comprises each interface node and interface description corresponding to each interface node, and the interface description comprises input parameters and output parameters;
arranging related interface nodes in sequence according to functions to be tested, establishing association between an output parameter of a previous interface node and an input parameter of a next interface node in two adjacent interface nodes, and describing a parameter in a field in the output of the previous interface corresponding to the input of the next interface on a line of every two interfaces to obtain an interface flow chart; setting different interface nodes in different branch paths based on the condition that the different interface nodes correspond to the same previous interface node;
the method comprises the steps that the interface flow diagram is subjected to deep traversal by combining the parameter type and the parameter value of an input parameter of a preset interface node, any node in the middle of the flow is selected as a traversal starting node in the process of traversing the interface flow diagram by using a code engine, when the interface node is detected, the parameter type and the parameter value of the input parameter of the preset interface node are obtained to call the interface node, a test code corresponding to the interface node is generated according to each backward complete branch path from the traversal starting node, and the test code comprises a program for calling each interface node;
running the test code in a test running environment to obtain a test result, wherein the test result comprises: selecting a source configuration file of a test code to be tested called by a cloud server, and automatically filling parameters in a project template according to the source configuration file; or, a local user downloads a project template and a source configuration file, manually completes project configuration, obtains a template form corresponding to the test code and meeting the operating condition, and enables the test code to be placed in a test operating environment in the template form meeting the operating condition to operate to obtain a test result;
the interface automation test equipment also comprises an assertion setting unit which is used for carrying out assertion setting before or after the interface flow chart is obtained, wherein the assertion setting result is an expected value set for a certain field in output parameters which are output after the corresponding interface nodes are called;
generating the test code includes: calling a program for judging the assertion after calling an interface node corresponding to a set expected value;
acquiring an initialization parameter configuration result after obtaining the interface flow chart, wherein the initialization parameter configuration result comprises a test starting interface node, and the initialization parameter configuration result is used for realizing parameter initialization when generating a test code, and comprises the following steps: initializing the traversal starting node as the test starting interface node, wherein the test starting interface node is any one interface node in the interface flow chart;
the initialization parameter configuration result also comprises a test depth value, and the configuration value of the test depth value is greater than or equal to the longest depth value of the flow chart taking the configured test starting interface node as a starting point; the depth configuration value is equal to the longest depth value of the flow chart taking the configured test starting interface node as a starting point, so that each branch path flow taking the test starting interface node as the starting point is completely traversed; when interaction exists between a plurality of branch paths and the interaction function between two branch paths is tested, the page depth is set to be the sum of the depth values of the two branch flows.
10. A storage medium storing a program, wherein the program when executed performs the operations of:
acquiring interface set information of an object to be tested, wherein the interface set information comprises each interface node and interface description corresponding to each interface node, and the interface description comprises input parameters and output parameters;
arranging related interface nodes in sequence according to functions to be tested, establishing association between an output parameter of a previous interface node and an input parameter of a next interface node in two adjacent interface nodes, and describing a parameter in a field in the output of the previous interface corresponding to the input of the next interface on a line of every two interfaces to obtain an interface flow chart; setting different interface nodes in different branch paths based on the condition that the different interface nodes correspond to the same previous interface node;
the method comprises the steps that the interface flow diagram is subjected to deep traversal by combining the parameter type and the parameter value of an input parameter of a preset interface node, any node in the middle of the flow is selected as a traversal starting node in the process of traversing the interface flow diagram by using a code engine, when the interface node is detected, the parameter type and the parameter value of the input parameter of the preset interface node are obtained to call the interface node, a test code corresponding to the interface node is generated according to each backward complete branch path from the traversal starting node, and the test code comprises a program for calling each interface node;
running the test code in a test running environment to obtain a test result, wherein the test result comprises: selecting a source configuration file of a test code to be tested called by a cloud server, and automatically filling parameters in a project template according to the source configuration file; or, a local user downloads a project template and a source configuration file, manually completes project configuration, obtains a template form corresponding to the test code and meeting the operating condition, and enables the test code to be placed in a test operating environment in the template form meeting the operating condition to operate to obtain a test result;
the storage medium also comprises an assertion setting unit which is used for setting an expected value of a certain field in output parameters output after the corresponding interface nodes are called before or after the interface flow chart is obtained;
generating the test code includes: calling a program for judging the assertion after calling an interface node corresponding to a set expected value;
acquiring an initialization parameter configuration result after obtaining the interface flow chart, wherein the initialization parameter configuration result comprises a test starting interface node, and the initialization parameter configuration result is used for realizing parameter initialization when generating a test code, and comprises the following steps: initializing the traversal starting node as the test starting interface node, wherein the test starting interface node is any one interface node in the interface flow chart;
the initialization parameter configuration result also comprises a test depth value, and the configuration value of the test depth value is greater than or equal to the longest depth value of the flow chart taking the configured test starting interface node as a starting point; the depth configuration value is equal to the longest depth value of the flow chart taking the configured test starting interface node as a starting point, so that each branch path flow taking the test starting interface node as the starting point is completely traversed; when interaction exists between a plurality of branch paths and the interaction function between two branch paths is tested, the page depth needs to be set to be the sum of the depth values of the two branch flows.
CN201910108589.XA 2019-02-03 2019-02-03 Interface automation test method, test device, test equipment and storage medium Active CN109857667B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910108589.XA CN109857667B (en) 2019-02-03 2019-02-03 Interface automation test method, test device, test equipment and storage medium
PCT/CN2019/118701 WO2020155778A1 (en) 2019-02-03 2019-11-15 Interface automation test method, test apparatus, test device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910108589.XA CN109857667B (en) 2019-02-03 2019-02-03 Interface automation test method, test device, test equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109857667A CN109857667A (en) 2019-06-07
CN109857667B true CN109857667B (en) 2021-10-08

Family

ID=66897663

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910108589.XA Active CN109857667B (en) 2019-02-03 2019-02-03 Interface automation test method, test device, test equipment and storage medium

Country Status (2)

Country Link
CN (1) CN109857667B (en)
WO (1) WO2020155778A1 (en)

Families Citing this family (38)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857667B (en) * 2019-02-03 2021-10-08 苏州市龙测智能科技有限公司 Interface automation test method, test device, test equipment and storage medium
CN110297632A (en) * 2019-06-12 2019-10-01 百度在线网络技术(北京)有限公司 Code generating method and device
CN110347590A (en) * 2019-06-18 2019-10-18 平安普惠企业管理有限公司 The interface testing control method and device of operation system
CN110224870B (en) * 2019-06-19 2023-03-24 腾讯云计算(北京)有限责任公司 Interface monitoring method and device, computing equipment and storage medium
CN110502429B (en) * 2019-07-10 2023-04-25 平安普惠企业管理有限公司 Management method, device, equipment and storage medium of test system
CN110489106A (en) * 2019-07-22 2019-11-22 北京字节跳动网络技术有限公司 A kind of generation method, device, medium and the electronic equipment of project initial code
CN110597730B (en) * 2019-09-20 2023-08-22 中国工商银行股份有限公司 Automatic test case generation method and system based on scene method
CN110879781B (en) * 2019-11-06 2023-10-03 北京奇艺世纪科技有限公司 Program debugging method, device, electronic equipment and computer readable storage medium
CN110908920A (en) * 2019-12-03 2020-03-24 浪潮商用机器有限公司 Interface function testing method and device and related components
CN112905441A (en) * 2019-12-04 2021-06-04 阿里巴巴集团控股有限公司 Test case generation method, test method, device and equipment
CN111176992B (en) * 2019-12-24 2023-06-06 平安国际智慧城市科技股份有限公司 Flow engine testing method and device, computer equipment and storage medium
CN111797152B (en) * 2020-06-23 2024-03-19 北京自如信息科技有限公司 Data scene generation method and device and computer equipment
CN111881025B (en) * 2020-07-20 2023-08-04 中国工商银行股份有限公司 Automatic test task scheduling method, device and system
CN111897739B (en) * 2020-08-21 2022-04-05 四川长虹电器股份有限公司 Test case generation method based on optimized depth-first algorithm
CN112162915A (en) * 2020-08-27 2021-01-01 杭州大搜车汽车服务有限公司 Test data generation method, device, equipment and storage medium
CN112015661B (en) * 2020-09-08 2023-10-03 南京云柜网络科技有限公司 Software testing method and device
CN112148601A (en) * 2020-09-16 2020-12-29 京东数字科技控股股份有限公司 Interface testing method and device, electronic equipment and storage medium
CN112052182A (en) * 2020-09-27 2020-12-08 平安信托有限责任公司 Interface automation test method and device, computer equipment and storage medium
CN112416763A (en) * 2020-11-17 2021-02-26 杭州安恒信息技术股份有限公司 Method, device and equipment for automatically testing interface and storage medium
CN112561245A (en) * 2020-11-27 2021-03-26 中广核工程有限公司 Collaborative management method and device, computer equipment and storage medium
CN112559356A (en) * 2020-12-18 2021-03-26 杭州兑吧网络科技有限公司 Automatic software testing method and system
CN112559368A (en) * 2020-12-23 2021-03-26 马上消费金融股份有限公司 Interface automation test method and its use case generation method, equipment and storage medium
CN112685297B (en) * 2020-12-25 2022-11-29 科讯嘉联信息技术有限公司 Automatic testing method for telephone service robot dialect process
CN112882930B (en) * 2021-02-04 2023-09-26 网易(杭州)网络有限公司 Automatic test method and device, storage medium and electronic equipment
CN112988132B (en) * 2021-02-25 2021-12-21 平安科技(深圳)有限公司 Automatic generation method and device of data interface, computer equipment and storage medium
CN113326184B (en) * 2021-05-11 2022-05-17 前海飞算云智软件科技(深圳)有限公司 Interface testing method and device, storage medium and electronic equipment
CN113360300B (en) * 2021-06-29 2023-10-24 北京思普艾斯科技有限公司 Interface call link generation method, device, equipment and readable storage medium
CN113392026B (en) * 2021-07-07 2023-12-19 北京智慧星光信息技术有限公司 Interface automatic test method, system, electronic equipment and storage medium
CN113626326B (en) * 2021-08-09 2022-02-11 三峡高科信息技术有限责任公司 Dragging type zero code front end automatic test system based on image recognition
CN113760759A (en) * 2021-09-02 2021-12-07 广东睿住智能科技有限公司 Debugging method, debugging device, electronic device, and storage medium
CN113641747B (en) * 2021-10-15 2022-03-18 北京新氧科技有限公司 Method, device and system for accessing postman tool to database
CN113791984B (en) * 2021-10-28 2023-06-09 建信金融科技有限责任公司 Automatic interface testing method and device
CN113836045A (en) * 2021-11-29 2021-12-24 深圳市明源云链互联网科技有限公司 Logic generation method and device for interface automation assertion and storage medium
CN114168486A (en) * 2021-12-27 2022-03-11 深圳前海微众银行股份有限公司 Interface automation test method, device, medium, device, and program
CN115391231B (en) * 2022-10-26 2023-02-07 江苏北弓智能科技有限公司 Automatic interface testing method
CN115629990B (en) * 2022-11-15 2023-04-07 四川无限智达科技有限公司 Service testing method and device, electronic equipment and storage medium
CN117130946B (en) * 2023-10-27 2024-01-26 北京世冠金洋科技发展有限公司 Test scene generation method and device, electronic equipment and readable storage medium
CN117421253B (en) * 2023-12-19 2024-04-02 深圳市智慧城市科技发展集团有限公司 Interface security test method, device, equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528418A (en) * 2016-10-28 2017-03-22 广东浪潮大数据研究有限公司 Test method and device
CN107608882A (en) * 2017-09-08 2018-01-19 天津津航计算技术研究所 A kind of software test case automatic generating method

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5414836A (en) * 1993-09-29 1995-05-09 International Business Machines Corporation Software testing system that employs a graphical interface to generate test cases configured as hybrid tree structures
CN101471826B (en) * 2007-12-27 2012-12-12 华为技术有限公司 Test method and device for command line interface
CN102915242B (en) * 2012-09-26 2016-01-13 北京广利核系统工程有限公司 A kind of method utilizing graphical operation code to programme
CN103235759B (en) * 2013-05-15 2018-03-09 百度在线网络技术(北京)有限公司 Method for generating test case and device
US20150286555A1 (en) * 2014-04-08 2015-10-08 M/S. Cigniti Technologies Limited System and method for converting the business processes to test-centric activity diagrams
CN106021111A (en) * 2016-05-30 2016-10-12 上海携程商务有限公司 Interface testing method and system
CN106776349B (en) * 2017-02-07 2020-01-03 武汉斗鱼网络科技有限公司 Method and system for setting interface detection flow
CN107066382B (en) * 2017-03-09 2021-01-26 北京航空航天大学 Model-based spacecraft system automatic testing method
CN107741911A (en) * 2017-11-01 2018-02-27 广州爱九游信息技术有限公司 Interface test method, device, client and computer-readable recording medium
US10162740B1 (en) * 2017-11-07 2018-12-25 Fmr Llc Automated intelligent execution of computer software test cases
CN108549605B (en) * 2018-04-13 2021-06-29 郑州云海信息技术有限公司 Automatic testing method
CN109857667B (en) * 2019-02-03 2021-10-08 苏州市龙测智能科技有限公司 Interface automation test method, test device, test equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528418A (en) * 2016-10-28 2017-03-22 广东浪潮大数据研究有限公司 Test method and device
CN107608882A (en) * 2017-09-08 2018-01-19 天津津航计算技术研究所 A kind of software test case automatic generating method

Also Published As

Publication number Publication date
CN109857667A (en) 2019-06-07
WO2020155778A1 (en) 2020-08-06

Similar Documents

Publication Publication Date Title
CN109857667B (en) Interface automation test method, test device, test equipment and storage medium
WO2020155777A1 (en) Ui automated function testing method, testing device, testing apparatus, and storage medium
KR102317535B1 (en) Methods and systems for implementing data tracking with software development kits
US8141043B2 (en) Automated business process testing that spans multiple platforms or applications
CN107908542B (en) Test case creating method and device, computer equipment and storage medium
CN107015804B (en) Method and system for rapidly developing project by configuring API
CN108197114B (en) Method and device for detecting table data, storage medium and electronic device
CN108874926A (en) Mass data inquiry method, device, computer equipment and storage medium
CN105373401A (en) Method and system for automatically releasing software package
CN107632827B (en) Method and device for generating installation package of application
CN110221968A (en) Method for testing software and Related product
CN109542412A (en) Interface message generation method, device, computer equipment and storage medium
CN111068328A (en) Game advertisement configuration table generation method, terminal device and medium
CN103246606A (en) Method and system for testing performances of ESB (enterprises service bus) platform
CN105117205A (en) Web page editing method and web page editing device
CN111881042A (en) Automatic test script generation method and device and electronic equipment
CN112905441A (en) Test case generation method, test method, device and equipment
CN111258567B (en) Service code development processing method and device
CN111580794A (en) Method and device for creating business document in business management system
CN111124936B (en) Building block type software testing method, testing device, testing equipment and storage medium
CN114936152A (en) Application testing method and device
CN106775629B (en) Search file generation method and device
CN111538606A (en) Method, device and equipment for testing and simulating Dubbo interface
CN117407049B (en) Application release arrangement method, device, equipment and storage medium
CN112835803B (en) Tool generation method, test data construction method, device, equipment and medium

Legal Events

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