CN112905461A - 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
CN112905461A
CN112905461A CN202110174904.6A CN202110174904A CN112905461A CN 112905461 A CN112905461 A CN 112905461A CN 202110174904 A CN202110174904 A CN 202110174904A CN 112905461 A CN112905461 A CN 112905461A
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.)
Granted
Application number
CN202110174904.6A
Other languages
Chinese (zh)
Other versions
CN112905461B (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

Images

Classifications

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides an automatic interface test case execution method and device, which belong to the field of data test and can be applied to the field of big data and the field of financial application development, and the method comprises the following steps: acquiring interface definition data of a case to be tested, and setting attributes of leaf nodes in a preset decision tree model according to the interface definition data to acquire decision tree data; generating case arrangement data of a 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 automatic data testing, can be applied to the field of big data and the field of financial application development, and particularly relates to an automatic interface test case execution method and device.
Background
With the complexity of the business of the internet industry, the execution of the automation case must support the case execution of various business scenarios to realize the verification of the business scenarios of the testers. However, in the existing automated testing industry, a complete design scheme is lacked, and the characteristics of high concurrency and high complexity of an application system are dynamically adapted through simple configuration, so that processing schemes of various testing scenes are performed.
The execution of the current automatic interface test case is mainly controlled by a coding mode, and meanwhile, a native testng bottom layer framework is adopted, so that the current complex service scene is difficult to adapt:
1. most of the existing automation tools are compiled through coding, and even if part of the tools store case data, the decoupling of cases and processes cannot be realized, so that the application service is changed, test cases need to be modified in batches, and the influence on the cases is large.
2. The concurrency, the serial and the interface aggregation are difficult to be dynamically controlled by codes, and automation similar to many case scenes is difficult to realize by a coding mode.
3. Once the service of the application service used in the current industrial automation test is changed, 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 can provide compilation of service scenes of testers through a configuration mode, reduce the use difficulty of the testers on tools, support the attribute functions of intelligently adapting concurrency, specific interface serial, case execution priority and the like of an application server to be tested, and finish automatic test adapting to all service scenes.
To achieve the above object, the present invention provides an automated interface test case executing method, which comprises: acquiring interface definition data of a case to be tested, and setting attributes of leaf nodes in a preset decision tree model according to the interface definition data to acquire decision tree data; generating case arrangement data of a 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 method for executing an automated interface test case, preferably, the method further includes: acquiring an execution result of each step of the business process in the execution process of the test case codes 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 method for executing an automated interface test case, preferably, the setting of the attribute of each leaf node in the preset decision tree model according to the interface definition includes: setting the attribute of the leaf node according to interface definition data corresponding to each interface by taking the leaf node as each interface in the interface definition; wherein the attributes comprise a control concurrency identification, a serial identification, a weight identification and an aggregation execution identification.
In the above method for executing an automated interface test case, preferably, generating case layout data of a decision tree structure by process layout according to a business process of a 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 elements; wherein the interface elements include execution priority, merge execution, singleton execution, and concurrency amount for concurrent execution.
In the above method for executing an automation interface test case, preferably, executing the automation interface test case by using the test case code and the identification information includes: when the leaf node contains a weight identifier, obtaining an execution sequence of each step interface of the to-be-tested case according to the weight identifier; and putting the execution sequence of each step interface of the case to be tested into a SortedMap, and carrying out priority sequencing on the interface execution sequence according to the key value.
In the above method for executing an automation interface test case, preferably, executing the automation interface test case by using the test case code and the identification information includes: when the leaf node contains the serial identification, putting the executing test case code into a blocking queue; removing the test case codes from the blocking queue after the test case codes execute all the interfaces or the test case codes execute and remove the interfaces corresponding to the serial identification; the queue capacity of the blocking queue is 1.
In the above method for executing an automation interface test case, preferably, executing the automation interface test case by using the test case code and the identification information includes: when the leaf node contains the concurrent identifier, 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 concurrent identifier; the queue capacity of the blocking queue is an integer greater than 1.
In the above method for executing an automation interface test case, preferably, executing the automation interface test case by using the test case code and the identification information includes: when the leaf node contains the aggregation execution identifier, putting the test case code of the interface corresponding to the 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 which need 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 a decision tree structure through flow arrangement according to the service 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 a test case code 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 used for executing the automatic interface test case through the test case code and the identification information.
In the above automatic interface test case execution apparatus, preferably, the apparatus further includes a comparison module, where the comparison module is configured to obtain an execution result of each step of a business process in an 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, wherein the processor implements the 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 invention has the beneficial technical effects that: the decision tree data structure is adopted for data analysis and case execution, and for high-concurrency case execution, the tool makes decisions through attributes of decision tree nodes to control case execution sequence, interface concurrency amount, interface serialization, aggregate execution of a certain interface related in a plurality of concurrency cases and the like; service processes and test cases are decoupled, when the case service processes are changed, only the process arrangement needs to be modified, and affected cases do not need to be modified in batch; the case supports automatic tests (api, rpc, http, socket and the like) of various interface types, and the flow layout process can insert query statements to assert the database data and can also insert database operation statements to manufacture corresponding scenes in the case execution process.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flowchart illustrating a method for executing an automation interface test case according to an embodiment of the present invention;
fig. 2 is a schematic diagram illustrating a definition process of interface elements in a case arrangement data generation process according to an embodiment of the present invention;
fig. 3 is a schematic view illustrating a process arrangement of scenes in case arrangement data according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating an execution of an aggregated case according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating a structure of case arrangement data in a shopping scenario according to an embodiment of the present invention;
FIG. 6 is a schematic diagram illustrating directed acyclic graph of decision tree transformation in an aggregation point setting process according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of an exemplary embodiment of an automated interface test case execution apparatus;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following detailed description of the embodiments of the present invention will be provided with reference to the drawings and examples, so that how to apply the technical means to solve the technical problems and achieve the technical effects can be fully understood and implemented. It should be noted that, unless otherwise specified, the embodiments and features of the embodiments of the present invention may be combined with each other, and the technical solutions formed are within the scope of the present invention.
Additionally, the steps illustrated in the flow charts 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 flow charts, in some cases, the steps illustrated or described may be performed in an order different than here.
Referring to fig. 1, an automated interface test case executing method provided by the present invention includes:
step S101: acquiring interface definition data of a case to be tested, and setting attributes of leaf nodes in a preset decision tree model according to the interface definition data to acquire decision tree data;
step S102: generating case arrangement data of a 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 codes 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, testers can complete case arrangement through the execution sequence of the automatic platform maintenance interface, and compile test cases through quoting process arrangement, and the test cases and the process arrangement are in one-way dependence, so that execution data among the cases cannot be influenced mutually. The platform uses a decision tree as a data structure, each leaf node is an interface, each interface can be configured with various attributes for controlling scenes such as concurrency, serialization, weighting, aggregation execution and the like, a user compares each step of a flow with an expected value when executing a case through the platform, and the case is executed to pass through if all the steps pass through.
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: setting the attribute of the leaf node according to interface definition data corresponding to each interface by taking the leaf node as each interface in the interface definition; wherein the attributes comprise a control concurrency identification, a serial identification, a weight identification and an aggregation execution identification. Further, referring to fig. 2, in an embodiment of the present invention, generating case arrangement data of a decision tree structure through process arrangement according to a business process of a case to be tested 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 elements; wherein the interface elements include execution priority, merge execution, singleton execution, and concurrency amount for concurrent execution.
In actual work, the process arrangement adopts a decision tree mode for storage, and each interface comprises 4 parts of interface elements for deciding the execution priority of the interface, whether to execute the interface in a combined mode, whether to execute the interface in a singleton mode and the concurrency of concurrent execution. Referring specifically to fig. 3, scenario 1: aggregation setting, wherein each case comprises a specific interface, and the interface needs to be executed together after N cases reach the node, such as timing task; in a scene 2, concurrent control is carried out, in the case, the concurrence of a certain interface exceeds the application bearing, and partial interfaces are queued for waiting; scene 3: serializing the mark, and only after the execution of case 1 is completed, other cases can be continuously executed; scene 4: executing weight setting, wherein the execution sequence of the weight control interfaces executed by the interfaces can be set in the same concurrent batch;
in the above embodiment, executing an automation interface test case by the test case code and the identification information includes: when the leaf node contains a weight identifier, obtaining an execution sequence of each step interface of the to-be-tested case according to the weight identifier; and putting the execution sequence of each step interface of the case to be tested into a SortedMap, and carrying out priority sequencing on the interface execution sequence according to the key value. Specifically, before executing the cases, the execution sequence of each step of interface of all the cases is put into a SortedMap, the key of the map is the execution sequence, the value is the set of all the interface cases with the execution sequence, and the smaller the key value, the higher the priority. When each step of interface of the case is executed, judging whether a key smaller than the execution sequence of the current interface exists in the SortedMap or not, and if so, sleeping; after the interface execution of each step of the case is finished, the case is removed from the set of the interface execution sequence corresponding to the SortedMap; if all elements in the set have been moved out, the set is moved out of the SortedMap and the sleeping case is awakened.
In the above embodiment, executing an automation interface test case by the test case code and the identification information includes: when the leaf node contains the serial identification, putting the executing test case code into a blocking queue; removing the test case codes from the blocking queue after the test case codes execute all the interfaces or the test case codes execute and remove the interfaces corresponding to the serial identification; the queue capacity of the blocking queue is 1. Specifically, a blocking queue is used, the capacity of the queue is set to be 1, the executing case is put into the queue, and when the case finishes executing all the interfaces or the case finishes executing the interface for identifying the de-serialization control, the case is removed from the queue. When a case already exists in the queue, a block occurs when the case is put in continuously, and the case in the queue must be waited for to be removed.
In the above embodiment, executing an automation interface test case by the test case code and the identification information includes: when the leaf node contains the concurrent identifier, 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 concurrent identifier; the queue capacity of the blocking queue is an integer greater than 1. Specifically, a blocking queue is used, the capacity of the queue is set, executing cases are placed in the queue, and each time a case completes execution of the interface, the case is removed from the queue. When the queue is full, the block occurs as cases continue to be put 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 automation interface test case through the test case code and the identification information includes:
step S401: when the leaf node contains the aggregation execution identifier, putting the test case code of the interface corresponding to the 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 which need to execute the interface to be in a waiting state in a locking mode according to the lock identification.
In actual work, cases needing to execute the interface are firstly put into a set, then the cases acquire locks, the cases which do not take the locks sleep, the cases which take the locks wait for 10s, the number of the cases in the set before and after waiting is compared, the interface is executed if the number of the cases is not changed, and the cases which do not take the locks and are sleeping are awakened after the execution is finished; when the interface is executed, the next batch of cases to execute 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 flow layout and data storage format shown in fig. 5, where white represents a test case, a representative interface with ground color, and the series connection of the interfaces constitutes the flow layout. Each interface contains an execution weight, a serialization flag, a concurrency weight, and an aggregation flag. Some scenes of case execution, such as batch processing, batch timing tasks, etc., need to set aggregation points to achieve that a plurality of cases are executed only once for a common interface, so that a decision tree is converted into a directed acyclic graph, as shown in fig. 6, when a case is executed, automatic test case codes are generated by using a velocity template through process arrangement, corresponding identifiers are generated automatically through the weight and execution mode set by the interface, and the case codes are loaded into a cache for subsequent test operation.
Referring to fig. 7, the present invention further provides an automatic interface test case executing apparatus, which includes a defining module, an arranging module, a code generating module, an identifying module, and an executing 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 a decision tree structure through flow arrangement according to the service 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 a test case code 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 used for executing the automatic interface test case through the test case code and the identification information.
In the above embodiment, the apparatus may further include 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 method and the device for executing the automatic interface test case solve the execution of various concurrent, serial and other case requirements in a complex business system, the automatic interface execution drive adopts a decision tree as a data structure, an internal node branch represents a flow arrangement, and an external node (leaf node) represents an execution case, so that the case traversal storage speed is high, the assembly of high-dimensional case data is supported, the case data and the flow arrangement are completely decoupled, the assembly of subsequent intelligent cases is facilitated, and the method and the device have the following advantages:
the decision tree data structure is adopted for data analysis and case execution, and for high-concurrency case execution, the tool makes decisions through attributes of decision tree nodes to control case execution sequence, interface concurrency amount, interface serialization, aggregate execution of a certain interface related in a plurality of concurrency cases and the like; service processes and test cases are decoupled, when the case service processes are changed, only the process arrangement needs to be modified, and affected cases do not need to be modified in batch; the case supports automatic tests (api, rpc, http, socket and the like) of various interface types, and the flow layout process can insert query statements to assert the database data and can also insert database operation statements to manufacture corresponding scenes in the case execution process.
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, wherein the processor implements the 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: communication module 110, input unit 120, audio processing unit 130, display 160, power supply 170. It is noted that the electronic device 600 does not necessarily include all of the components shown in FIG. 8; furthermore, the electronic device 600 may also comprise components not shown in fig. 8, which may be referred to in the prior art.
As shown in fig. 8, the central processor 100, sometimes referred to as a controller or operational control, may include a microprocessor or other processor device and/or logic device, the central processor 100 receiving input and controlling 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 relating to the failure may be stored, and a program for executing the information may be stored. And the central processing unit 100 may execute the program stored in the memory 140 to realize information storage or processing, etc.
The input unit 120 provides input to the cpu 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 to display an object to be displayed, such as an image or a character. The display may be, for example, an LCD display, but is not limited thereto.
The memory 140 may be a solid state memory such as Read Only Memory (ROM), Random Access Memory (RAM), a SIM card, or the like. There may also be a memory that holds information even when power is off, can be selectively erased, and is provided with more data, an example of which is sometimes called an EPROM or the like. The memory 140 may also be some other type of device. Memory 140 includes buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application/function storage section 142, and the application/function storage section 142 is used to store application programs and function programs or a flow for executing the operation of the electronic device 600 by the central processing unit 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 portion 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 application, address book application, etc.).
The communication module 110 is a transmitter/receiver 110 that transmits and receives signals via an antenna 111. The 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, 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 receive audio input from the microphone 132 to implement general telecommunications functions. Audio processor 130 may include any suitable buffers, decoders, amplifiers and so forth. In addition, an audio processor 130 is also coupled to the central processor 100, so that recording on the local can be enabled through a microphone 132, and so that sound stored on the local can be played through a speaker 131.
As will be appreciated by one skilled in the art, 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 flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (12)

