CN114020604A - Workflow-based automatic testing method and device - Google Patents

Workflow-based automatic testing method and device Download PDF

Info

Publication number
CN114020604A
CN114020604A CN202111230612.6A CN202111230612A CN114020604A CN 114020604 A CN114020604 A CN 114020604A CN 202111230612 A CN202111230612 A CN 202111230612A CN 114020604 A CN114020604 A CN 114020604A
Authority
CN
China
Prior art keywords
workflow
case
node
execution
binary tree
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.)
Pending
Application number
CN202111230612.6A
Other languages
Chinese (zh)
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.)
Jinan Inspur Data Technology Co Ltd
Original Assignee
Jinan Inspur Data Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jinan Inspur Data Technology Co Ltd filed Critical Jinan Inspur Data Technology Co Ltd
Priority to CN202111230612.6A priority Critical patent/CN114020604A/en
Publication of CN114020604A publication Critical patent/CN114020604A/en
Pending legal-status Critical Current

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 discloses an automatic testing method and a device based on workflow, which take a precondition, a case execution and a postcondition as each individual case, and compile each case into the workflow according to case compiling specifications; the use case writing specification comprises a workflow dependency relationship configuration specification; scanning each workflow to construct a binary tree; each node on the binary tree corresponds to a workflow; and scanning the binary tree, and selecting corresponding workflows to sequentially execute based on the workflow dependency relationship to realize the execution of the test case. The invention redefines the scene of the automatic test, reconfigures the design of the original test case design and execution method based on the graph theory, can reduce the code repeatability through a good design mode, enables all cases to be reusable, does not need to be rewritten due to the dependency of preconditions and the like, has stronger maintainability, and is easier to control the strategy on the basis.

Description

