CN112860584A - Test method and device based on workflow model - Google Patents

Test method and device based on workflow model Download PDF

Info

Publication number
CN112860584A
CN112860584A CN202110346229.0A CN202110346229A CN112860584A CN 112860584 A CN112860584 A CN 112860584A CN 202110346229 A CN202110346229 A CN 202110346229A CN 112860584 A CN112860584 A CN 112860584A
Authority
CN
China
Prior art keywords
test
workflow model
script
test 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.)
Pending
Application number
CN202110346229.0A
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.)
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/CN112860584A/en
Publication of CN112860584A publication Critical patent/CN112860584A/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

Abstract

The invention can be used in big data or other fields, the invention provides a test method and a device based on a workflow model, and the test method based on the workflow model comprises the following steps: translating the workflow model to be tested into an executable preliminary test script; adding a test assertion 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 method, the workload of the tester for developing the codes can be reduced by establishing the test method of simulating the complex service scene by the workflow model, so that the tester can concentrate more energy 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 data circulation among services can be observed, and the error service can be checked and positioned conveniently. And subsequently, the complete test case script is deployed in the server to automatically run, so that the aim of automatic testing is fulfilled, and the workload of manual testing is greatly reduced.

Description

Test method and device based on workflow model
Technical Field
The invention belongs to the technical field of big data, and particularly relates to a test method and a test device based on a workflow model.
Background
With the rapid development of various applications, distributed platform services are widely applied to various applications. With this, testing of distributed platform services is also challenging. In particular, to provide reusability of services, a single service often performs a relatively independent function, and a complex business scenario often requires combining multiple services to perform. Therefore, in addition to the functional test of a single service, the tester needs to design verification of various complex business scenarios. The traditional test verification needs to manually call a plurality of services, data transmission among the services is manually realized, 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 a problem, the problem is solved by consuming a great deal of time and energy, and the testing efficiency is low.
TestNG is a testing tool commonly used by testers in the industry for performing distributed platform service testing, and the testing tool supports the use of programming to realize service calling, input/output printing, test assertion judgment and various functions, but is commonly used for single service testing.
Disclosure of Invention
The testing method and the testing device based on the workflow model realize a set of testing method for simulating complex business scenes by establishing the workflow model on the basis of not influencing the use of the TestNG. The workload of the tester for developing the codes can be reduced, so that the tester can concentrate more energy on the design of a test scene, and the service scene is optimized through modeling; meanwhile, the visualization of the test scene is improved, the data circulation among services can be observed, and the error service can be checked and positioned conveniently. And subsequently, the complete test case script is deployed in the server to automatically run, so that the aim of automatic testing is fulfilled, and the workload of manual testing 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 test method based on a workflow model, including:
translating the workflow model to be tested into an executable preliminary test script;
adding a test assertion 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, the 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 the data diversion in the process of executing the final test script according to the test requirements.
In one embodiment, the executing the final test script and comparing the execution result with an expected value includes:
reading the test assertion according to the data diversion by using Apache POI;
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 the JDBC database.
In one embodiment, the workflow model-based testing method further includes: establishing the workflow model, wherein the workflow model structure comprises: sequential structure, parallel structure, conditional structure, and cyclic structure.
In a second aspect, the present invention provides a workflow model-based test apparatus, including:
the model translation module is used for translating the workflow model to be tested into an executable preliminary test script;
the phrase adding module is used for adding test assertions in the test script to generate a final test script;
and the script execution module is used for executing the final test script and comparing the execution result with an expected value.
In one embodiment, the model translation module comprises:
the test table generating unit is used for translating the workflow model to be tested into a test table through 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 stream and output stream devices.
In one embodiment, the workflow model-based test apparatus further includes:
the data flow determining module is used for determining the data flow in the process of executing the final test script according to the test requirement;
a workflow model building module for building the workflow model, the workflow model structure comprising: a sequential structure, a parallel structure, a conditional structure, and a cyclic structure;
the script execution module includes:
the phrase reading unit is used for reading the test assertion by using an Apache POI according to the data traffic;
a final script generating 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 the execution result with an expected value by accessing the JDBC database.
In a third aspect, the present invention provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the workflow model based test method when executing the program.
In a fourth aspect, the invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of a workflow model-based testing method.
As can be seen from the above description, in the testing method and device based on the workflow model provided in the embodiments of the present invention, the workflow model to be tested is first translated into an executable preliminary test script; then, adding a test assertion 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 the workflow model on the basis of not influencing the use of the TestNG. By using the method, the workload of the tester for developing codes can be reduced, the tester 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 data circulation among services can be observed, and the error service can be checked and positioned conveniently. And subsequently, the complete test case script is deployed in the server to automatically run, so that the aim of automatic testing is fulfilled, and the workload of manual testing 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 used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a first flowchart illustrating a workflow model-based testing method according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating step 100 of the workflow-model-based testing method according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a second testing method based on a workflow model according to an embodiment of the present invention;
FIG. 4 is a flow chart illustrating step 300 of the workflow-model-based testing method according to an embodiment of the invention;
FIG. 5 is a third schematic flow chart of a workflow model-based testing method according to an embodiment of the present invention;
FIG. 6 is a flow chart of a workflow model based test method in an embodiment of the present invention;
FIG. 7 is a structural diagram of a workflow model of a sequential structure in an embodiment of the invention;
FIG. 8 is a structural diagram of a workflow model of a parallel structure in an embodiment of the present invention;
FIG. 9 is a schematic diagram of a workflow model of a conditional structure according to an embodiment of the present invention;
FIG. 10 is a schematic diagram of a workflow model of a loop structure in an embodiment of the present invention;
FIG. 11 is a diagram of Excel in an embodiment of the present invention;
FIG. 12 is a diagram illustrating script execution results in an embodiment of the present invention;
FIG. 13 is a block diagram of a first embodiment of a workflow-model-based test apparatus;
FIG. 14 is a block diagram of the structure of model translation module 10 in an embodiment of the present invention;
FIG. 15 is a block diagram of a second embodiment of a workflow-model-based test apparatus;
FIG. 16 is a block diagram of a workflow model based test apparatus according to an embodiment of the present invention;
FIG. 17 is a block diagram of the structure of the script execution module 30 in the embodiment of the present invention;
fig. 18 is a schematic structural diagram of an electronic device in an embodiment of the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
It should be noted that the terms "comprises" and "comprising," and any variations thereof, in the description and claims of this application and the above-described drawings, 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, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
The embodiment of the present invention provides a specific implementation manner of a test method based on a workflow model, and referring to fig. 1, the method specifically includes the following steps:
step 100: the workflow model to be tested is translated into an executable preliminary test script.
Specifically, a test script template Excel of the service can be generated through an Apache POI; and generating a JAVA script executed by the service through the input and output stream technology of JAVA. It is understood that Workflow, refers to "automation of a portion or the whole of a business process in a computer application environment". The method is an abstract and general description of the workflow and the business rules among the operation steps of the workflow. In computers, workflows are part of Computer Supported Collaborative Work (CSCW). The latter is a general study on how a group can achieve cooperative work with the help of computers. The main problems mainly solved by the workflow are as follows: to achieve a business goal, documents, information, or tasks are automatically communicated between multiple participants using a computer according to some predetermined rule. The workflow concept originates from the field of production organization and office automation, is a concept provided aiming at the fixed program activities in daily work, and aims to decompose the work into well-defined tasks or roles, execute the tasks according to certain rules and processes and monitor the tasks, so that the aims of improving the work efficiency, better controlling the process, enhancing the service to customers, effectively managing the business process and the like are fulfilled.
Step 200: adding a test assertion to the test script to generate a final test script.
When the step 200 is implemented, a test assertion is added on the basis of the test script according to the test requirement. It will be appreciated that when code is written, certain assumptions are made and that assertions are used to capture these assumptions in the code. It is believed that the expression value is true at a particular point in the program, assertion verification can be enabled and disabled at any time, and thus assertions can be enabled at test time and disabled at deployment time. Likewise, after the program is put into operation, the end user can re-enable the assertion when a problem is encountered. Using assertions can create code that is more stable, better quality, and less prone to errors. An assertion may be used when it is desired to interrupt the current operation when a value is FALSE. Unit testing must use assertions (Junit/JuntiX). In addition to type checking and unit testing, assertions provide an elegant way to determine whether various features are maintained in a program. Using assertions can make designing contractually one step closer. Assertions can take two forms: 1, alert Expression 1; 2, alert Expression1: Expression 2.
Step 300: and executing the final test script, and comparing an execution result with an expected value.
Specifically, Apache POI will be used to read and interpret the assertion data, and access the database via JDBC to automatically compare if the expected value is consistent with the database data.
It is understood that JDBC refers to Java Database Connectivity, (JDBC for short) is an application program interface in Java language that specifies how a client program accesses a Database, and provides methods such as querying and updating data in a Database, and is generally referred to as JDBC. The JDBC API is mainly located in a java.sql packet in the JDK (the extended content is then located in a java.sql packet), and mainly includes:
DriverManager: and the system is responsible for loading various different drivers (drivers) and returning corresponding database connections (Connection) to the caller according to different requests. Driver: the driver loads itself into the DriverManager, processes the corresponding request and returns the corresponding database Connection (Connection). Connection: the database Connection is responsible for the communication between databases, and the SQL execution and the transaction processing are all performed in a certain Connection environment. A Statement to execute SQL may be generated. State element: to execute SQL queries and updates (for static SQL statements and single execution). PreparedStatement: to perform SQL queries and updates containing dynamic parameters (compiled on the server side, allowing repeated execution to improve efficiency). CallableStatement: to invoke stored procedures in the database. SQLException: representing that an exception (i.e., error) has occurred during the establishment and closing of the database connection and the execution of the SQL statement.
As can be seen from the above description, in the testing method based on the workflow model provided in the embodiment of the present invention, the workflow model to be tested is first translated into an executable preliminary test script; then, adding a test assertion 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 the workflow model on the basis of not influencing the use of the TestNG. By using the method, the workload of the tester for developing codes can be reduced, the tester 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 data circulation among services can be observed, and the error service can be checked and positioned conveniently. And subsequently, the complete test case script is deployed in the server to automatically run, so that the aim of automatic testing is fulfilled, and the workload of manual testing 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, operating Microsoft Excel through an Apache POI to generate a test script template Excel of the service; and generating a JAVA script executed by the service through the input and output stream technology of JAVA. A flow is an abstraction that represents unstructured delivery of data. Input and output are performed in a streaming manner, and data is treated as an unstructured byte sequence or character sequence. The operation of fetching data from a stream is called an extraction operation, while the operation of adding data to a stream is called an insertion operation. The stream used to perform input-output operations is referred to as an IO stream. Briefly, IO streams are input and output in a streaming manner. In the IO stream, the input and output are divided into 4 steps: formatting/parsing, buffering, transcoding and delivery, specifically:
formatting/parsing: a bidirectional conversion is made between an internal data representation (in bytes) and an external data representation (in characters). For example, a 2-byte integer 10002, 5 characters are required for representation.
Buffering: for buffering character sequences between format/parsing and delivery. For output, the shorter character sequence is not output immediately after being formatted, but is stored in a buffer and is transmitted to an external device after being accumulated to a certain size. On the contrary, a large amount of data read from the external device is also put in the buffer and then gradually taken out to complete the input. When the default is reached, the input and the output of the IO stream are buffered, and the IO stream can also work in a non-buffer mode.
And (3) code conversion: it is to convert one character expression into another character expression. If the character expression generated by formatting is different from the external character expression (when outputting) or the external expression is different from the expression that can be resolved by the IO stream (when inputting), transcoding is necessary. Such as conversion between multi-byte encoding and wide character encoding. Transcoding is not required in most cases.
Transferring: mainly communicating with external devices. When outputting, the transmission is responsible for sending the character sequence after formatting, buffering, namely code conversion to the external equipment; when inputting, it is responsible for extracting data from external device, and providing character sequence for code conversion, buffer and analysis.
In an embodiment, referring to fig. 3, the workflow model based test method further includes:
step 400: and determining the data diversion in the process of executing the final test script according to the test requirements.
Specifically, defining data flow between services, specifically operating as: the output of the former service is written into the operation result Excel through the Apache POI, and the output result of the next service is read through the Apache POI and serves as the input of the next service.
In one embodiment, referring to fig. 4, step 300 comprises:
step 301: reading the test assertion according to the data diversion by using Apache POI;
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 the JDBC database.
In steps 301 to 303, a test assertion is added on the basis of a test script, Apache POI is used to read assertion data and interpret the assertion, a database is accessed through JDBC, and whether an expected value is consistent with database data or not is automatically compared.
Apache POI is an open source function library of the Apache software foundation, and provides API for Java programs to read and write Microsoft Office format archives. Common classes of Apache POIs include:
HSSF-provides the functionality to read and write Microsoft Excel XLS formatted archives.
XSSF-provides the functionality of reading and writing Microsoft Excel OOXML XLSX formatted archives.
HWPF-provides the function of reading and writing Microsoft Word DOC97 formatted files.
XWPF-provides the functionality of reading and writing Microsoft Word DOC2003 formatted archives.
HSLF-provides the functionality to read and write Microsoft PowerPoint formatted files.
HDGF-provides the function of reading files in Microsoft Visio format.
HPBF-provides functionality for reading Microsoft publishing archive.
HSMF-provides the function of reading Microsoft Outlook format files.
In an embodiment, referring to fig. 5, the workflow model based test method further includes:
step 500: and establishing the workflow model.
The workflow model structure includes: sequential structure, parallel structure, conditional structure, and cyclic structure. The sequence structure is as follows: refers to a segment of the process in which activities are caused to be performed in a fixed order, primarily to express causal relationships between jobs. The services t1, t2, and t3 are executed in the stated order.
Parallel structure: services t2 and t3 are performed in parallel, but they can be performed in any order, for which parallel routing two logical "gate" structures need to be built: and a relationship branch; and the relationship is merged.
The condition structure is as follows: services t2 and t3 are examples of conditional execution, i.e., after service t1 executes either service t2 or service t3, where two logical "gate" structures are also used: or a relationship branch; or the relationship converges.
The circulation structure is as follows: it is sometimes necessary to perform a certain service (e.g., t2) repeatedly for a plurality of times (e.g., a certain condition is not satisfied at the egress).
The embodiment of the invention provides a test method based on a workflow model, which realizes a set of test method for simulating a complex business scene by establishing the workflow model on the basis of not influencing the use of TestNG, can reduce the coding amount of testers, enables the testers to concentrate more energy on the design of the test scene, simultaneously supports the automatic transmission of data among services, reduces the manual participation of the testers and greatly improves the test efficiency of the testers.
To further illustrate the present solution, the invention also provides a specific application example of the testing method based on the workflow model by taking the Petri net as an example, and referring to fig. 6, the method specifically includes the following steps:
the use of workflow modeling has now been applied to many enterprise-level business processes, where in the modeling field, more often Petri nets are used for workflow modeling. The invention provides a business flow modeling method for each tester to drive the following business flow test based on four basic structures of a 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 and cyclic structure) of workflow modeling to establish a workflow model according to the actual business process.
(1) The sequence structure is as follows: refers to a segment of the process in which activities are caused to be performed in a fixed order, primarily to express causal relationships between jobs. As shown in fig. 7, services t1, t2, and t3 are sequentially executed in a predetermined order.
(2) Parallel structure: services t2 and t3 are performed in parallel, but they can be performed in any order, for which parallel routing two logical "gate" structures need to be built: and a relationship branch; merge with the relationship as shown in fig. 8.
(3) The condition structure is as follows: services t2 and t3 are examples of conditional execution, i.e., after service t1 executes either service t2 or service t3, where two logical "gate" structures are also used: or a relationship branch; or the relationship converges as shown in fig. 9.
(4) The circulation structure is as follows: it is sometimes necessary to perform a certain service (e.g., t2) repeatedly for a plurality of times (e.g., a certain condition is not satisfied at the exit), as shown in fig. 10.
S2: and translating the business process model into an executable test script case, operating Microsoft Excel through Apache POI to generate a test script template Excel of the service, and generating a JAVA script executed by the service through a JAVA input and output stream technology.
Test assertions and the like can be added according to specific test requirements to verify the correctness of service processing. The model is converted into an XML file with various structure definitions, and then Apache POI is used to write into Excel, so as to form an executable test case script, which is shown in FIG. 11.
S3: data flow between services is defined, and output of the service is realized through the Apache POI as input of the next service.
Specifically, the output of the previous service is written into the run result Excel through the Apache POI, and the output of the next service is read as the input of the next service through the Apache POI.
S4: according to the test requirements, adding test assertions on the basis of a test script, reading assertion data by using an Apache POI (Point of interest) and explaining the assertions, accessing a database through JDBC, and automatically comparing whether an expected value is consistent with the database data.
Specifically, query conditions and expected values are filled in the database table page. Then, reading assertion data by using an Apache POI, interpreting the assertion, accessing the database through JDBC, querying, deleting, changing the database data, storing the determination result in the color-changing object, recording a script running result Excel through the Apache POI, marking the table field passing the assertion as one color, and marking the table field passing the assertion as another color, see fig. 12.
In conclusion, the distributed platform service testing method is developed by utilizing workflow modeling on the basis of the TestNG, and is more convenient to perform. A user can simulate the whole business processing flow by establishing a model by using the method, then the model is translated into a business processing flow code by a background, and a test script with a unified style is automatically generated according to the business processing flow code, so that the requirement on the coding capacity of a tester is greatly reduced. Input/output is performed in the form of EXCEL form, and filling and displaying are clear. Various convenient functions and assertion templates are provided in a matched manner, and testers can use the functions and the assertion templates in a mode of filling EXCEL, so that the method is convenient and quick, and the code amount of coding is greatly reduced. The method also supports EXCEL filling data preparation and data recovery data, and is ready for automatic testing. The method has the greatest advantage that the method supports testing methods such as a scene method and the like, a large number of testing cases are compiled, and the testing cases are sequentially executed according to the flow sequence defined by the workflow model. Meanwhile, the output of the previous case is supported to be used as the input of the next case, great convenience is provided for data transfer between visual services, and the burden of a tester on large-scale integrated test is greatly reduced.
Based on the same inventive concept, the embodiment of the present application further provides a testing apparatus based on a workflow model, which can be used to implement the method described in the above embodiment, such as the following embodiments. Because the principle of solving the problems of the test device based on the workflow model is similar to that of the test method based on the workflow model, the implementation of the test device based on the workflow model can be implemented by referring to the test method based on the workflow model, and repeated parts are not described again. As used hereinafter, the term "unit" or "module" may be a combination of software and/or hardware that implements a predetermined function. While the system described in the embodiments below is preferably implemented in software, implementations in hardware, or a combination of software and hardware are also possible and contemplated.
An embodiment of the present invention provides a specific implementation manner of a test apparatus based on a workflow model, which is capable of implementing a test method based on a workflow model, and referring to fig. 13, the test apparatus based on a workflow model specifically includes the following contents:
the model translation module 10 is used for translating the workflow model to be tested into an executable preliminary test script;
a phrase adding module 20, configured to add a test assertion to the test script to generate a final test script;
and the script execution module 30 is configured to execute the final test script and compare an execution result with an expected value.
In one embodiment, referring to fig. 14, the model translation module 10 includes:
a test form generating unit 101, configured to translate the workflow model to be tested into a test form through an Apache POI;
the test script generating unit 102 is configured to generate the preliminary test script according to the test table by using an input stream and an output stream device.
In one embodiment, referring to fig. 15, the workflow model based test apparatus further includes:
a data flow determining module 40, configured to determine, according to a test requirement, a data flow in the process of executing the final test script;
in one embodiment, referring to fig. 16, the workflow model based test apparatus further comprises:
a workflow model building module 50 configured to build the workflow model, wherein the workflow model structure includes: a sequential structure, a parallel structure, a conditional structure, and a cyclic structure;
in one embodiment, referring to fig. 17, the script execution module 30 includes:
a phrase reading unit 301, configured to read the test assertion according to the data diversion by using an Apache POI;
a final script generating unit 302, configured to interpret the test assertion to generate a final test script;
and a result comparing unit 303, configured to execute the final test script and compare an execution result with an expected value by accessing the JDBC database.
As can be seen from the above description, the test apparatus based on workflow model provided in the embodiment of the present invention firstly responds to the manufacture request of the user, and parses the manufacture request to determine the field name, the field type, the field annotation and the field tag; then, triggering a corresponding python function according to the field name, the field type, the field annotation and the field label to generate data to be manufactured; and finally, inserting a corresponding sql statement and a value into the data to be manufactured according to the manufacture number request. The method solves the problem that the number making method in the prior art is difficult to meet the requirements in special scenes by a mode of self-defining Python function and template configuration. Specifically, the invention has the following beneficial effects:
referring now to FIG. 18, shown is a schematic diagram of an electronic device 600 suitable for use in implementing embodiments of the present application.
As shown in fig. 18, the electronic apparatus 600 includes a Central Processing Unit (CPU)601 that can perform 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 necessary for the operation of the system 600 are also stored. The CPU601, ROM602, and RAM603 are connected to each other via 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, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; 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 driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted as necessary on the storage section 608.
In particular, according to an embodiment of the present invention, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, an embodiment of the present invention includes a computer-readable storage medium, on which a computer program is stored, the computer program, when being executed by a processor, implementing the steps of the above-mentioned method for determining a distance to a person in a data-based room scenario, the steps including:
step 100: translating the workflow model to be tested into an executable preliminary test script;
step 200: adding a test assertion 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 section 609, and/or installed from the removable medium 611.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more 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 flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
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 an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1.A test method based on a workflow model is characterized by comprising the following steps:
translating the workflow model to be tested into an executable preliminary test script;
adding a test assertion 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.
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. The workflow model based testing method of claim 1 further comprising:
and determining the data diversion in the process of executing the final test script according to the test requirements.
4. The workflow model based test method of claim 3, wherein the executing the final test script and comparing the execution result with an expected value comprises:
reading the test assertion according to the data diversion by using Apache POI;
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 the JDBC database.
5. The workflow model based testing method of claim 1 further comprising: establishing the workflow model, wherein the workflow model structure comprises: sequential structure, parallel structure, conditional structure, and cyclic structure.
6. A workflow model-based test apparatus, comprising:
the model translation module is used for translating the workflow model to be tested into an executable preliminary test script;
the phrase adding module is used for adding test assertions in the test script to generate a final test script;
and the script execution module is used for executing the final test script and comparing the execution result with an expected value.
7. The workflow model based test apparatus of claim 6 wherein the model translation module comprises:
the test table generating unit is used for translating the workflow model to be tested into a test table through 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 stream and output stream devices.
8. The workflow model based test apparatus of claim 6 further comprising:
the data flow determining module is used for determining the data flow in the process of executing the final test script according to the test requirement;
a workflow model building module for building the workflow model, the workflow model structure comprising: a sequential structure, a parallel structure, a conditional structure, and a cyclic structure;
the script execution module includes:
the phrase reading unit is used for reading the test assertion by using an Apache POI according to the data traffic;
a final script generating 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 the execution result with an expected value by accessing the JDBC database.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the workflow model based testing method according to any one of claims 1 to 5 are implemented when the program is executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the workflow model based testing method according to any one of claims 1 to 5.
CN202110346229.0A 2021-03-31 2021-03-31 Test method and device based on workflow model Pending CN112860584A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110346229.0A CN112860584A (en) 2021-03-31 2021-03-31 Test method and device based on workflow model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110346229.0A CN112860584A (en) 2021-03-31 2021-03-31 Test method and device based on workflow model