1. An automated interface test case execution method, the method comprising:
acquiring interface definition data of a case to be tested, and setting attributes of leaf nodes in a preset decision tree model according to the interface definition data to acquire decision tree data;
generating case arrangement data of a 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 codes 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 pre-defined decision tree model according to the interface definition comprises: setting the attribute of the leaf node according to interface definition data corresponding to each interface by taking the leaf node as each interface in the interface definition; wherein the attributes comprise a control concurrency identification, a serial identification, a weight identification and an aggregation execution identification.
4. The automated interface test case execution method of claim 3, wherein generating case orchestration data of the decision tree structure by process orchestration according to the business processes of the cases to be tested comprises: defining interface elements of each interface through a decision tree structure; determining an execution flow of the test case code through the interface elements; wherein the interface elements include execution priority, merge execution, singleton execution, and concurrency amount for 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, obtaining an execution sequence of each step interface of the to-be-tested case according to the weight identifier;
and putting the execution sequence of each step interface of the case to be tested into a SortedMap, and carrying out priority sequencing on the interface execution sequence 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:
when the leaf node contains the serial identification, putting the executing test case code into a blocking queue;
removing the test case codes from the blocking queue after the test case codes execute all the interfaces or the test case codes execute and remove the interfaces corresponding to the serial identification;
the queue capacity of the blocking queue is 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 the concurrent identifier, 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 concurrent identifier;
the queue capacity of the blocking queue is 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 aggregation execution identifier, putting the test case code of the interface corresponding to the 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 which need 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 a decision tree structure through flow arrangement according to the service 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 a test case code 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 used for executing the automatic interface test case through the test case code and the identification information.
10. The automated interface test case execution apparatus of claim 9, further comprising a comparison module, the comparison module configured to obtain execution results for each step of a business process during execution of the test case codes 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, wherein the processor implements the method of any of claims 1 to 8 when executing the computer program.
12. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program for executing 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 true CN112905461A (en) 2021-06-04
CN112905461B 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)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113821441A (en) * 2021-09-29 2021-12-21 平安银行股份有限公司 Execution method, device, equipment and storage medium based on cucumber test case
CN114528203A (en) * 2022-01-07 2022-05-24 马上消费金融股份有限公司 Voice response system test method and device, electronic equipment and storage medium

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

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113821441A (en) * 2021-09-29 2021-12-21 平安银行股份有限公司 Execution method, device, equipment and storage medium based on cucumber test case
CN113821441B (en) * 2021-09-29 2023-10-13 平安银行股份有限公司 Execution method, device, equipment and storage medium based on document test case
CN114528203A (en) * 2022-01-07 2022-05-24 马上消费金融股份有限公司 Voice response system test method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112905461B (en) 2024-03-15

