CN112860584B - Workflow model-based testing method and device - Google Patents

Workflow model-based testing method and device Download PDF

Info

Publication number
CN112860584B
CN112860584B CN202110346229.0A CN202110346229A CN112860584B CN 112860584 B CN112860584 B CN 112860584B CN 202110346229 A CN202110346229 A CN 202110346229A CN 112860584 B CN112860584 B CN 112860584B
Authority
CN
China
Prior art keywords
test
workflow model
test script
script
final
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110346229.0A
Other languages
Chinese (zh)
Other versions
CN112860584A (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 CN202110346229.0A priority Critical patent/CN112860584B/en
Publication of CN112860584A publication Critical patent/CN112860584A/en
Application granted granted Critical
Publication of CN112860584B publication Critical patent/CN112860584B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • 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/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • 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 can be used in big data or other fields, and provides a testing method and a testing device based on a workflow model, wherein the testing method based on the workflow model comprises the following steps: translating the workflow model to be tested into an executable primary test script; adding test assertions in the test script to generate a final test script; and executing the final test script, and comparing the execution result with an expected value. According to the invention, by establishing the testing method for simulating the complex service scene by the workflow model, the workload of the testers for developing codes can be reduced, the testers can concentrate more efforts on the design of the test scene, and the service scene is optimized by modeling; meanwhile, the visualization of the test scene is improved, the circulation of data among services is facilitated to be observed, and the error service is conveniently checked and positioned. And the complete test case script is deployed to a server for automatic operation, so that the aim of automatic test is fulfilled, and the workload of manual test is greatly reduced.

Description

Workflow model-based testing method and device
Technical Field
The invention belongs to the technical field of big data, and particularly relates to a workflow model-based testing method and device.
Background
With the rapid development of various applications, the distributed platform service is widely applied in various applications. With this, testing of distributed platform services is also an ongoing challenge. In particular, to provide service reusability, a single service often performs a relatively independent function, while a complex business scenario often requires combining multiple services to perform. Therefore, the tester needs to design verification of various complex business scenarios in addition to the functional test of the single service. The traditional test and verification needs to manually call a plurality of services, and manually realize data transmission among the services, so that the test efficiency is low, the visibility is poor, and the service processing process and the data circulation process of the whole service flow cannot be observed from the whole. If one of the services has problems, the problem is checked with great time and effort, and the testing efficiency is low.
TestNG is a test tool commonly used by testers in the industry to perform distributed platform service testing that supports the use of programming to implement service invocation, input/output printing, test assertion determination, and various function uses, but is commonly used for single-body service testing.
Disclosure of Invention
The testing method and the testing device based on the workflow model provided by the invention realize a set of testing method for simulating complex service scenes by establishing the workflow model on the basis of not influencing the use of TestNG. The workload of the testers for developing codes can be reduced, the testers can concentrate more energy on the design of the test scene, and the business scene is optimized through modeling; meanwhile, the visualization of the test scene is improved, the circulation of data among services is facilitated to be observed, and the error service is conveniently checked and positioned. And the complete test case script is deployed to a server for automatic operation, so that the aim of automatic test is fulfilled, and the workload of manual test is greatly reduced.
In order to solve the technical problems, the invention provides the following technical scheme:
in a first aspect, the present invention provides a workflow model-based testing method, including:
Translating the workflow model to be tested into an executable primary test script;
Adding test assertions in the test script to generate a final test script;
and executing the final test script, and comparing an execution result with an expected value.
In one embodiment, translating the workflow model to be tested into the executable preliminary test script includes:
Translating the workflow model to be tested into a test form through an Apache POI;
And generating the preliminary test script according to the test table by using an input stream method and an output stream method.
In one embodiment, the workflow model-based testing method further includes:
and determining data transfer in the process of executing the final test script according to the test requirement.
In one embodiment, the executing the final test script and comparing the execution result with an expected value includes:
reading the test assertion by using an Apache POI according to the data transfer;
interpreting the test assertion to generate a final test script;
And executing the final test script, and comparing an execution result with an expected value by accessing a JDBC database.
In one embodiment, the workflow model-based testing method further includes: establishing the workflow model, wherein the workflow model structure comprises the following steps: sequential structure, parallel structure, conditional structure, and cyclic structure.
In a second aspect, the present invention provides a workflow model-based testing apparatus, including:
The model translation module is used for translating the workflow model to be tested into an executable primary test script;
conclusion an adding module, configured to add a test assertion in the test script, so as to generate a final test script;
and the script execution module is used for executing the final test script and comparing an execution result with an expected value.
In one embodiment, the model translation module comprises:
the test table generation unit is used for translating the workflow model to be tested into a test table through an Apache POI;
and the test script generating unit is used for generating the preliminary test script according to the test table by utilizing the input flow and the output flow device.
In one embodiment, the workflow model-based testing apparatus further comprises:
The data flow determining module is used for determining data flow in the process of executing the final test script according to the test requirement;
A workflow model building module, configured to build the workflow model, where the workflow model structure includes: sequential structure, parallel structure, conditional structure, and cyclic structure;
the script execution module includes:
Conclusion a reading unit, configured to read the test assertion using an Apache POI according to the data diversion;
a final script generation unit for interpreting the test assertion to generate a final test script;
and the result comparison unit is used for executing the final test script and comparing an execution result with an expected value by accessing the JDBC database.
In a third aspect, the invention provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor executing the steps of a workflow model based test method.
In a fourth aspect, the present invention provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of a workflow model-based testing method.
As can be seen from the above description, the workflow model-based testing method and device provided by the embodiments of the present invention first translate a workflow model to be tested into an executable primary test script; then, adding test assertions in the test script to generate a final test script; and finally executing the final test script, and comparing the execution result with an expected value. The invention realizes a set of test method for simulating complex service scene by establishing workflow model on the basis of not affecting the use of TestNG. By using the method, the workload of a tester for developing codes can be reduced, and the tester can concentrate more efforts on the design of the test scene and optimize the service scene through modeling; meanwhile, the visualization of the test scene is improved, the circulation of data among services is facilitated to be observed, and the error service is conveniently checked and positioned. And the complete test case script is deployed to a server for automatic operation, so that the aim of automatic test is fulfilled, and the workload of manual test is greatly reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a workflow model-based testing method according to an embodiment of the present invention;
FIG. 2 is a flowchart of step 100 in a workflow model-based testing method according to an embodiment of the present invention;
FIG. 3 is a second flow chart of a workflow model-based testing method according to an embodiment of the invention;
FIG. 4 is a flowchart of step 300 in a workflow model-based testing method according to an embodiment of the present invention;
FIG. 5 is a flowchart of a workflow model-based test method according to an embodiment of the present invention;
FIG. 6 is a flowchart of a workflow model-based testing method in an embodiment of the present invention;
FIG. 7 is a schematic diagram of a workflow model of a sequential structure in an embodiment of the invention;
FIG. 8 is a schematic diagram of a workflow model of a parallel architecture in an embodiment of the invention;
FIG. 9 is a schematic diagram of a workflow model of a conditional structure in an embodiment of the invention;
FIG. 10 is a schematic diagram of a workflow model of a loop structure in an embodiment of the invention;
FIG. 11 is a schematic illustration of Excel in the specific application example of the present invention;
FIG. 12 is a diagram showing the result of script execution in an embodiment of the present invention;
FIG. 13 is a block diagram of a workflow model-based testing apparatus in accordance with an embodiment of the present invention;
FIG. 14 is a block diagram illustrating the structure of a modular translation module 10 in accordance with an embodiment of the present invention;
FIG. 15 is a block diagram II of a workflow model-based testing apparatus in an embodiment of the invention;
FIG. 16 is a block diagram III of a workflow model-based testing apparatus in an embodiment of the invention;
FIG. 17 is a block diagram illustrating the configuration of script execution module 30 in an embodiment of the present invention;
Fig. 18 is a schematic structural diagram of an electronic device in an embodiment of the invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
It is noted that the terms "comprises" and "comprising," and any variations thereof, in the description and claims of the present application and in the foregoing figures, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other. The application will be described in detail below with reference to the drawings in connection with embodiments.
An embodiment of the present invention provides a specific implementation manner of a workflow model-based testing method, referring to fig. 1, the method specifically includes the following contents:
Step 100: and translating the workflow model to be tested into an executable primary test script.
Specifically, a test script template Excel of the service can be generated through an Apache POI; and generating JAVA scripts executed by the service through the input-output streaming technology of JAVA. It is understood that Workflow refers to "automation of a part or the whole of a business process in a computer application environment". Is an abstract and generalized description of workflow and business rules between its operational steps. In a computer, the workflow is part of a computer-supported collaborative work (CSCW). The latter is a popular study of how a community works cooperatively with the aid of a computer. The main problems that workflow mainly solves are: to achieve a certain business objective, a computer is used to automatically transfer documents, information, or tasks between multiple participants according to certain predetermined rules. The workflow concept originates from the field of production organization and office automation, is a concept provided for fixed program activities in daily work, and aims to improve work efficiency, better control process, enhance service to clients, effectively manage business processes and the like by decomposing work into well-defined tasks or roles, executing the tasks according to certain rules and processes and monitoring the tasks.
Step 200: and adding test assertions in the test script to generate a final test script.
Step 200, when implemented, adds test assertions based on test scripts according to test requirements. It will be appreciated that when writing code, some assumptions are made and assertions are used to capture these assumptions in the code. It is believed that the expression value is true at some particular point in the program, assertion verification can be enabled and disabled at any time, and thus assertion can be enabled at test time and disabled at deployment time. Also, after the program is put into operation, the end user can re-enable assertions when a problem is encountered. Using assertions can create more stable, better quality, and less error prone code. Assertions may be used when it is desired to interrupt the current operation when one value is FALSE. Unit testing must use assertions (Junit/JunitX). In addition to type checking and unit testing, assertions also provide an excellent way to determine whether various characteristics are maintained in a program. The use of assertions may further the design into contractual terms. Assertions can take two forms: 1.assert Expression1;2.assert Expression1:Expression2.
Step 300: and executing the final test script, and comparing an execution result with an expected value.
Specifically, the Apache POI is used for reading and interpreting the assertion data, accessing the database through JDBC, and automatically comparing whether the expected value and the database data are consistent.
It will be appreciated that JDBC refers to a Java database connection, (Java Database Connectivity, JDBC for short) is an application program interface in the Java language that is used to specify how a client program accesses a database, providing methods such as querying and updating data in the database, and is commonly referred to as a relational database. The JDBC API is mainly located in the java. Sql package in JDK (the extended content is then located in the java. Sql package), and mainly includes:
driverManager: is responsible for loading various different drivers and returning corresponding database connections (connections) to the caller according to different requests. Driver: the driver will load itself into the driversnager and process the corresponding request and return the corresponding database Connection (Connection). Connection: the database Connection is responsible for communicating with the databases, and SQL execution and transaction processing are performed in a specific Connection environment. A state may be generated to execute SQL. State: to execute SQL queries and updates (for static SQL statements and single execution). PreparedStatement: to execute SQL queries and updates containing dynamic parameters (compiled at the server side, allowing for repeated execution to improve efficiency). CallableStatement: to invoke a stored procedure in the database. SQLException: representing an exception (i.e., an error) occurring during the establishment and closure of database connections and the execution of SQL statements.
As can be seen from the above description, according to the workflow model-based testing method provided by the embodiment of the present invention, a workflow model to be tested is first translated into an executable primary test script; then, adding test assertions in the test script to generate a final test script; and finally executing the final test script, and comparing the execution result with an expected value. The invention realizes a set of test method for simulating complex service scene by establishing workflow model on the basis of not affecting the use of TestNG. By using the method, the workload of a tester for developing codes can be reduced, and the tester can concentrate more efforts on the design of the test scene and optimize the service scene through modeling; meanwhile, the visualization of the test scene is improved, the circulation of data among services is facilitated to be observed, and the error service is conveniently checked and positioned. And the complete test case script is deployed to a server for automatic operation, so that the aim of automatic test is fulfilled, and the workload of manual test is greatly reduced.
In one embodiment, referring to fig. 2, step 100 comprises:
step 101: translating the workflow model to be tested into a test form through an Apache POI;
step 102: and generating the preliminary test script according to the test table by using an input stream method and an output stream method.
In step 101 and step 102, microsoft Excel is operated through Apache POI, and a test script template Excel of the service is generated; and generating JAVA scripts executed by the service through the input-output streaming technology of JAVA. A stream is an abstract concept representing unstructured delivery of data. The input and output are performed in a streaming fashion, and the data is treated as unstructured endian or character sequences. The operation of retrieving data from the stream is referred to as an extraction operation, and the operation of adding data to the stream is referred to as an insertion operation. The stream used for input and output operations is called an IO stream. In short, the IO stream is input and output in a stream manner. In the IO stream, the input and output are divided into 4 steps: formatting/parsing, buffering, transcoding and delivery, in particular:
Formatting/parsing: bidirectional conversion is performed between an internal data representation (in bytes) and an external data representation (in characters). For example, an integer 10002 of 2 bytes, 5 characters are required for representation.
Buffering: for caching character sequences between format/parsing and delivery. For output, the shorter character sequences are formatted and not output on the fly, but are stored in a buffer, and are transferred to an external device after being accumulated to a certain scale. In contrast, a large amount of data read in from the external device is also placed in the buffer first, and then gradually fetched to complete the input. By default, the input and output of the IO stream are buffered, and the IO stream can also be operated in a non-buffering mode.
Transcoding: is the conversion of one character expression into another. If the character expression generated by formatting is different from the external character expression (at the time of output) or the external expression is different from the expression that the IO stream can parse (at the time of input), transcoding is necessary. Such as conversion between multi-byte encoding and wide character encoding. Transcoding is not required in most cases.
And (3) transmission: mainly with external devices. When outputting, the transmission is responsible for transmitting the formatted, buffered, i.e. code converted character sequence to the external equipment; when inputting, the external device is responsible for extracting data and providing character sequences for code conversion, buffering and analysis performed thereafter.
In one embodiment, referring to fig. 3, the workflow model-based testing method further includes:
Step 400: and determining data transfer in the process of executing the final test script according to the test requirement.
Specifically, define the data flow between services, the specific operations are: and the output of the previous service is written into the running result Excel through the Apache POI, and the next service reads the output result through the Apache POI to serve as the input of the next service.
In one embodiment, referring to fig. 4, step 300 comprises:
Step 301: reading the test assertion by using an Apache POI according to the data transfer;
step 302: interpreting the test assertion to generate a final test script;
Step 303: and executing the final test script, and comparing an execution result with an expected value by accessing a JDBC database.
In steps 301 to 303, test assertions are added on the basis of test scripts, and Apache POI is used for reading assertion data and interpreting the assertions, and a database is accessed through JDBC to automatically compare whether expected values are consistent with database data.
The Apache POI is an open source function library of the Apache software foundation, and provides APIs for Java programs to read and write files in Microsoft Office format. Classes commonly used by Apache POI include:
HSSF-provides the function of reading and writing Microsoft Excel XLS format files.
XSSF-provide the function of reading and writing Microsoft Excel OOXML XLSX format files.
HWPF-provide the function of reading and writing Microsoft Word DOC format files.
XWPF-provide the function of reading and writing Microsoft Word DOC2003 format files.
HSLF-provide the function of reading and writing Microsoft PowerPoint format files.
HDGF-provides the functionality to read Microsoft Visio format files.
HPBF-provide the function of reading Microsoft Publisher format files.
HSMF-provide the function of reading Microsoft Outlook format files.
In one embodiment, referring to fig. 5, the workflow model-based testing method further includes:
Step 500: and establishing the workflow model.
The workflow model structure comprises: sequential structure, parallel structure, conditional structure, and cyclic structure. Sequential structure: refers to a segment of the flow in which activities are initiated in a fixed order, primarily for expressing causal relationships between jobs. The services t1, t2, t3 are sequentially executed in a predetermined order.
Parallel structure: services t2 and t3 are executed in parallel, but they can be executed in any order, for which parallel routing two logical "gate" structures need to be built: branching from the relationship; merging with the relationship.
Conditional structure: services t2 and t3 are examples of conditional execution, i.e. after execution of service t1 either service t2 or service t3 is executed, here also two logical gate structures are used: or a relationship branch; or relational junction.
The circulation structure is as follows: it is sometimes necessary to repeatedly perform a certain service (e.g., t 2) a plurality of times (e.g., a certain condition at the exit is not satisfied).
The embodiment of the invention provides a testing method based on a workflow model, which realizes a set of testing method for simulating complex business scenes by building the workflow model on the basis of not influencing the use of TestNG.
To further illustrate the present solution, the present invention also provides a specific application example of a workflow model-based testing method, referring to fig. 6, by taking a Petri network as an example, where the method specifically includes the following steps:
the use of workflow modeling has now been applied to many enterprise-level business processes, where the use of Petri nets for workflow modeling is relatively common in the modeling arts. The invention provides the modeling business process for each tester to drive the following business process test on four basic structures based on the Petri network.
S1: and establishing a business processing flow model by using the workflow model.
The tester can use four basic structures (sequential structure, parallel structure, conditional structure, cyclic structure) of workflow modeling to build a workflow model according to the actual business process.
(1) Sequential structure: refers to a segment of the flow in which activities are initiated in a fixed order, primarily for expressing causal relationships between jobs. As shown in fig. 7, the services t1, t2, and t3 are sequentially executed in a predetermined order.
(2) Parallel structure: services t2 and t3 are executed in parallel, but they can be executed in any order, for which parallel routing two logical "gate" structures need to be built: branching from the relationship; merging with the relationship as shown in fig. 8.
(3) Conditional structure: services t2 and t3 are examples of conditional execution, i.e. after execution of service t1 either service t2 or service t3 is executed, here also two logical gate structures are used: or a relationship branch; or a relational junction as shown in fig. 9.
(4) The circulation structure is as follows: it is sometimes necessary to repeatedly perform a certain service (e.g., t 2) a plurality of times (e.g., a certain condition at the exit is not satisfied), as shown in fig. 10.
S2: and translating the service flow model into an executable test script case, operating Microsoft Excel through Apache POI, generating a test script template Excel of the service, and generating JAVA scripts executed by the service through JAVA input-output streaming technology.
Test assertions and the like can be added according to specific test requirements to verify the correctness of the service processing. According to the model, the XML files are converted into various structural definitions, and then the Apache POI is used for writing Excel to form executable test case scripts, see FIG. 11.
S3: and defining data flow among services, and realizing output of the services as input of the next service through Apache POIs.
Specifically, the output of the previous service is written into the running result Excel through the Apache POI, and the next service reads the output result through the Apache POI as the input of the next service.
S4: according to the test requirements, test assertions are added on the basis of test scripts, the Apache POI is used for reading assertion data and interpreting the assertions, a database is accessed through JDBC, and whether expected values are consistent with database data or not is automatically compared.
Specifically, the database table is filled with query terms and expected values. Next, using the Apache POI to read the assertion data and interpret the assertion, accessing the database through JDBC, querying, deleting, changing the database data, storing the judgment result into the color-changing object, recording the result into script operation result Excel through the Apache POI, marking the table field passing through the assertion as one color, marking the table field passing through the assertion as another color, see fig. 12.
In summary, the invention develops a method which is more convenient for testing distributed platform services by using workflow modeling on the basis of TestNG. The user can simulate the whole business processing flow by using the method in a mode of establishing a model, then the background translates the model into business processing flow codes, and a test script with a unified style is automatically generated according to the business processing flow codes, so that the requirement on the coding capability of a tester is greatly reduced. The input/output is carried out by adopting the EXCEL form mode, and the filling and displaying are clear and obvious. The method is matched with various convenient functions and assertion templates, and testers can use the functions and assertion templates in a manner of filling EXCEL, so that the method is convenient and quick, and the code quantity of codes is greatly reduced. The system also supports EXCEL fill-in data preparation and data recovery data, ready for automated testing. The method has the greatest advantages of supporting the testing methods such as a scene method and the like, writing a large number of testing cases, and executing the testing cases in sequence according to the flow sequence defined by the workflow model. Meanwhile, the output of the previous case is supported as the input of the subsequent case, so that great convenience is provided for data flow between visual services, and the burden of large-scale integrated test of testers is greatly reduced.
Based on the same inventive concept, the embodiment of the present application also provides a testing device based on a workflow model, which can be used to implement the method described in the above embodiment, such as the following embodiment. Because the principle of the workflow model-based testing device for solving the problem is similar to that of the workflow model-based testing method, the implementation of the workflow model-based testing device can be implemented by referring to the workflow model-based testing method, and the repetition is omitted. As used below, the term "unit" or "module" may be a combination of software and/or hardware that implements the intended function. While the system described in the following embodiments is preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
An embodiment of the present invention provides a specific implementation manner of a workflow model-based testing apparatus capable of implementing a workflow model-based testing method, and referring to fig. 13, the workflow model-based testing apparatus specifically includes the following contents:
The model translation module 10 is used for translating the workflow model to be tested into an executable primary test script;
Conclusion an adding module 20, configured to add a test assertion in the test script, so as to generate a final test script;
The script execution module 30 is configured to execute the final test script and compare the execution result with an expected value.
In one embodiment, referring to fig. 14, the model translation module 10 includes:
A test table generating unit 101, configured to translate the workflow model to be tested into a test table through an Apache POI;
and the test script generating unit 102 is used for generating the preliminary test script according to the test table by using the input stream and the output stream device.
In one embodiment, referring to fig. 15, the workflow model-based testing apparatus further includes:
A data flow determining module 40, configured to determine a data flow in the process of executing the final test script according to a test requirement;
In one embodiment, referring to fig. 16, the workflow model-based testing apparatus further includes:
A workflow model creation module 50, configured to create the workflow model, where the workflow model structure includes: sequential structure, parallel structure, conditional structure, and cyclic structure;
in one embodiment, referring to fig. 17, the script execution module 30 includes:
Conclusion a reading unit 301, configured to read the test assertion using an Apache POI according to the data diversion;
A final script generation unit 302 for interpreting the test assertion to generate a final test script;
and the result comparison unit 303 is configured to execute the final test script, and compare the execution result with the expected value by accessing the JDBC database.
As can be seen from the above description, the workflow model-based testing device provided by the embodiment of the present invention firstly responds to a user's make number request, and parses the make number request to determine a field name, a field type, a field annotation and a field tag; triggering a corresponding python function according to the field name, the field type, the field annotation and the field label to generate to-be-manufactured data; and finally, inserting a corresponding sql statement and a value into the data to be manufactured according to the number-making request. The invention solves the problem that the number creating method in the prior art is difficult to meet the requirements in special scenes by a mode of customizing Python functions and template configuration. Specifically, the invention has the following beneficial effects:
referring now to fig. 18, a schematic diagram of an electronic device 600 suitable for use in implementing embodiments of the present application is shown.
As shown in fig. 18, the electronic apparatus 600 includes a Central Processing Unit (CPU) 601, which can execute various appropriate works and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM)) 603. In the RAM603, various programs and data required for the operation of the system 600 are also stored. The CPU601, ROM602, and RAM603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, mouse, etc.; an output portion 607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to the I/O interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on drive 610 as needed, so that a computer program read therefrom is mounted as needed as storage section 608.
In particular, according to embodiments of the present invention, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, an embodiment of the present invention includes a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the above-described person distance determination method in a data room-based scenario, the steps comprising:
Step 100: translating the workflow model to be tested into an executable primary test script;
Step 200: adding test assertions in the test script to generate a final test script;
Step 300: and executing the final test script, and comparing an execution result with an expected value.
In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in the same piece or pieces of software and/or hardware when implementing the present application.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The above is only an example of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.