Publications (1)

Publication Number Publication Date
CN112860584A true CN112860584A (en) 2021-05-28

Family

ID=75991994

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110346229.0A Pending CN112860584A (en) 2021-03-31 2021-03-31 Test method and device based on workflow model

Country Status (1)

Country Link
CN (1) CN112860584A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113886269A (en) * 2021-10-25 2022-01-04 神思电子技术股份有限公司 Service testing method and system

Citations (4)

* 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
CN111209185A (en) * 2019-12-23 2020-05-29 厦门市美亚柏科信息股份有限公司 Keyword-based automated testing method and computer-readable storage medium
CN112035363A (en) * 2020-09-01 2020-12-04 中国银行股份有限公司 Automatic interface testing method and device
CN112368685A (en) * 2019-04-05 2021-02-12 甲骨文国际公司 Customizable enterprise automation test framework

Patent Citations (4)

* 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
CN111209185A (en) * 2019-12-23 2020-05-29 厦门市美亚柏科信息股份有限公司 Keyword-based automated testing method and computer-readable storage medium
CN112035363A (en) * 2020-09-01 2020-12-04 中国银行股份有限公司 Automatic interface testing method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113886269A (en) * 2021-10-25 2022-01-04 神思电子技术股份有限公司 Service testing method and system

Similar Documents