Workflow-based automatic testing method and device
Technical Field
The invention relates to the field of automatic testing, in particular to an automatic testing method and device based on workflow.
Background
In the private cloud-oriented management software development process, the execution dependency of the functional test is strong, the current implementation scheme is a relatively basic implementation form, and the execution of the whole use case is completed in one test method, including the processing of various preconditions, the execution of the use case, the processing of postconditions and the like. Because of the dependency of use cases, a lot of repetitive work may be caused, for example, the processing of preconditions, which may belong to a single use case, may mostly depend on the basic operation of adding licenses. At present, the simple implementation only extracts the general codes and makes the general codes into a public method for calling, so that the efficiency of developing test cases, debugging efficiency and concurrent development capacity are restricted or interfered, thereby causing the waste of human resources and the difficulty in maintaining the codes.
Disclosure of Invention
In order to solve the problems, the invention provides an automatic testing method and device based on workflow, which can make all use cases reusable, do not need to be rewritten due to the dependency of preconditions and the like, have stronger maintainability and are easier to control based on the strategy.
In a first aspect, a technical solution of the present invention provides an automated testing method based on a workflow, including the following steps:
taking the preposed condition, the case execution and the postposed condition as each single case, and compiling each case into a workflow according to a case compiling specification; the use case writing specification comprises a workflow dependency relationship configuration specification;
scanning each workflow to construct a binary tree; each node on the binary tree corresponds to a workflow;
and scanning the binary tree, and selecting corresponding workflows to sequentially execute based on the workflow dependency relationship to realize the execution of the test case.
Further, when the use case is written as the workflow according to the workflow dependency configuration specification, the method specifically includes:
and configuring the dependency relationship of the workflow by means of annotation or configuration files.
Further, scanning each workflow to construct a binary tree specifically includes:
globally scanning the workflow, and constructing a binary tree by taking the current workflow as a root node;
and based on the workflow dependency relationship, taking the precondition workflow of the workflow corresponding to the root node as a left node of the root node, and taking the post-condition workflow of the workflow corresponding to the root node as a right node of the root node.
Further, the method comprises the following steps:
in the process of scanning each workflow to construct the binary tree, if the workflow corresponding to the precondition or the postcondition has been scanned to construct the binary tree, the constructed binary tree is directly adopted.
Further, selecting corresponding workflows to sequentially execute based on the workflow dependency relationship to implement the execution of the test case, specifically comprising:
and aiming at a certain test case, positioning a root node of the test case, sequentially executing each node on the left outermost path from the leftmost node of the root node until the root node is executed, and then sequentially executing each node on the right outermost path from the first right node of the root node until the rightmost node is executed.
Further, the method comprises the following steps:
selecting corresponding workflows to sequentially execute based on the workflow dependency relationship, and if a certain node is executed and error is reported, executing a right node of a right subtree of the error-reported node to perform environment cleaning and rollback; and if the cleaning fails, executing the global cleaning operation.
Furthermore, the use case writing specification also comprises an internal context parameter configuration specification and a global context parameter configuration specification;
creating a plurality of steps corresponding to the execution steps of the use case in the workflow written according to the use case writing specification, wherein each step is numbered or named;
when the workflow is executed, each step in the workflow uses the internal context to transmit data;
and after the execution of the workflow is finished, the execution data is stored to a corresponding position based on the global context parameters, and the execution data stored in the subsequent workflow is extracted based on the corresponding global context parameters.
Further, the method comprises the following steps:
and executing a waiting mechanism of the workflow for the step of which the execution time exceeds the threshold value.
Further, the case writing specification further comprises a case disassembling specification and other test case workflow specifications for multiplexing.
In a second aspect, the present invention provides a workflow-based automated testing apparatus, including,
a workflow compiling module: taking the preposed condition, the case execution and the postposed condition as each single case, and compiling each case into a workflow according to a case compiling specification; the use case writing specification comprises a workflow dependency relationship configuration specification;
a binary tree construction module: scanning each workflow to construct a binary tree; each node on the binary tree corresponds to a workflow;
an execution module: and scanning the binary tree, and selecting corresponding workflows to sequentially execute based on the workflow dependency relationship to realize the execution of the test case.
In a third aspect, a technical solution of the present invention further provides a terminal, including:
a memory for storing a workflow-based automated test program;
a processor for implementing the steps of the workflow-based automated testing method according to any one of the above when executing the workflow-based automated testing program.
In a fourth aspect, the present invention further provides a readable storage medium, where the readable storage medium stores a workflow-based automation test program, and the workflow-based automation test program, when executed by a processor, implements the steps of the workflow-based automation test method according to any one of the above items.
Compared with the prior art, the automatic testing method and device based on the workflow provided by the invention have the following beneficial effects: extracting 3 parts of a precondition, a use case execution and a postcondition, totally summarizing the parts into a single use case, writing and processing the execution of each use case by adopting the specification of a workflow, generating a binary tree of all test use cases through configuration and scanning, executing a path in a mode of traversing the tree from left to right, and covering all use cases through the mode. The invention redefines the scene of the automatic test, reconfigures the design of the original test case design and execution method based on the graph theory, can reduce the repetition degree of the code through a good design mode, ensures that the related test only focuses on the execution main steps of the case without focusing on other conditions, and has more concentrated writing and easier debugging of the test method, thereby improving the maintainability of the whole code. The use cases are independent relatively, and the writing time of the use cases can be shortened in a mode of manpower increase. The writing method based on the workflow is more flexible, the test logic can be executed in stages in steps, partial rollback operation can be well executed, time-consuming operation can release thread resources based on the workflow framework, concurrency is increased by means of polling operation of the framework, and more test cases are executed concurrently by fewer threads.
Drawings
For a clearer explanation of the embodiments or technical solutions of the prior art of the present application, the drawings needed for the description of the embodiments or prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic flow chart of an automated testing method based on a workflow according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a binary tree constructed according to an embodiment of the present invention.
Fig. 3 is a schematic structural diagram of an automated testing apparatus based on a workflow according to a second embodiment of the present invention.
Fig. 4 is a schematic structural diagram of a terminal according to a third embodiment of the present invention.
Detailed Description
The terms to which the present invention relates are explained below.
Workflow: a task execution process meets a certain process specification, has a context concept inside, is tentatively set as a local context and is distinguished from a global context.
A binary tree: the method is used for representing a certain complete use case, the left side node is a precondition, and the right side node is a postcondition.
Global context: for data sharing across workflows.
And annotating: particularly annotations in the Java language for special markup, similar to configuration files.
In order that those skilled in the art will better understand the disclosure, the following detailed description will be given with reference to the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the private cloud-oriented management software development process, the execution dependency of the functional test is strong, the current implementation scheme is a relatively basic implementation form, and the execution of the whole use case is completed in one test method, including the processing of various preconditions, the execution of the use case, the processing of postconditions and the like. Because of the dependency of use cases, a lot of repetitive work may be caused, for example, the processing of preconditions, which may belong to a single use case, may mostly depend on the basic operation of adding licenses. At present, the simple implementation only extracts the general codes and makes the general codes into a public method for calling, so that the efficiency of developing test cases, debugging efficiency and concurrent development capacity are restricted or interfered, thereby causing the waste of human resources and the difficulty in maintaining the codes.
Therefore, the invention provides an automatic test scheme based on workflow, which extracts 3 parts of a precondition, a case execution and a postcondition, and summarizes all the parts into a single case, wherein the execution of each case adopts the specification of the workflow to compile and process, a binary tree of all test cases is generated through configuration and scanning, a path is executed in a mode of traversing the tree from left to right, and all cases are covered in the mode. The scheme can reuse all the use cases, the re-writing is not needed due to the dependency of preconditions and the like, the maintainability is stronger, and the strategy is easier to control on the basis.
Example one
Fig. 1 is a schematic flow chart of an automated testing method based on workflow according to a first embodiment of the present invention, which includes the following steps.
S101, taking the precondition, the case execution and the postcondition as each single case, and compiling each case into a workflow according to a case compiling specification; the use case writing specification includes a workflow dependency configuration specification.
When writing the workflow, configuring the dependency relationship between the workflow and other workflows according to the workflow dependency relationship configuration specification, for example, a case needs to depend on a precondition and a postcondition, and when executing the workflow, the case needs to configure the dependency relationship between the precondition workflow and the postcondition workflow.
And in subsequent execution, invoking the workflows according to the dependency relationship to execute in sequence. In this embodiment, the workflow is specifically constructed as a binary tree, the binary tree is constructed according to the workflow dependency relationship, and corresponding nodes are selected to be sequentially executed according to the subsequent construction standard based on the binary tree.
S102, scanning each workflow to construct a binary tree; each node on the binary tree corresponds to a workflow.
During specific implementation, a binary tree is constructed based on the dependency relationship of the workflow, a certain workflow is taken as a root node, the precondition of the workflow is taken as a left node of the root node, and the postcondition of the workflow is taken as a right node of the root node.
S103, scanning the binary tree, and selecting corresponding workflows to sequentially execute based on the workflow dependency relationship to realize the execution of the test case.
When the test case is executed in step S103, corresponding workflows are selected and executed in sequence based on the workflow dependency relationship, that is, the workflows are called from left to right in sequence for execution according to the tree structure.
For further explanation of the present invention, the following provides a specific embodiment, which includes three parts of workflow writing, binary tree construction and test case execution, in combination with the above steps and based on the principle of the present invention.
Workflow compiling
A standard test case comprises three parts, namely a prepositive condition, a test step and a postpositive condition, wherein the test step is a test main body, in order to improve the test efficiency and facilitate maintenance, a tester can recognize and disassemble the three parts again after taking the test case, so that each part can realize independent functional test, and the three parts are respectively compiled into a workflow. And setting a disassembling case specification and multiplexing other test case workflow specifications in the case compiling specification, so that a tester can disassemble the test cases. Specifically, if the preconditions already have independent use cases and need to be tested separately, the preconditions only need to write a workflow according to the corresponding test case, and do not need to be included in the main workflow (i.e., the workflow of the test step) of the test case and the postconditions are treated the same. If the precondition and the postcondition have no independent case, the precondition and the postcondition are added as independent cases or are executed in a main workflow of the test case.
It should be noted that the preconditions and the postconditions are also cases that can implement functional tests independently, and the preconditions of one test case may be a test subject in another test case. Assuming function A, B, C is present, function B depends on A and C, and only 3 workflows need to be defined, implementing separate testing of A, B, C each, but the second workflow depends on the other two workflows.
Some workflows need to depend on other workflows, so corresponding dependency relationships need to be configured when the workflows are compiled, the use case compiling specification further comprises a workflow dependency relationship configuration specification, correspondingly, the use cases are compiled into the workflows according to the workflow dependency relationship configuration specification, and specifically, the dependency relationships of the workflows are configured in a mode of annotation or configuration files. It should be noted that a unique ID address is defined for each workflow for annotation or configuration file creation. For example, if the precondition of configuration B is A and the precondition is C, the write error will be terminated if the precondition is configured as A1 or A2.
When the workflow is written, a plurality of steps can be created in the workflow corresponding to the execution steps of the use case, and each step can be numbered or named, so that the problem of log printing and positioning is facilitated.
Data transmission is needed among all steps in the workflow, and when the workflow is executed, all steps in the workflow use internal context to transmit data, so that data calling among the steps is facilitated. Correspondingly, an internal context parameter configuration specification is set in the use case writing specification, and the internal context parameters of the workflow are written based on the internal context parameter configuration specification when the workflow is written.
Data also needs to be transferred between workflows with dependency relationships, for example, a precondition workflow needs to transfer execution data thereof to a use case execution workflow, so a global context parameter configuration specification is set in a use case writing specification, and when the workflow is written, if necessary, the global context parameters of the workflow are written based on the global context parameter configuration specification. It should be noted that the global context parameter defines a storage location of data after execution of the corresponding workflow is completed, and in addition, the data can be queried through a back-end software interface without defining as much as possible, thereby avoiding complexity. Therefore, after the execution of the workflow is finished, the execution data is saved to the corresponding position based on the global context parameters, and the subsequent workflow extracts the saved execution data based on the corresponding global context parameters.
For the waiting mechanism of the workflow executed by the step (namely the step executed for a long time) with the execution duration exceeding the threshold, the next step of the workflow framework loop is used for executing the next step by declaring the next step, and the current thread is released in the recirculation interval.
Binary tree construction
And scanning each workflow to construct a binary tree, wherein each node on the binary tree corresponds to one workflow. Some workflows have dependencies between them, so a binary tree is constructed from the dependencies of the workflows.
Specifically, the workflow is globally scanned, and a binary tree is constructed with the current workflow as a root node. And based on the workflow dependency relationship, taking the precondition workflow of the workflow corresponding to the root node as a left node of the root node, and taking the post-condition workflow of the workflow corresponding to the root node as a right node of the root node. Fig. 2 is a schematic diagram of a constructed binary tree.
It should be noted that the constructed binary tree is saved in time. In the process of constructing the binary tree by describing each workflow, if the workflow corresponding to the precondition or the postcondition is scanned to construct the binary tree, the constructed binary tree is directly adopted without secondary traversal scanning, and the overall scanning time is reduced.
The root node represents the test subject corresponding to the test case and corresponds to the ID of the relevant test case. A tree may contain left and right subtrees with left and right nodes, but only the left node of the left subtree is a precondition and the right node of the right subtree is a postcondition, and the use case uses the complete path that is only the leftmost node-the rightmost node.
(III) test case execution
And executing the test case according to the constructed binary tree, and selecting corresponding workflows to sequentially execute based on the workflow dependency relationship to realize the execution of the test case.
Specifically, for a certain test case, a root node of the test case is located, each node on the left outermost path is sequentially executed from the leftmost node of the root node until the root node is executed, and then each node on the right outermost path is sequentially executed from the first right node of the root node until the rightmost node is executed.
Taking FIG. 2 as an example, if a test case with D as the root node is executed, the execution path is A- > B- > D- > E- > G. In the current scenario, D is the execution subject of the test, and any subtree is also a complete test case, for example, ABC, B is the subject of the corresponding test case.
And selecting corresponding workflows to execute in sequence based on the workflow dependency relationship, if a certain node (workflow) reports errors in the execution process, marking the node as case execution failure, executing the right node of the right subtree of the error-reporting node to perform environment cleaning and rollback, and if the cleaning fails, executing global cleaning operation to ensure the normal execution of the next case.
Taking fig. 2 as an example, if a test case with D as a root node is executed, the execution path is a- > B- > D- > E- > G, if B fails, C is executed, and B also has a simple rollback operation inside.
In the automated testing method based on the workflow provided by the embodiment, 3 parts of the precondition, the case execution and the postcondition are extracted and all are summarized into the single case, the execution of each case is compiled and processed by adopting the specification of the workflow, a binary tree of all test cases is generated through configuration and scanning, a path is executed in a mode that the tree traverses from left to right, and all cases are covered in the mode. The invention redefines the scene of the automatic test, reconfigures the design of the original test case design and execution method based on the graph theory, can reduce the repetition degree of the code through a good design mode, ensures that the related test only focuses on the execution main steps of the case without focusing on other conditions, and has more concentrated writing and easier debugging of the test method, thereby improving the maintainability of the whole code. The use cases are independent relatively, and the writing time of the use cases can be shortened in a mode of manpower increase. The writing method based on the workflow is more flexible, the test logic can be executed in stages in steps, partial rollback operation can be well executed, time-consuming operation can release thread resources based on the workflow framework, concurrency is increased by means of polling operation of the framework, and more test cases are executed concurrently by fewer threads.
Example two
The second embodiment provides an automated testing apparatus based on workflow, which is used to implement the automated testing method based on workflow in the first embodiment.
Fig. 3 is a schematic structural diagram of an automated testing apparatus based on workflow according to a second embodiment, which includes the following functional modules.
A workflow compiling module: taking the preposed condition, the case execution and the postposed condition as each single case, and compiling each case into a workflow according to a case compiling specification; the use case writing specification includes a workflow dependency configuration specification.
A binary tree construction module: scanning each workflow to construct a binary tree; each node on the binary tree corresponds to a workflow.
An execution module: and scanning the binary tree, and selecting corresponding workflows to sequentially execute based on the workflow dependency relationship to realize the execution of the test case.
The workflow-based automatic testing apparatus of this embodiment is used to implement the aforementioned workflow-based automatic testing method, and therefore, the specific implementation of this apparatus can be seen from the foregoing description of the embodiment of the workflow-based automatic testing method, and therefore, the specific implementation of this apparatus can refer to the description of the corresponding embodiments of each part, and will not be further described herein.
In addition, since the workflow-based automatic testing apparatus of this embodiment is used to implement the aforementioned workflow-based automatic testing method, the role thereof corresponds to that of the above-mentioned method, and details thereof are not repeated here.
EXAMPLE III
Fig. 4 is a schematic structural diagram of a terminal device 400 according to an embodiment of the present invention, including: a processor 410, a memory 420, and a communication unit 430. The processor 410 is configured to implement the workflow-based automated test program stored in the memory 420 by:
taking the preposed condition, the case execution and the postposed condition as each single case, and compiling each case into a workflow according to a case compiling specification; the use case writing specification comprises a workflow dependency relationship configuration specification;
scanning each workflow to construct a binary tree; each node on the binary tree corresponds to a workflow;
and scanning the binary tree, and selecting corresponding workflows to sequentially execute based on the workflow dependency relationship to realize the execution of the test case.
The invention redefines the scene of the automatic test, reconfigures the design of the original test case design and execution method based on the graph theory, can reduce the repetition degree of the code through a good design mode, ensures that the related test only focuses on the execution main steps of the case without focusing on other conditions, and has more concentrated writing and easier debugging of the test method, thereby improving the maintainability of the whole code. The use cases are independent relatively, and the writing time of the use cases can be shortened in a mode of manpower increase. The writing method based on the workflow is more flexible, the test logic can be executed in stages in steps, partial rollback operation can be well executed, time-consuming operation can release thread resources based on the workflow framework, concurrency is increased by means of polling operation of the framework, and more test cases are executed concurrently by fewer threads.
The terminal apparatus 400 includes a processor 410, a memory 420, and a communication unit 430. The components communicate via one or more buses, and those skilled in the art will appreciate that the architecture of the servers shown in the figures is not intended to be limiting, and may be a bus architecture, a star architecture, a combination of more or less components than those shown, or a different arrangement of components.
The memory 420 may be used for storing instructions executed by the processor 410, and the memory 420 may be implemented by any type of volatile or non-volatile storage terminal or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The executable instructions in memory 420, when executed by processor 410, enable terminal 400 to perform some or all of the steps in the method embodiments described below.
The processor 410 is a control center of the storage terminal, connects various parts of the entire electronic terminal using various interfaces and lines, and performs various functions of the electronic terminal and/or processes data by operating or executing software programs and/or modules stored in the memory 420 and calling data stored in the memory. The processor may be composed of an Integrated Circuit (IC), for example, a single packaged IC, or a plurality of packaged ICs connected with the same or different functions. For example, the processor 410 may include only a Central Processing Unit (CPU). In the embodiment of the present invention, the CPU may be a single operation core, or may include multiple operation cores.
A communication unit 430, configured to establish a communication channel so that the storage terminal can communicate with other terminals. And receiving user data sent by other terminals or sending the user data to other terminals.
Example four
The present invention also provides a computer storage medium, wherein the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a Random Access Memory (RAM).
The computer storage medium stores a workflow-based automated test program that when executed by a processor performs the steps of:
taking the preposed condition, the case execution and the postposed condition as each single case, and compiling each case into a workflow according to a case compiling specification; the use case writing specification comprises a workflow dependency relationship configuration specification;
scanning each workflow to construct a binary tree; each node on the binary tree corresponds to a workflow;
and scanning the binary tree, and selecting corresponding workflows to sequentially execute based on the workflow dependency relationship to realize the execution of the test case.
The invention redefines the scene of the automatic test, reconfigures the design of the original test case design and execution method based on the graph theory, can reduce the repetition degree of the code through a good design mode, ensures that the related test only focuses on the execution main steps of the case without focusing on other conditions, and has more concentrated writing and easier debugging of the test method, thereby improving the maintainability of the whole code. The use cases are independent relatively, and the writing time of the use cases can be shortened in a mode of manpower increase. The writing method based on the workflow is more flexible, the test logic can be executed in stages in steps, partial rollback operation can be well executed, time-consuming operation can release thread resources based on the workflow framework, concurrency is increased by means of polling operation of the framework, and more test cases are executed concurrently by fewer threads.
Those skilled in the art will readily appreciate that the techniques of the embodiments of the present invention may be implemented as software plus a required general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present invention may be embodied in the form of a software product, where the computer software product is stored in a storage medium, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and the like, and the storage medium can store program codes, and includes instructions for enabling a computer terminal (which may be a personal computer, a server, or a second terminal, a network terminal, and the like) to perform all or part of the steps of the method in the embodiments of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The above disclosure is only for the preferred embodiments of the present invention, but the present invention is not limited thereto, and any non-inventive changes that can be made by those skilled in the art and several modifications and amendments made without departing from the principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. An automated testing method based on workflow is characterized by comprising the following steps:
taking the preposed condition, the case execution and the postposed condition as each single case, and compiling each case into a workflow according to a case compiling specification; the use case writing specification comprises a workflow dependency relationship configuration specification;
scanning each workflow to construct a binary tree; each node on the binary tree corresponds to a workflow;
and scanning the binary tree, and selecting corresponding workflows to sequentially execute based on the workflow dependency relationship to realize the execution of the test case.
2. The workflow-based automated testing method according to claim 1, wherein when writing a use case into a workflow according to a workflow dependency configuration specification, the method specifically comprises:
and configuring the dependency relationship of the workflow by means of annotation or configuration files.
3. The workflow-based automated testing method of claim 2, wherein scanning each workflow constructs a binary tree, specifically comprising:
globally scanning the workflow, and constructing a binary tree by taking the current workflow as a root node;
and based on the workflow dependency relationship, taking the precondition workflow of the workflow corresponding to the root node as a left node of the root node, and taking the post-condition workflow of the workflow corresponding to the root node as a right node of the root node.
4. The workflow-based automated testing method of claim 3, further comprising the steps of:
in the process of scanning each workflow to construct the binary tree, if the workflow corresponding to the precondition or the postcondition has been scanned to construct the binary tree, the constructed binary tree is directly adopted.
5. The workflow-based automated testing method according to claim 4, wherein selecting the corresponding workflows to sequentially execute based on the workflow dependency relationship to implement the execution of the test cases specifically comprises:
and aiming at a certain test case, positioning a root node of the test case, sequentially executing each node on the left outermost path from the leftmost node of the root node until the root node is executed, and then sequentially executing each node on the right outermost path from the first right node of the root node until the rightmost node is executed.
6. The workflow-based automated testing method of claim 5, further comprising the steps of:
selecting corresponding workflows to sequentially execute based on the workflow dependency relationship, and if a certain node is executed and error is reported, executing a right node of a right subtree of the error-reported node to perform environment cleaning and rollback; and if the cleaning fails, executing the global cleaning operation.
7. The workflow-based automated testing method of any one of claims 1 to 6 wherein the use-case authoring specification further comprises an internal context parameter configuration specification and a global context parameter configuration specification;
creating a plurality of steps corresponding to the execution steps of the use case in the workflow written according to the use case writing specification, wherein each step is numbered or named;
when the workflow is executed, each step in the workflow uses the internal context to transmit data;
and after the execution of the workflow is finished, the execution data is stored to a corresponding position based on the global context parameters, and the execution data stored in the subsequent workflow is extracted based on the corresponding global context parameters.
8. The workflow-based automated testing method of claim 7, further comprising the steps of:
and executing a waiting mechanism of the workflow for the step of which the execution time exceeds the threshold value.
9. The workflow-based automated testing method of claim 8 wherein the use case authoring specification further comprises disassembling the use case specification and reusing other test case workflow specifications.
10. An automatic testing device based on workflow is characterized by comprising,
a workflow compiling module: taking the preposed condition, the case execution and the postposed condition as each single case, and compiling each case into a workflow according to a case compiling specification; the use case writing specification comprises a workflow dependency relationship configuration specification;
a binary tree construction module: scanning each workflow to construct a binary tree; each node on the binary tree corresponds to a workflow;
an execution module: and scanning the binary tree, and selecting corresponding workflows to sequentially execute based on the workflow dependency relationship to realize the execution of the test case.
CN202111230612.6A 2021-10-22 2021-10-22 Workflow-based automatic testing method and device Pending CN114020604A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111230612.6A CN114020604A (en) 2021-10-22 2021-10-22 Workflow-based automatic testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111230612.6A CN114020604A (en) 2021-10-22 2021-10-22 Workflow-based automatic testing method and device