Claims (6)

1. A workflow model-based testing method, comprising:
Establishing the workflow model, wherein the workflow model structure comprises the following steps: sequential structure, parallel structure, conditional structure, and cyclic structure;
Translating the workflow model to be tested into an executable primary test script;
Adding test assertions in the test script to generate a final test script;
executing the final test script, and comparing an execution result with an expected value;
determining data transfer in the process of executing the final test script according to the test requirement; wherein, the data transfer is: the output of the previous service is written into the running result Excel through the Apache POI, and the next service reads the output result through the Apache POI to serve as the input of the next service;
the executing the final test script and comparing the execution result with an expected value comprises the following steps:
reading the test assertion by using an Apache POI according to the data transfer;
the test assertion is interpreted to generate a final test script.
2. The workflow model-based testing method of claim 1, wherein translating the workflow model to be tested into an executable preliminary test script comprises:
Translating the workflow model to be tested into a test form through an Apache POI;
And generating the preliminary test script according to the test table by using an input stream method and an output stream method.
3. A workflow model-based testing apparatus, comprising:
A workflow model building module, configured to build the workflow model, where the workflow model structure includes: sequential structure, parallel structure, conditional structure, and cyclic structure;
The model translation module is used for translating the workflow model to be tested into an executable primary test script;
conclusion an adding module, configured to add a test assertion in the test script, so as to generate a final test script;
The script execution module is used for executing the final test script and comparing an execution result with an expected value;
the data flow determining module is used for determining data flow in the process of executing the final test script according to the test requirement; wherein, the data transfer is: the output of the previous service is written into the running result Excel through the Apache POI, and the next service reads the output result through the Apache POI to serve as the input of the next service;
the script execution module includes:
Conclusion a reading unit, configured to read the test assertion using an Apache POI according to the data diversion;
a final script generation unit for interpreting the test assertion to generate a final test script;
and the result comparison unit is used for executing the final test script and comparing an execution result with an expected value by accessing the JDBC database.
4. A workflow model-based testing apparatus in accordance with claim 3, wherein the model translation module comprises:
the test table generation unit is used for translating the workflow model to be tested into a test table through an Apache POI;
and the test script generating unit is used for generating the preliminary test script according to the test table by utilizing the input flow and the output flow device.
5. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the workflow model-based testing method of any one of claims 1 to 2 when the program is executed.
6. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the workflow model-based testing method of any one of claims 1 to 2.
CN202110346229.0A 2021-03-31 2021-03-31 Workflow model-based testing method and device Active CN112860584B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110346229.0A CN112860584B (en) 2021-03-31 2021-03-31 Workflow model-based testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110346229.0A CN112860584B (en) 2021-03-31 2021-03-31 Workflow model-based testing method and device