Publication Publication Date Title
US10572529B2 (en) Data integration tool
US10061573B2 (en) User interfaces of application porting software platform
US8321834B2 (en) Framework for automatically merging customizations to structured code that has been refactored
US8286132B2 (en) Comparing and merging structured documents syntactically and semantically
US7603658B2 (en) Application functionality for a test tool for application programming interfaces
US20210357577A1 (en) Logical, recursive definition of data transformations
CN110347598B (en) Test script generation method and device, server and storage medium
CN104376043B (en) Log recording and display methods and device
US8930888B2 (en) Modelling serialized object streams
US20150261507A1 (en) Validating sql queries in a report
US20070240168A1 (en) Apparatus and method for modifying an initial event queue for extending an XML processor's feature set
CN113032244B (en) Interface test method, device, computer system and computer readable storage medium
CN111125064B (en) Method and device for generating database schema definition statement
CN107506190A (en) XML file amending method and device based on Spring frameworks
CN111784108B (en) Modeling method and device of main data management platform
CN113448562B (en) Automatic logic code generation method and device and electronic equipment
CN112650526B (en) Method, device, electronic equipment and medium for detecting version consistency
CN112860584A (en) Test method and device based on workflow model
CN112597171A (en) Table relation visualization method and device, electronic equipment and storage medium
US20220075796A1 (en) Architecture for data map converters
CN113138767B (en) Code language conversion method, device, electronic equipment and storage medium
CN116755684B (en) OAS Schema generation method, device, equipment and medium
Chang et al. Improvement of Excel data processing function based on Spring MVC framework
Yin Salesforce-Usability of Lightning Web Components
CN116755669A (en) Low code development method and tool based on DSL language operation model

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