Publications (1)

Publication Number Publication Date
CN114020604A true CN114020604A (en) 2022-02-08

Family

ID=80056992

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111230612.6A Pending CN114020604A (en) 2021-10-22 2021-10-22 Workflow-based automatic testing method and device

Country Status (1)

Country Link
CN (1) CN114020604A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114968787A (en) * 2022-05-27 2022-08-30 中移互联网有限公司 Node relation-based test method and device and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114968787A (en) * 2022-05-27 2022-08-30 中移互联网有限公司 Node relation-based test method and device and electronic equipment
CN114968787B (en) * 2022-05-27 2023-09-19 中移互联网有限公司 Method and device for testing based on node relation and electronic equipment

Similar Documents

Publication Publication Date Title
Mateescu et al. Adaptation of service protocols using process algebra and on-the-fly reduction techniques
US6505342B1 (en) System and method for functional testing of distributed, component-based software
Garlan et al. Evolution styles: Foundations and tool support for software architecture evolution
CN108459962B (en) Code normalization detection method and device, terminal equipment and storage medium
US20090313335A1 (en) Managing Software Component Versions within a Service Oriented Architecture
CN103530225B (en) Automatization's compiler test method and realize automatization's compiler test platform of the method
CN106909510A (en) A kind of method and server for obtaining test case
CN105808266A (en) Code operation method and device
CN112214219A (en) Component processing method and device, server and storage medium
CN110543427B (en) Test case storage method and device, electronic equipment and storage medium
CN113050953A (en) Method, device and storage medium for generating code based on annotation
CN111399828A (en) Model-driven logic device modeling method and terminal
Tiwari et al. Reuse: reducing test effort
Popoola et al. EMG: A domain-specific transformation language for synthetic model generation
CN111767217A (en) JS unit test case generation method and device
CN103186463A (en) Method and system for determining testing range of software
CN114020604A (en) Workflow-based automatic testing method and device
Hue et al. USLTG: test case automatic generation by transforming use cases
Balogh et al. Workflow-driven tool integration using model transformations
Roychoudhury et al. Symbolic message sequence charts
WO2020000810A1 (en) Application component construction packaging method and device, and computer storage medium
Merayo et al. Passive testing of communicating systems with timeouts
Machado et al. Component-based integration testing from UML interaction diagrams
CN116185425B (en) Event flow arrangement method, device, equipment and medium based on node combination
Baker et al. Early UML model testing using TTCN-3 and the UML testing profile

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