Publications (2)

Publication Number Publication Date
CN112860584A CN112860584A (en) 2021-05-28
CN112860584B true CN112860584B (en) 2024-06-18

Family

ID=75991994

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110346229.0A Active CN112860584B (en) 2021-03-31 2021-03-31 Workflow model-based testing method and device

Country Status (1)

Country Link
CN (1) CN112860584B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113886269B (en) * 2021-10-25 2024-09-13 神思电子技术股份有限公司 Service testing method and system
CN114936109A (en) * 2022-05-25 2022-08-23 南通大学 Counter-example fault positioning method based on model detection

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108614770A (en) * 2018-04-09 2018-10-02 中国工商银行股份有限公司 Automatic test asserts method, apparatus, storage medium and equipment
CN112368685A (en) * 2019-04-05 2021-02-12 甲骨文国际公司 Customizable enterprise automation test framework

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106560797B (en) * 2016-08-24 2019-07-02 北京安天网络安全技术有限公司 A kind of unit test system and method based on debugger
CN111209185B (en) * 2019-12-23 2022-12-06 厦门市美亚柏科信息股份有限公司 Keyword-based automated testing method and computer-readable storage medium
CN111949543B (en) * 2020-08-13 2023-09-08 中国工商银行股份有限公司 Test method and device based on distributed platform, electronic equipment and storage medium
CN112035363A (en) * 2020-09-01 2020-12-04 中国银行股份有限公司 Automatic interface testing method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108614770A (en) * 2018-04-09 2018-10-02 中国工商银行股份有限公司 Automatic test asserts method, apparatus, storage medium and equipment
CN112368685A (en) * 2019-04-05 2021-02-12 甲骨文国际公司 Customizable enterprise automation test framework