Similar Documents

Publication Publication Date Title
US9189270B2 (en) Realizing jumps in an executing process instance
CN112783793B (en) Automatic interface test system and method
CN112905459B (en) Service interface testing method and device, electronic equipment and storage medium
CN112905461A (en) Method and device for executing automatic interface test case
CN111797015B (en) Dynamic byte code based test method and device
CN111967628B (en) Order service method and system
CN113051163A (en) Unit testing method, unit testing device, electronic equipment and storage medium
CN110399089B (en) Data storage method, device, equipment and medium
CN110059002A (en) Generation method, test equipment, storage medium and the device of test data
CN109932588B (en) Avionics equipment verification test engine
CN114510425A (en) Test case generation method and device
CN110515833A (en) A kind of method of software test, equipment and readable medium
CN113095782A (en) Automatic approval decision-making method and device
CN111782204A (en) Batch scheduling editing method and device
CN116150029A (en) Automatic overdue batch testing method and device for loan system
CN112860585B (en) Test script assertion generation method and device
CN114676113A (en) Heterogeneous database migration method and system based on task decomposition
CN111400281B (en) GIS data quality inspection and storage method for OSS object storage
CN113419957A (en) Rule-based big data offline batch processing performance capacity scanning method and device
CN113239119A (en) Data synchronization method, device and storage medium
CN114647588A (en) Interface test method and device
CN113791984A (en) Automatic interface testing method and device
CN111782641A (en) Data error repairing method and system
CN110674119A (en) Data processing method, system and computer readable storage medium
CN113377677B (en) Unit testing 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