CN112905461B - Method and device for executing automatic interface test case - Google Patents

Method and device for executing automatic interface test case Download PDF

Info

Publication number
CN112905461B
CN112905461B CN202110174904.6A CN202110174904A CN112905461B CN 112905461 B CN112905461 B CN 112905461B CN 202110174904 A CN202110174904 A CN 202110174904A CN 112905461 B CN112905461 B CN 112905461B
Authority
CN
China
Prior art keywords
case
test case
interface
execution
data
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
CN202110174904.6A
Other languages
Chinese (zh)
Other versions
CN112905461A (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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202110174904.6A priority Critical patent/CN112905461B/en
Publication of CN112905461A publication Critical patent/CN112905461A/en
Application granted granted Critical
Publication of CN112905461B publication Critical patent/CN112905461B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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

Abstract

The invention provides an automatic interface test case execution method and device, which belong to the field of data testing and can be applied to the field of big data and the field of financial application development, wherein the method comprises the following steps: acquiring interface definition data of a case to be tested, and setting the attribute of each leaf node in a preset decision tree model according to the interface definition data to acquire decision tree data; generating case arrangement data of the decision tree structure through process arrangement according to the business process of the case to be tested; obtaining case data of a case to be tested, and generating a test case code according to the case data and the case arrangement data; generating identification information of each interface corresponding to the test case code according to the case arrangement data and the decision tree data; and executing an automated interface test case through the test case code and the identification information.

Description

Method and device for executing automatic interface test case
Technical Field
The invention relates to the field of automated data testing, which can be applied to the field of big data and the field of financial application development, in particular to a method and a device for executing an automated interface test case.
Background
With the complexity of internet industry business, the execution of automated cases must support the execution of cases of various business scenarios to enable the verification of tester business scenarios. However, in the current automatic test industry, a complete design scheme is lacking, and the characteristics of high concurrency and high complexity of an application system and the processing schemes of various test scenes are dynamically adapted through simple configuration.
The execution of the current automatic interface test case is mainly controlled by an encoding mode, and meanwhile, a native testng bottom layer architecture is adopted, so that the current complex service scene is difficult to adapt:
1. at present, most of automatic tools are written through codes, even if part of tools store case data, decoupling of cases and processes cannot be achieved, application business is changed, test cases need to be modified in batches, and the influence on the cases is large.
2. It is difficult to dynamically control concurrency, control serialization, control interface aggregation, etc. by code, and automation is difficult to achieve in many case-like scenarios if encoded.
3. In the current industry, once the service changes, all test codes need to be modified and debugged, and the maintenance cost is high.
Disclosure of Invention
The invention aims to provide an automatic interface test case execution method and device, which provide the programming of service scenes of testers in a configuration mode, reduce the use difficulty of the testers to tools, support the intelligent adaptation of the concurrent property functions of an application server to be tested, serial specific interfaces, case execution priority sequences and the like, and complete the automatic test of adapting all the service scenes.
To achieve the above object, the present invention provides an automated interface test case execution method, which includes: acquiring interface definition data of a case to be tested, and setting the attribute of each leaf node in a preset decision tree model according to the interface definition data to acquire decision tree data; generating case arrangement data of the decision tree structure through process arrangement according to the business process of the case to be tested; obtaining case data of a case to be tested, and generating a test case code according to the case data and the case arrangement data; generating identification information of each interface corresponding to the test case code according to the case arrangement data and the decision tree data; and executing an automated interface test case through the test case code and the identification information.
In the above automated interface test case execution method, preferably, the method further comprises: acquiring an execution result of each step of the business process in the execution process of the test case code and the identification information; and comparing the execution result with a preset threshold value, and acquiring the execution result of the case to be tested according to the comparison result.
In the above automated interface test case execution method, preferably, setting the attribute of each leaf node in the preset decision tree model according to the interface definition includes: the leaf node is used as each interface in the interface definition, and the attribute of the leaf node is set according to the interface definition data corresponding to each interface; wherein the attributes include control concurrency identification, serial identification, weight identification and aggregate execution identification.
In the above automated interface test case execution method, preferably, generating the case layout data of the decision tree structure by flow layout according to the business flow of the case to be tested includes: defining interface elements of each interface through a decision tree structure; determining an execution flow of the test case code through the interface element; the interface element comprises concurrent quantity of execution priority, combined execution, single-instance execution and concurrent execution.
In the above automated interface test case execution method, preferably, executing the automated interface test case by the test case code and the identification information includes: when the leaf node contains a weight identifier, acquiring an execution sequence of each step of interface of the case to be tested according to the weight identifier; and placing the execution sequence of each step of interface of the case to be tested into a SortedMap, and sequencing the execution sequence of the interface according to the key value.
In the above automated interface test case execution method, preferably, executing the automated interface test case by the test case code and the identification information includes: placing the executing test case code into a blocking queue when the leaf node contains a serial identification; removing the test case code from the blocking queue after the test case code has executed all interfaces or the test case code has executed and the interface corresponding to the serial identifier is removed; the blocking queue has a queue capacity of 1.
In the above automated interface test case execution method, preferably, executing the automated interface test case by the test case code and the identification information includes: when the leaf node contains concurrency identification, putting the executing test case code into a blocking queue; removing the test case code from the blocking queue after the test case code executes the interface corresponding to the concurrency identifier; the blocking queue has a queue capacity of an integer greater than 1.
In the above automated interface test case execution method, preferably, executing the automated interface test case by the test case code and the identification information includes: when the leaf node contains the aggregate execution identifier, putting the test case code of the interface corresponding to the execution leaf node in the current flow into a preset set, and distributing a lock identifier for the test case code; and controlling the next batch of test case codes needing to execute the interface to be in a waiting state in a locking mode according to the lock identification.
The invention also provides an automatic interface test case execution device, which comprises a definition module, an arrangement module, a code generation module, an identification module and an execution module; the definition module is used for acquiring interface definition data of a case to be tested, and setting the attribute of each leaf node in a preset decision tree model according to the interface definition data to acquire decision tree data; the arrangement module is used for generating case arrangement data of the decision tree structure through flow arrangement according to the business flow of the case to be tested; the code generation module is used for obtaining case data of a case to be tested and generating test case codes according to the case data and the case arrangement data; the identification module is used for generating identification information of each interface corresponding to the test case code according to the case arrangement data and the decision tree data; the execution module is configured to execute an automated interface test case based on the test case code and the identification information.
In the automated interface test case execution device, preferably, the device further includes a comparison module, where the comparison module is configured to obtain an execution result of each step of the business process in the execution process of the test case code and the identification information; and comparing the execution result with a preset threshold value, and acquiring the execution result of the case to be tested according to the comparison result.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the above method when executing the computer program.
The present invention also provides a computer readable storage medium storing a computer program for executing the above method.
The beneficial technical effects of the invention are as follows: the method comprises the steps that a decision tree data structure is adopted to conduct data analysis and case execution, and for high concurrency case execution, a tool makes a decision through attributes of decision tree nodes to control case execution sequence, interface concurrency amount, interface serialization, aggregation execution on a certain interface involved in a plurality of concurrency cases and the like; decoupling the business flow and the test cases, when the case business flow changes, only the flow arrangement needs to be modified, and the affected cases do not need to be modified in batches; the case supports the automatic test of multiple interface types (api, rpc, http, socket, etc.), the process of arranging the flow can insert query sentences to assert the database data, can also insert database operation sentences, and can manufacture corresponding scenes in the process of executing the case.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of an automated interface test case execution method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a definition flow of interface elements in a case layout data generation process according to an embodiment of the present invention;
fig. 3 is a schematic view of a process layout of each scene in case layout data according to an embodiment of the present invention;
FIG. 4 is a flow chart illustrating an aggregate case execution according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a structure of case layout data in a shopping scenario according to an embodiment of the present invention;
FIG. 6 is a schematic diagram illustrating decision tree transformation in an aggregation point setup process according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an automated interface test case execution apparatus according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the invention.
Detailed Description
The following will describe embodiments of the present invention in detail with reference to the drawings and examples, thereby solving the technical problems by applying technical means to the present invention, and realizing the technical effects can be fully understood and implemented accordingly. It should be noted that, as long as no conflict is formed, each embodiment of the present invention and each feature of each embodiment may be combined with each other, and the formed technical solutions are all within the protection scope of the present invention.
Additionally, the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer executable instructions, and although a logical order is illustrated in the flowcharts, in some cases the steps illustrated or described may be performed in an order other than that herein.
Referring to fig. 1, the method for executing an automated interface test case provided by the present invention includes:
step S101: acquiring interface definition data of a case to be tested, and setting the attribute of each leaf node in a preset decision tree model according to the interface definition data to acquire decision tree data;
step S102: generating case arrangement data of the decision tree structure through process arrangement according to the business process of the case to be tested;
step S103: obtaining case data of a case to be tested, and generating a test case code according to the case data and the case arrangement data;
step S104: generating identification information of each interface corresponding to the test case code according to the case arrangement data and the decision tree data;
step S105: and executing an automated interface test case through the test case code and the identification information.
In another embodiment of the present invention, the method may further comprise: acquiring an execution result of each step of the business process in the execution process of the test case code and the identification information; and comparing the execution result with a preset threshold value, and acquiring the execution result of the case to be tested according to the comparison result. Therefore, a tester maintains the execution sequence of the interface through the automatic platform, completes the case arrangement, and carries out the writing of the test case by referring to the flow arrangement, and the test case and the flow arrangement are in one-way dependence, so that the execution data among the cases cannot be influenced mutually. The platform uses the decision tree as a data structure, each leaf node is an interface, each interface can be configured with multiple attributes for controlling concurrent, serial, weight, aggregate execution and other scenes, when a user executes a case through the platform, each step of the flow is compared with an expected value, and when the user completely passes the case, the user executes the case, and specific detailed implementations will be described one by one in the following embodiments, and will not be described in detail.
In an embodiment of the present invention, setting the attribute of each leaf node in the preset decision tree model according to the interface definition includes: the leaf node is used as each interface in the interface definition, and the attribute of the leaf node is set according to the interface definition data corresponding to each interface; wherein the attributes include control concurrency identification, serial identification, weight identification and aggregate execution identification. Further, referring to fig. 2, in an embodiment of the present invention, generating case layout data of a decision tree structure according to a business process of a case to be tested by process layout includes:
step S201: defining interface elements of each interface through a decision tree structure;
step S202: determining an execution flow of the test case code through the interface element; the interface element comprises concurrent quantity of execution priority, combined execution, single-instance execution and concurrent execution.
In actual work, the process arrangement is stored in a decision tree mode, and each interface comprises 4 parts of interface elements for deciding the concurrent quantity of the execution priority, the merging execution, the single-instance execution and the concurrent execution of the interface. Referring specifically to fig. 3, scenario 1: aggregation setting, wherein each case comprises a specific interface, and the interface needs N cases to be jointly executed after reaching the node, such as timing tasks; scenario 2, concurrency control, wherein in the case, the concurrency of a certain interface exceeds the application bearing, and part of interfaces are queued; scene 3: serializing marks, wherein other cases can be continuously executed only after the execution of the case 1 is completed; scene 4: the weight setting is executed, the same concurrent batch is adopted, and the execution sequence of the weight control interfaces executed by the interfaces can be set;
in the above embodiment, executing the automated interface test case through the test case code and the identification information comprises: when the leaf node contains a weight identifier, acquiring an execution sequence of each step of interface of the case to be tested according to the weight identifier; and placing the execution sequence of each step of interface of the case to be tested into a SortedMap, and sequencing the execution sequence of the interface according to the key value. Specifically, before executing the cases, the execution sequence of each step of interface of all cases is put into the SortedMap, the key of the map is the execution sequence, the value is the set of all the interfaces of the execution sequence, and the smaller the key value, the higher the priority. Judging whether keys exist in SortedMap in a smaller order than the current interface execution sequence when each step of interface of the case is executed, and if so, dormancy is performed; when each step of interface of the case is executed, the case is moved out of the set of the interface execution sequence corresponding to the SortedMap; if the elements in the collection have been moved out entirely, the collection is moved out of the SortedMap and awakening the case that is sleeping.
In the above embodiment, executing the automated interface test case through the test case code and the identification information comprises: placing the executing test case code into a blocking queue when the leaf node contains a serial identification; removing the test case code from the blocking queue after the test case code has executed all interfaces or the test case code has executed and the interface corresponding to the serial identifier is removed; the blocking queue has a queue capacity of 1. Specifically, using a blocking queue, setting the capacity of the queue to be 1, putting the executing case into the queue, and when all interfaces are executed by the case or the interface which is marked to be deserialized and controlled by the case execution is completed by the case, removing the case from the queue. When a case exists in the queue, the case continues to be put in and a blockage occurs, and the case in the queue must be waited for to be removed.
In the above embodiment, executing the automated interface test case through the test case code and the identification information comprises: when the leaf node contains concurrency identification, putting the executing test case code into a blocking queue; removing the test case code from the blocking queue after the test case code executes the interface corresponding to the concurrency identifier; the blocking queue has a queue capacity of an integer greater than 1. Specifically, using a blocking queue, setting the capacity of the queue, placing the executing case into the queue, and removing the case from the queue each time a case completes executing the interface. When the queue is full, blocking occurs as cases continue to be placed in, and other cases must be waited for to be removed from the queue.
As shown in fig. 4, in an embodiment of the present invention, executing an automated interface test case by the test case code and the identification information comprises:
step S401: when the leaf node contains the aggregate execution identifier, putting the test case code of the interface corresponding to the execution leaf node in the current flow into a preset set, and distributing a lock identifier for the test case code;
step S402: and controlling the next batch of test case codes needing to execute the interface to be in a waiting state in a locking mode according to the lock identification.
In actual work, firstly, cases requiring the interface to be executed are put into a set, then the cases acquire locks, cases not taking the locks are dormant, the cases taking the locks wait for 10s, the number of the cases in the set before and after waiting is compared with that of the cases in the set before and after waiting, the interface is executed if the number of the cases is unchanged, and the cases not taking the locks and being dormant are awakened after the execution is finished; when the interface is executed, the next case for executing the interface is controlled to be in a blocking state in a locking mode. Taking a shopping scenario as an example, reference may be made to the process layout and data storage format shown in fig. 5, wherein white represents a test case, a ground color represents an interface, and a concatenation of interfaces constitutes the process layout. Each interface contains an execution weight, a serialization identification, a concurrency weight, and an aggregation identification. The method comprises the steps of setting aggregation points in partial scenes of case execution, such as batch processing, batch timing tasks and the like, so that a plurality of cases are only executed once for a certain common interface, converting a decision tree into a directed acyclic graph, generating an automatic test case code by using a consistency template through flow arrangement when the cases are executed, automatically generating corresponding identifications through weights and execution modes set by the interfaces, loading the case code into a cache, and carrying out subsequent test operation, as shown in fig. 6.
Referring to fig. 7, the present invention further provides an automated interface test case execution device, where the device includes a definition module, an arrangement module, a code generation module, an identification module, and an execution module; the definition module is used for acquiring interface definition data of a case to be tested, and setting the attribute of each leaf node in a preset decision tree model according to the interface definition data to acquire decision tree data; the arrangement module is used for generating case arrangement data of the decision tree structure through flow arrangement according to the business flow of the case to be tested; the code generation module is used for obtaining case data of a case to be tested and generating test case codes according to the case data and the case arrangement data; the identification module is used for generating identification information of each interface corresponding to the test case code according to the case arrangement data and the decision tree data; the execution module is configured to execute an automated interface test case based on the test case code and the identification information.
In the foregoing embodiment, the apparatus may further include a comparison module, where the comparison module is configured to obtain an execution result of each step in the business process in the execution process of the test case code and the identification information; and comparing the execution result with a preset threshold value, and acquiring the execution result of the case to be tested according to the comparison result.
The method and the device for executing the test cases of the automatic interface solve the execution of the requirements of various concurrent cases, serial cases and the like in a complex service system, the automatic interface execution drive adopts a decision tree as a data structure, the branch of an internal node represents a flow arrangement, and the external node (leaf node) represents an execution case, so that the case traversing and storing speed is high, the assembly of high-dimensional case data is supported, the case data and the flow arrangement are completely decoupled, and the assembly of the follow-up intelligent case is convenient, and the method and the device have the advantages that:
the method comprises the steps that a decision tree data structure is adopted to conduct data analysis and case execution, and for high concurrency case execution, a tool makes a decision through attributes of decision tree nodes to control case execution sequence, interface concurrency amount, interface serialization, aggregation execution on a certain interface involved in a plurality of concurrency cases and the like; decoupling the business flow and the test cases, when the case business flow changes, only the flow arrangement needs to be modified, and the affected cases do not need to be modified in batches; the case supports the automatic test of multiple interface types (api, rpc, http, socket, etc.), the process of arranging the flow can insert query sentences to assert the database data, can also insert database operation sentences, and can manufacture corresponding scenes in the process of executing the case.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the above method when executing the computer program.
The present invention also provides a computer readable storage medium storing a computer program for executing the above method.
As shown in fig. 8, the electronic device 600 may further include: a communication module 110, an input unit 120, an audio processor 130, a display 160, a power supply 170. It is noted that the electronic device 600 need not include all of the components shown in fig. 8; in addition, the electronic device 600 may further include components not shown in fig. 8, to which reference is made to the related art.
As shown in fig. 8, the central processor 100, also sometimes referred to as a controller or operational control, may include a microprocessor or other processor device and/or logic device, which central processor 100 receives inputs and controls the operation of the various components of the electronic device 600.
The memory 140 may be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information about failure may be stored, and a program for executing the information may be stored. And the central processor 100 can execute the program stored in the memory 140 to realize information storage or processing, etc.
The input unit 120 provides an input to the central processor 100. The input unit 120 is, for example, a key or a touch input device. The power supply 170 is used to provide power to the electronic device 600. The display 160 is used for displaying display objects such as images and characters. The display may be, for example, but not limited to, an LCD display.
The memory 140 may be a solid state memory such as Read Only Memory (ROM), random Access Memory (RAM), SIM card, or the like. But also a memory which holds information even when powered down, can be selectively erased and provided with further data, an example of which is sometimes referred to as EPROM or the like. Memory 140 may also be some other type of device. Memory 140 includes a buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application/function storage 142, the application/function storage 142 for storing application programs and function programs or a flow for executing operations of the electronic device 600 by the central processor 100.
The memory 140 may also include a data store 143, the data store 143 for storing data, such as contacts, digital data, pictures, sounds, and/or any other data used by the electronic device. The driver storage 144 of the memory 140 may include various drivers of the electronic device for communication functions and/or for performing other functions of the electronic device (e.g., messaging applications, address book applications, etc.).
The communication module 110 is a transmitter/receiver 110 that transmits and receives signals via an antenna 111. A communication module (transmitter/receiver) 110 is coupled to the central processor 100 to provide an input signal and receive an output signal, 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 110, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, etc., may be provided in the same electronic device. The communication module (transmitter/receiver) 110 is also coupled to a speaker 131 and a microphone 132 via an audio processor 130 to provide audio output via the speaker 131 and to receive audio input from the microphone 132 to implement usual telecommunication functions. The audio processor 130 may include any suitable buffers, decoders, amplifiers and so forth. In addition, the audio processor 130 is also coupled to the central processor 100 so that sound can be recorded locally through the microphone 132 and so that sound stored locally can be played through the speaker 131.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, 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 (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The foregoing description of the embodiments has been provided for the purpose of illustrating the general principles of the invention, and is not meant to limit the scope of the invention, but to limit the invention to the particular embodiments, and any modifications, equivalents, improvements, etc. that fall within the spirit and principles of the invention are intended to be included within the scope of the invention.

Claims (12)

1. A method of automated interface test case execution, the method comprising:
acquiring interface definition data of a case to be tested, and setting the attribute of each leaf node in a preset decision tree model according to the interface definition data to acquire decision tree data;
generating case arrangement data of the decision tree structure through process arrangement according to the business process of the case to be tested;
obtaining case data of a case to be tested, and generating a test case code according to the case data and the case arrangement data;
generating identification information of each interface corresponding to the test case code according to the case arrangement data and the decision tree data;
and executing an automated interface test case through the test case code and the identification information.
2. The automated interface test case execution method of claim 1, further comprising:
acquiring an execution result of each step of the business process in the execution process of the test case code and the identification information;
and comparing the execution result with a preset threshold value, and acquiring the execution result of the case to be tested according to the comparison result.
3. The automated interface test case execution method of claim 1, wherein setting attributes of each leaf node in the preset decision tree model according to the interface definition comprises: the leaf node is used as each interface in the interface definition, and the attribute of the leaf node is set according to the interface definition data corresponding to each interface; wherein the attributes include control concurrency identification, serial identification, weight identification and aggregate execution identification.
4. The automated interface test case execution method of claim 3, wherein generating the case layout data of the decision tree structure by flow layout according to the business flow of the case under test comprises: defining interface elements of each interface through a decision tree structure; determining an execution flow of the test case code through the interface element; the interface element comprises concurrent quantity of execution priority, combined execution, single-instance execution and concurrent execution.
5. The automated interface test case execution method of claim 4, wherein executing the automated interface test case via the test case code and the identification information comprises:
when the leaf node contains a weight identifier, acquiring an execution sequence of each step of interface of the case to be tested according to the weight identifier;
and placing the execution sequence of each step of interface of the case to be tested into a SortedMap, and sequencing the execution sequence of the interface according to the key value.
6. The automated interface test case execution method of claim 4, wherein executing the automated interface test case via the test case code and the identification information comprises:
placing the executing test case code into a blocking queue when the leaf node contains a serial identification;
removing the test case code from the blocking queue after the test case code has executed all interfaces or the test case code has executed and the interface corresponding to the serial identifier is removed;
the blocking queue has a queue capacity of 1.
7. The automated interface test case execution method of claim 4, wherein executing the automated interface test case via the test case code and the identification information comprises:
when the leaf node contains concurrency identification, putting the executing test case code into a blocking queue;
removing the test case code from the blocking queue after the test case code executes the interface corresponding to the concurrency identifier;
the blocking queue has a queue capacity of an integer greater than 1.
8. The automated interface test case execution method of claim 4, wherein executing the automated interface test case via the test case code and the identification information comprises:
when the leaf node contains the aggregate execution identifier, putting the test case code of the interface corresponding to the execution leaf node in the current flow into a preset set, and distributing a lock identifier for the test case code;
and controlling the next batch of test case codes needing to execute the interface to be in a waiting state in a locking mode according to the lock identification.
9. An automatic interface test case execution device is characterized by comprising a definition module, an arrangement module, a code generation module, an identification module and an execution module;
the definition module is used for acquiring interface definition data of a case to be tested, and setting the attribute of each leaf node in a preset decision tree model according to the interface definition data to acquire decision tree data;
the arrangement module is used for generating case arrangement data of the decision tree structure through flow arrangement according to the business flow of the case to be tested;
the code generation module is used for obtaining case data of a case to be tested and generating test case codes according to the case data and the case arrangement data;
the identification module is used for generating identification information of each interface corresponding to the test case code according to the case arrangement data and the decision tree data;
the execution module is configured to execute an automated interface test case based on the test case code and the identification information.
10. The automated interface test case execution apparatus of claim 9, further comprising a comparison module for obtaining results of execution of each step of a business process during execution of the test case code and the identification information; and comparing the execution result with a preset threshold value, and acquiring the execution result of the case to be tested according to the comparison result.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any of claims 1 to 8 when executing the computer program.
12. A computer readable storage medium storing a computer program/instruction, which when executed by a processor performs the steps of the method of any one of claims 1 to 8.
CN202110174904.6A 2021-02-09 2021-02-09 Method and device for executing automatic interface test case Active CN112905461B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110174904.6A CN112905461B (en) 2021-02-09 2021-02-09 Method and device for executing automatic interface test case

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110174904.6A CN112905461B (en) 2021-02-09 2021-02-09 Method and device for executing automatic interface test case

Publications (2)

Publication Number Publication Date
CN112905461A CN112905461A (en) 2021-06-04
CN112905461B true CN112905461B (en) 2024-03-15

Family

ID=76122826

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110174904.6A Active CN112905461B (en) 2021-02-09 2021-02-09 Method and device for executing automatic interface test case

Country Status (1)

Country Link
CN (1) CN112905461B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113821441B (en) * 2021-09-29 2023-10-13 平安银行股份有限公司 Execution method, device, equipment and storage medium based on document test case

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109669855A (en) * 2018-10-26 2019-04-23 上海维信荟智金融科技有限公司 Automated testing method and system based on analog interface
CN111143228A (en) * 2019-12-31 2020-05-12 中国银行股份有限公司 Test code generation method and device based on decision table method
CN111367685A (en) * 2020-02-28 2020-07-03 平安医疗健康管理股份有限公司 Interface calling method and device, computer 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 (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109669855A (en) * 2018-10-26 2019-04-23 上海维信荟智金融科技有限公司 Automated testing method and system based on analog interface
CN111143228A (en) * 2019-12-31 2020-05-12 中国银行股份有限公司 Test code generation method and device based on decision table method
CN111367685A (en) * 2020-02-28 2020-07-03 平安医疗健康管理股份有限公司 Interface calling method and device, computer equipment and storage medium
CN112162924A (en) * 2020-09-27 2021-01-01 平安信托有限责任公司 Interface automation test method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN112905461A (en) 2021-06-04

Similar Documents

Publication Publication Date Title
CN111796860B (en) Micro front end scheme implementation method and device
CN112783793B (en) Automatic interface test system and method
CN110399089B (en) Data storage method, device, equipment and medium
CN111797015B (en) Dynamic byte code based test method and device
CN112905461B (en) Method and device for executing automatic interface test case
CN114510425A (en) Test case generation method and device
CN113656432A (en) Data comparison method and device
CN111897738B (en) Automatic testing method and device based on atomic service
CN112800063A (en) Automatic label passing method and device based on data structure
CN113791984B (en) Automatic interface testing method and device
CN114968917A (en) Method and device for rapidly importing file data
CN113076262B (en) Webpage automatic testing method and device
CN113095782A (en) Automatic approval decision-making method and device
CN113392091A (en) Distributed cluster data migration method and device
CN111400281B (en) GIS data quality inspection and storage method for OSS object storage
CN114676113A (en) Heterogeneous database migration method and system based on task decomposition
CN113419957A (en) Rule-based big data offline batch processing performance capacity scanning method and device
CN113986759A (en) Business processing flow acquisition method, business architecture flow verification method and system
CN112860585A (en) Test script assertion generation method and device
CN112527329A (en) Mass production method and system of solid-state storage device, terminal device and storage medium
CN111444225B (en) Universal index analysis method and device
CN112905459B (en) Service interface testing method and device, electronic equipment and storage medium
CN110704051A (en) Unity interface data binding method
CN113516545B (en) Internal control compliance service management method and device
CN108628750B (en) Test code processing 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