Also Published As

Publication number Publication date
CN112860584A (en) 2021-05-28

Similar Documents

Publication Publication Date Title
US10061573B2 (en) User interfaces of application porting software platform
US8286132B2 (en) Comparing and merging structured documents syntactically and semantically
US8321834B2 (en) Framework for automatically merging customizations to structured code that has been refactored
US11526656B2 (en) Logical, recursive definition of data transformations
CN112199086B (en) Automatic programming control system, method, device, electronic equipment and storage medium
CN111159220B (en) Method and apparatus for outputting structured query statement
US10489024B2 (en) UI rendering based on adaptive label text infrastructure
CN108037913B (en) Method for converting xUML4MC model into MSVL (modeling, simulation and verification language) program and computer-readable storage medium
CN112860584B (en) Workflow model-based testing method and device
CN113448562B (en) Automatic logic code generation method and device and electronic equipment
CN107506190A (en) XML file amending method and device based on Spring frameworks
CN111125064B (en) Method and device for generating database schema definition statement
US20130007695A1 (en) Modelling serialized object streams
US20240370452A1 (en) Architecture for data map converters
Palermo et al. ASP. NET MVC 4 in Action: Revised edition of ASP. NET MVC 2 in Action
CN116028028B (en) Request function generation method, device, equipment and storage medium
CN116755669A (en) Low code development method and tool based on DSL language operation model
Roldán React Design Patterns and Best Practices: Design, build and deploy production-ready web applications using standard industry practices
CN116860636A (en) Unit test code generation method, device, equipment and storage medium
CN115562989A (en) Automatic test sequence conversion method, system, equipment and medium
CN116755684B (en) OAS Schema generation method, device, equipment and medium
Mileff Design and development of a web-based graph editor and simulator application
US12099529B2 (en) Cross-platform content management
Chang et al. Improvement of Excel data processing function based on Spring MVC framework
US11526336B2 (en) Community-oriented, cloud-based digital annealing platform

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