Test method and device based on data integration model

By configuring database connections through a data integration model, generating test script cases, and outputting visual results, the problem of low testing efficiency in distributed service testing is solved, and testing efficiency and the clarity of business data processing are improved.

CN115203027BActive Publication Date: 2026-06-23INDUSTRIAL AND COMMERCIAL BANK OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INDUSTRIAL AND COMMERCIAL BANK OF CHINA
Filing Date
2022-06-27
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

In existing technologies, distributed service testing requires manual installation and connection to multiple databases. Testers need to be proficient in various database operations, which leads to low testing efficiency, unclear business data processing logic, and a lot of repetitive operations, thus affecting the test results.

Method used

By configuring database connections into the model through a data integration model, a target model definition file is generated. Based on this file, test script cases are generated and executed to output visual test results, reducing the reliance on database operations by testers.

Benefits of technology

It reduces the workload of manual testing, improves testing efficiency, allows testers to focus on the business data flow process, and simplifies test plan review and scenario reproduction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115203027B_ABST
    Figure CN115203027B_ABST
Patent Text Reader

Abstract

The present disclosure provides a test method based on a data integration model, which can be applied to the field of financial technology. The method comprises: connecting each database to the data integration model according to a database configuration file; inputting a business data processing flowchart into the data integration model to generate a target model definition file, wherein the target model definition file is used to represent the data relationship between the input and output of the service to be tested and each database table, and the business data processing flowchart is determined according to the data integration model and business data processing flow information; generating at least one test script case according to the target model definition file and the data integration model; and executing the test script case to output a visual test result. The present disclosure also provides a test device based on a data integration model, equipment, a storage medium and a program product.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, specifically to the field of distributed service testing technology, and more specifically to a testing method, apparatus, device, storage medium, and program product based on a data integration model. Background Technology

[0002] With the development of distributed technologies, distributed platform services are widely used in various applications, which in turn places higher demands on the testing of distributed platform services. To ensure service reusability, a single service often completes a relatively independent function, while a complex business scenario often requires the combination of multiple services. For example, in a multi-service integration environment, a service implementing complex banking business often needs to combine services from multiple different applications to implement its business processing. These combined services from different applications often need to access and process data from multiple different databases.

[0003] Manual testing of distributed services in related technologies requires manually installing clients to connect to multiple databases. This involves several steps: pre-service data preparation (manually querying multiple databases for pre-transaction service data registration, or performing pre-transaction data changes or deletions); post-service data verification (manually preparing data before testing and verifying data after the transaction); and post-service data recovery (manually changing or deleting data to ensure better execution of subsequent transactions). This testing method requires testers to be proficient in various database operations, which is detrimental to testing efficiency.

[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0005] In view of the above problems, this disclosure provides test methods, apparatus, devices, media and program products based on data integration models to improve test efficiency.

[0006] According to the first aspect of this disclosure, a testing method based on a data integration model is provided, comprising:

[0007] Configure each database connection into the data integration model according to the database configuration file;

[0008] The business data processing flowchart is input into the data integration model to generate a target model definition file. The target model definition file is used to characterize the data relationships between the input and output of the service to be tested and each database table. The business data processing flowchart is determined based on the data integration model and the business data processing flow information.

[0009] Generate at least one test script case based on the target model definition file and the data integration model; and

[0010] Execute the test script example to output visual test results.

[0011] According to embodiments of this disclosure, inputting the business data processing flowchart into the data integration model to generate a target model definition file includes:

[0012] Identify the operation identifiers in the business data processing flowchart;

[0013] The data relationship between the input / output fields of the service under test and the fields of each database table is determined based on the operation identifier; and

[0014] The target model definition file is generated by parsing the database data operations in the data relationship and data integration model. The target model definition file is in XML format.

[0015] According to embodiments of this disclosure, generating at least one test script case based on the target model definition file and the data integration model includes:

[0016] Based on the target model definition file and the data integration model, generate a test script Excel file and a test script execution Java file.

[0017] According to embodiments of this disclosure, the data integration model includes a data preparation sub-model, a data assertion sub-model, and a data recovery sub-model. The step of generating a test script Excel file based on the target model definition file and the data integration model includes:

[0018] Generate a data preparation test script Excel file based on the target model definition file and the data preparation sub-model;

[0019] Generate a data assertion test script Excel file based on the target model definition file and the data assertion sub-model;

[0020] Generate a data recovery test script Excel file based on the target model definition file and the data recovery sub-model; and

[0021] Based on the data, prepare the test script Excel file, the data assertion test script Excel file, and the data recovery test script Excel file to generate the test script Excel file.

[0022] According to embodiments of this disclosure, the database configuration file includes a database definition XML file, an attribute definition file, and a route definition file. The step of configuring each database connection into the data integration model according to the database configuration file includes:

[0023] The data source connection attributes are determined based on the database definition XML file. The data source connection attributes include each database name, database connection information, and database login verification information.

[0024] Determine the attribute values ​​corresponding to the data source connection attributes based on the attribute definition file; and

[0025] Configure each database connection to the data integration model according to the attribute values ​​corresponding to the data source connection attributes.

[0026] According to embodiments of this disclosure, the databases include Oracle, MySQL, and DB2.

[0027] A second aspect of this disclosure provides a test apparatus based on a data integration model, comprising: a database configuration module for configuring each database connection into the data integration model according to a database configuration file;

[0028] The first generation module is used to input the business data processing flowchart into the data integration model to generate a target model definition file. The target model definition file is used to characterize the data relationship between the input and output of the service to be tested and each database table. The business data processing flowchart is determined based on the data integration model and the business data processing flow information.

[0029] The second generation module is used to generate at least one test script case based on the target model definition file and the data integration model; and

[0030] The execution module is used to execute the test script cases to output visual test results.

[0031] According to embodiments of this disclosure, the first generation module includes:

[0032] The identification submodule is used to identify the operation identifiers in the business data processing flowchart;

[0033] The first determining submodule is used to determine the data relationship between the input / output fields of the service to be tested and the fields of each database table based on the operation identifier; and

[0034] The first generation submodule is used to parse and generate a target model definition file based on the data relationships and database data operations in the data integration model. The target model definition file is in XML format.

[0035] According to embodiments of this disclosure, the second generation module includes:

[0036] The second generation submodule is used to generate a test script Excel file and a test script execution Java file based on the target model definition file and the data integration model.

[0037] According to embodiments of this disclosure, the second generation submodule includes:

[0038] The first generation unit is used to generate a data preparation test script Excel file based on the target model definition file and the data preparation sub-model.

[0039] The second generation unit is used to generate a data assertion test script Excel file based on the target model definition file and the data assertion sub-model.

[0040] The third generation unit is used to generate a data recovery test script Excel file based on the target model definition file and the data recovery sub-model; and

[0041] The fourth generation unit is used to generate a test script Excel file based on the data, the data assertion test script Excel file, and the data recovery test script Excel file.

[0042] According to embodiments of this disclosure, the database configuration module includes:

[0043] The second determination submodule is used to determine the data source connection attributes based on the database definition XML file. The data source connection attributes include each database name, database connection information, and database login verification information.

[0044] The third determination submodule is used to determine the attribute value corresponding to the data source connection attribute based on the attribute definition file; and

[0045] The connection configuration submodule is used to configure each database connection to the data integration model according to the attribute values ​​corresponding to the data source connection attributes.

[0046] A third aspect of this disclosure provides an electronic device comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors perform the aforementioned test method based on a data integration model.

[0047] A fourth aspect of this disclosure also provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the above-described test method based on the data integration model.

[0048] The fifth aspect of this disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described test method based on the data integration model.

[0049] This disclosure provides a data integration model-based testing method. It configures database connections into a data integration model using database configuration files, generates a target model definition file from a business data processing flowchart based on the data integration model, inputs the target model definition file into the data integration model to generate test script cases, and executes the test script cases to output visualized test results. Compared to related technologies, this data integration model-based testing method eliminates the need for testers to be familiar with multiple database operations, allowing them to focus on the flow of business data, reducing manual testing workload, and improving testing efficiency. Attached Figure Description

[0050] The foregoing contents, as well as other objects, features, and advantages of this disclosure, will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:

[0051] Figure 1 The illustration schematically depicts an application scenario of a test method, apparatus, device, medium, and program product based on a data integration model according to embodiments of the present disclosure;

[0052] Figure 2 A flowchart illustrating a test method based on a data integration model according to an embodiment of the present disclosure is shown schematically;

[0053] Figure 3 A flowchart illustrating a database connection configuration method according to an embodiment of the present disclosure is shown schematically.

[0054] Figure 4a A schematic diagram illustrating a business data processing flowchart according to an embodiment of the present disclosure is shown.

[0055] Figure 4b A flowchart illustrating a method for generating a target model definition file according to an embodiment of the present disclosure is shown schematically.

[0056] Figure 5a This is one of the flowcharts for a method of generating test script cases according to an embodiment of this disclosure;

[0057] Figure 5b This is a second flowchart of a method for generating test script cases according to embodiments of this disclosure;

[0058] Figure 6a This illustration schematically shows a data preparation sub-model data operation according to an embodiment of the present disclosure;

[0059] Figure 6bThis illustration schematically depicts a data operation diagram of a data assertion submodel according to an embodiment of the present disclosure;

[0060] Figure 6c This illustration schematically depicts a data recovery sub-model data operation according to an embodiment of the present disclosure;

[0061] Figure 7 A schematic diagram illustrating a test apparatus based on a data integration model according to an embodiment of the present disclosure is shown; and

[0062] Figure 8 A block diagram schematically illustrates an electronic device suitable for implementing a test method based on a data integration model according to an embodiment of the present disclosure. Detailed Implementation

[0063] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.

[0064] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0065] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0066] When using expressions such as "at least one of A, B, and C", they should generally be interpreted in accordance with the meaning that is commonly understood by a person skilled in the art (e.g., "a system having at least one of A, B, and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B, and C, etc.).

[0067] First, let's explain the terms that appear in this disclosure:

[0068] Data integration model: In this embodiment, a model is established for querying, modifying, and deleting test data from different databases, as well as the data relationships between different databases. It mainly includes three types of sub-models: data preparation sub-model, data assertion sub-model, and data recovery sub-model.

[0069] Apache POI technology is a free, open-source, cross-platform Java API written in Java. Apache POI provides Java programs with the ability to read and write Microsoft Office format files.

[0070] MySQL is a relational database management system. It is one of the most popular relational database management systems, and in web applications, it is one of the best RDBMS (Relational Database Management System) application software.

[0071] IBM DB2 is a relational database management system developed by IBM. Its primary operating environments are UNIX (including IBM's own AIX), Linux, IBMi (formerly OS / 400), z / OS, and Windows server versions. DB2 is mainly used in large-scale application systems, has good scalability, supports environments from mainframes to single-user environments, and is applicable to all common server operating system platforms.

[0072] Oracle: A relational database management system. It is a highly efficient, reliable database suitable for high throughput.

[0073] To ensure service reusability, a single service typically performs a relatively independent function, while a complex business scenario often requires the combination of multiple services. For example, in a multi-service integration environment, a service implementing complex banking operations often needs to combine services from multiple different applications to implement its business processing. These combined services from different applications often need to access and process data from multiple different databases. For instance, purchasing a structured deposit product requires accessing the personal finance system's mainframe (DB2 database) and platform (MySQL database) for media and fund checks, accessing the customer information system (MySQL database) for customer information checks, and accessing the asset system (Oracle database) for customer asset checks, etc. If manual testing is used, clients connecting to multiple databases need to be installed manually, and connections to multiple databases need to be established manually. Pre-service data preparation involves manually querying data from multiple databases for pre-transaction service data registration, or performing pre-transaction data changes or deletions. Post-service data verification involves manually performing pre-test data preparation and post-transaction data verification. Post-service data recovery involves manually performing data changes or deletions to ensure better execution of subsequent transactions.

[0074] The above testing method has the following problems:

[0075] 1. Multiple database clients need to be installed for testing, requiring simultaneous access to multiple databases. This places high demands on the testers' technical skills, requiring them to be proficient in various database operations. This increases the technical requirements for testers, and their skill level significantly impacts testing effectiveness. Furthermore, it prevents testers from focusing their main efforts on understanding the business data flow relationships themselves.

[0076] 2. The business data processing logic in the business scenario lacks a clear and visible view, which is not conducive to test plan review and test scenario reproduction.

[0077] 3. Each database operation is performed manually, resulting in a large number of repetitive manual testing operations across different scenarios, which is detrimental to testing efficiency. This is especially true when a modification to a single component necessitates regression testing of all functionalities, requiring a significant amount of repetitive manual testing.

[0078] To address the aforementioned technical issues, embodiments of this disclosure provide a testing method based on a data integration model, comprising: configuring database connections into a data integration model according to a database configuration file; inputting a business data processing flowchart into the data integration model to generate a target model definition file, wherein the target model definition file is used to characterize the data relationships between the input and output of the service under test and the database tables, and the business data processing flowchart is determined based on the data integration model and business data processing flow information; generating at least one test script case based on the target model definition file and the data integration model; and executing the test script case to output visual test results.

[0079] Figure 1 The illustration schematically depicts an application scenario of a test method, apparatus, device, medium, and program product based on a data integration model according to embodiments of the present disclosure.

[0080] like Figure 1 As shown, application scenario 100 according to this embodiment may include a distributed microservice testing scenario. Network 104 is used as a medium to provide a communication link between terminal devices 101, 102, 103 and server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0081] Testers can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0082] Terminal devices 101, 102, and 103 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0083] Server 105 can be a test case generation server that generates test cases based on the business data flow information input by testers. For example, in response to test instructions issued by testers using terminal devices 101, 102, and 103, the test case generation server can analyze and process the received business data flow information, input a preset data integration model, and automatically generate test cases.

[0084] It should be noted that the data integration model-based testing method provided in this disclosure embodiment can generally be executed by server 105. Correspondingly, the data integration model-based testing device provided in this disclosure embodiment can generally be located in server 105. The data integration model-based testing method provided in this disclosure embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with terminal devices 101, 102, 103 and / or server 105. Correspondingly, the data integration model-based testing device provided in this disclosure embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with terminal devices 101, 102, 103 and / or server 105.

[0085] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0086] It should be noted that the testing method and apparatus based on the data integration model determined in the embodiments of this disclosure can be used in the field of automated testing in the financial field, and can also be used in any field other than the financial field. The application field of the testing method and apparatus based on the data integration model determined in the embodiments of this disclosure is not limited.

[0087] The following will be based on Figure 1 The described scene, through Figures 2 to 6c The testing method based on the data integration model of the present disclosure will be described in detail.

[0088] Figure 2 A flowchart illustrating a test method based on a data integration model according to an embodiment of this disclosure is shown schematically. Figure 2As shown, the data integration model-based testing method in this embodiment includes operations S210 to S240. This method can be executed by an automated testing tool, which is developed based on TestNG using the data integration model. It is a unified-view, multi-database integration automated testing tool. Users can use this tool to build a data integration model, simulate the entire business data processing flow, and then the background translates the model into business data processing flow code. Based on the business data processing flow code, a unified-style test script is automatically generated, greatly reducing the requirements for testers' ability to operate various databases. Secondly, this tool uses the data integration model for automated testing. Testers can use the model as a visual representation to express various database operations and compare the data relationships between different databases, which is beneficial for test plan and case review and accurately replicates the business data processing flow. In addition, the tool provides various convenient functions and assertion templates, which testers can use by filling in Excel, which is convenient and quick, greatly reducing the amount of coding. The tool also supports filling in Excel for data preparation and data recovery, preparing for automated testing. At the same time, the tool supports filling in Excel for assertions, allowing testers to customize personalized assertions according to actual business data processing requirements. The specific test process will be described below in conjunction with operations S210 to S240.

[0089] In operation S210, each database connection is configured into the data integration model according to the database configuration file.

[0090] In one example, to allow testers to focus on understanding the business data flow, this data integration model integrates data relationships accessing different databases. Test users don't need to worry about which database the data originates from; they only need to test the correctness of the service's data flow based on the business processing logic. Before testing, database parameters need to be configured and a database configuration file generated based on the database information used in the business data flow. Then, the various types of database connections are configured into the data integration model according to the database configuration file. For details, please refer to [link to relevant documentation]. Figure 3 Operations S211 to S213 are shown. They will not be described in detail here.

[0091] In operation S220, the business data processing flowchart is input into the data integration model to generate the target model definition file.

[0092] According to embodiments of this disclosure, the target model definition file is used to characterize the data relationships between the inputs and outputs of the service to be tested and the various database tables, and the business data processing flowchart is determined based on the data integration model and the business data processing flow information.

[0093] In one example, the business data processing flowchart is determined based on the data integration model and the actual business data processing flow. The business data processing flowchart is used as input to the data integration model, and after translation, a target model definition file is generated. This file is used to integrate the data relationships between service inputs / outputs and various database tables, such as data logic processing related to querying, modifying, and deleting data in the database. These data flows are all related to specific business service processing logic. The process of generating the target model definition file can be seen in operations S221 to S223 shown in Figure 4, and will not be elaborated further here.

[0094] In operation S230, at least one test script case is generated based on the target model definition file and the data integration model.

[0095] In one example, an automated testing tool translates a target model definition file into an executable test script. Specifically, the process involves using the target model definition file as input to generate a test script Excel file and a Java file for service execution. The test script Excel file is generated using Apache POI to manipulate Microsoft Excel, and the Java file for service execution is generated using Java's input / output stream technology to create the Java script for service execution. See operation S231 in Figure 5 for details.

[0096] In operation S240, the test script case is executed to output visual test results.

[0097] In one example, a test case script is executed, and the test results are output. The results are then verified based on the test scenario following the script's execution. Testers fill in query conditions and expected values ​​in the database tables. The tool uses Apache POI to read and interpret assertion data, accesses the database via JDBC, queries, deletes, and modifies database data, stores the judgment results in a color-coded object, and records the script execution results in an Excel spreadsheet via Apache POI. Table fields that pass assertions are marked in green, and those that pass assertions are marked in red.

[0098] Specifically, the process involves concatenating and processing SQL statements, determining the results, and storing them in a color-coded object. This is then recorded in an Excel file using Apache POI. Successfully executed SQL statements are marked in green, while those that fail are marked in yellow. Partial data from the `dataArray` is synchronized to the `Input` or `Request` object. A request object is retrieved from Spring, and data is requested from the service. The service's return result is stored in an `outputMap` and recorded in an Excel file using Apache POI. Outputs that meet expectations are marked in green, otherwise in red. The tool uses Apache POI to read and interpret assertion data, accesses the database via JDBC, queries, deletes, and modifies database data, and stores the results in a color-coded object. This is recorded in an Excel file using Apache POI. Table fields that pass assertions are marked in green, and those that pass are marked in red. Finally, Apache POI is used to read and restore data. The program interprets the data, accesses the database via JDBC, queries, deletes, and modifies database data, stores the results in a color-coded object, and records them in an Excel file using Apache POI.

[0099] This disclosure provides a data integration model-based testing method. It configures database connections into a data integration model using database configuration files, generates a target model definition file from a business data processing flowchart based on the data integration model, inputs the target model definition file into the data integration model to generate test script cases, and executes the test script cases to output visualized test results. Compared to related technologies, this data integration model-based testing method eliminates the need for testers to be familiar with multiple database operations, allowing them to focus on the flow of business data, reducing manual testing workload, and improving testing efficiency.

[0100] Figure 3 A flowchart illustrating a database connection configuration method according to an embodiment of this disclosure is shown schematically. Figure 3 As shown, operation S210 includes operations S211 to S213.

[0101] In operation S211, the data source connection attributes are determined according to the database definition XML file.

[0102] According to embodiments of this disclosure, the data source connection attributes include each database name, database connection information, and database login verification information.

[0103] In operation S212, the attribute value corresponding to the data source connection attribute is determined according to the attribute definition file.

[0104] In operation S213, each database connection is configured into the data integration model according to the attribute values ​​corresponding to the data source connection attributes.

[0105] According to embodiments of this disclosure, the database configuration file includes a database definition XML file, an attribute definition file, and a route definition file.

[0106] According to embodiments of this disclosure, the databases include Oracle, MySQL, and DB2.

[0107] In one example, each database connection consists of two main parts: configuring the data source connection properties and the data source session factory. Configuring the data source connection properties is crucial because large development companies often involve multi-version testing, frequently requiring connections to different database addresses to test different versions of services. Therefore, these properties can be flexibly configured using values ​​from the property definition file, with variable names consistent with the property definition file. For example: Database name: `driver ClassName` defines the variable `${driver Class Name}`; Database connection (database IP and port): `url` defines the variable `${PRDS_APP_ACCESS_1url}`; Database username: `username` defines the variable `${username}`; Database password: `password` defines the variable `${password}`. Properties that are fixed and not frequently modified can use fixed parameter values. For example, the maximum number of active connections: `maxActive` can be fixed at 50. Configurers configure the database connection parameters in the property definition file, including: Database name `driver Class Name` = `com.mysql.jdbc.Driver`, Database connection (database IP and port), Database username: `username` = `appuser`, Database password: `password` = `app`, etc.

[0108] The routing definition file primarily addresses the data access method of distributed databases using SETs (shards). This file routes data operations to the corresponding SET (shard) based on the system-defined SET (shard) rules. Current distributed databases, such as MySQL, support splitting a table's data into multiple SETs (shards) for storage to compensate for the access congestion and inefficiency that can occur with centralized databases. For example, when storing data, banking systems tend to store information for the same customer in the same SET (shard) to ensure continuous service. Therefore, customer-related services commonly use customer information numbers for routing. The operation rule generally uses modulo arithmetic. If the system database is divided into 8 SETs (shards), the operation M%8 can be used, with the result serving as the target SET (shard).

[0109] Based on the configuration information in the database configuration file, it can automatically connect to various types of databases, such as Oracle, MySQL, DB2, or other types of databases.

[0110] Figure 4a A schematic diagram illustrating a business data processing flowchart according to an embodiment of the present disclosure is shown. Figure 4b A flowchart illustrating a method for generating a target model definition file according to an embodiment of this disclosure is shown schematically. Figure 4b As shown, operation S220 includes operations S221 to S223.

[0111] In operation S221, the operation identifier in the business data processing flowchart is identified.

[0112] In operation S222, the data relationship between the input / output fields of the service to be tested and the fields of each database table is determined according to the operation identifier.

[0113] In operation S223, a target model definition file is generated based on the data relationship and database data operation parsing in the data integration model.

[0114] According to embodiments of this disclosure, the target model definition file is in XML format.

[0115] In one example, such as Figure 4a As shown, the operation identifiers include "=" and "+". These identifiers represent the data relationships between the input / output fields of the service under test and the fields of each database table. For example, "=" represents the correspondence between a field in two tables, and "+" represents the logical operation relationship between the fields. For instance, as... Figure 4a In this context, S1 indicates that field 1 in the service input communication area is equal to field 1 from table 1 of the MySQL database; S2 indicates that the sum of fields 2 and 3 in the service input communication area is equal to field 2 from table 2 of the Oracle database; S3 indicates that field 3 from table 1 of the MySQL database is equal to field 3 from table 2 of the Oracle database; and S4 indicates that field 3 in the service output communication area is equal to field 3 from table n of the DB2 database.

[0116] The data integration model takes database data operations (including queries, modifications, and deletions) and relationships between data points as input, and parses them using a tool to convert them into an XML model definition file as output. The model's diagrams are then converted into XML format definitions. For example, the entire table definition uses a resultMap, each data field in the table uses a column definition, database queries are represented by `fetch_XXX_table_xxx_field`, database modifications are represented by `update_XXX_table_xxx_field`, and database deletions are represented by `delete_XXX_table_xxx_field`, etc.

[0117] Figure 5a This is one of the flowcharts for a method of generating test script cases according to an embodiment of this disclosure. Figure 5b This is a second flowchart of a method for generating test script cases according to an embodiment of this disclosure. Figure 6a This illustration schematically shows a data preparation sub-model data operation according to an embodiment of the present disclosure. Figure 6b This illustration schematically depicts data operations of a data assertion submodel according to an embodiment of the present disclosure. Figure 6c The illustration shows a schematic diagram of data recovery submodel data operation according to an embodiment of the present disclosure.

[0118] like Figure 5a As shown, operation S230 includes operation S231.

[0119] In operation S231, a test script Excel file and a test script execution Java file are generated based on the target model definition file and the data integration model.

[0120] According to embodiments of this disclosure, the data integration model includes a data preparation sub-model, a data assertion sub-model, and a data recovery sub-model.

[0121] In one example, an XML model definition file is used as input, and Microsoft Excel is manipulated using Apache POI to generate the test case. Testers can edit this Excel file to control whether a particular test case is executed, executed locally, or automatically (deployed to the server for daily execution). The test script executes a Java file: using the XML model definition file as input, a Java script is generated for service execution through Java's input / output stream technology. This is an executable Java file that takes the test script Excel file as input, and it also serves as the tool for implementing test case execution and automated execution.

[0122] Specifically, such as Figure 5b As shown, operation S231 includes operations S2311 to S2314.

[0123] In operation S2311, a data preparation test script Excel file is generated based on the target model definition file and the data preparation sub-model.

[0124] In one example, such as Figure 6a As shown, the data operations described in the data preparation sub-model are as follows: Table 1 from the MySQL database performs a query operation. Before the service is executed, based on field 1 equal to A and field 2 equal to B, table 1 is queried, and the query results are stored in a datebean for later comparison with the assertion model. Table 2 from the Oracle database performs a modification operation. Before the service is executed, based on field 1 equal to A, table 2 is queried, and field 3 is updated to 5. Table n from the DB2 database performs a deletion operation. Before the service is executed, based on field 1 equal to A, field 2 equal to B, and field 3 equal to C, table n is queried, and records in table n are deleted.

[0125] Before service execution, the tool executes the data preparation test script Excel file generated by the data preparation sub-model to complete data preparation and cleanup. Each database operation is automatically populated into the data preparation column of the test script Excel, such as: Table XXX.Query Condition 1.Query, indicating a query to table XXX based on query condition 1, consistent with the description in the data preparation model. These database operations will be performed before service execution. Based on the type of data preparation request (query, update, delete) and database type (MySQL, DB2, Oracle, etc.), the tool interprets the data and constructs SQL to perform the corresponding database operations. The retrieved database data is stored in a datebean for later comparison with the assertion model.

[0126] In operation S2312, a data assertion test script Excel file is generated based on the target model definition file and the data assertion sub-model.

[0127] like Figure 6bAs shown, the data verification relationships described by the data assertion sub-model are as follows: Field 1 in the service input communication area is equal to Field 1 from Table 1 of the MySQL database; the sum of Fields 2 and 3 in the service input communication area is equal to Field 2 from Table 2 of the Oracle database; Field 3 from Table 1 of the MySQL database is equal to Field 3 from Table 2 of the Oracle database; Field 3 in the service output communication area is equal to Field 3 from Table n of the DB2 database. After the service is executed, the tool executes the data assertion test script Excel file generated by the data assertion sub-model to automatically verify the data and ensure that the data is updated correctly. Each database operation information is automatically populated into the assertion column of the test script Excel, such as: Table XXX.Query Condition 1.Expected Value 1, indicating that the query is performed on Table XXX according to query condition 1, the expected result will be compared with the target value described in the data assertion model, and the comparison result will be written to the result file as the output. These database operations will be performed after the service is executed. Based on the type of data preparation request (query, update, delete, etc.) and the database type (MySQL, DB2, Oracle, etc.), the data is interpreted and SQL is concatenated to perform the corresponding database operations, and the data is compared with the data in the target database.

[0128] In operation S2313, a data recovery test script Excel file is generated based on the target model definition file and the data recovery sub-model.

[0129] In one example, such as Figure 6cAs shown, the data recovery model describes the following data operations: From table 1 of the MySQL database, a data modification operation is performed. Before the service execution, based on field 1 equal to A and field 2 equal to B, table 1 is queried, and field 3 is updated to 3. From table 2 of the Oracle database, a data modification operation is performed. Before the service execution, based on field 1 equal to A, table 2 is queried, and field 3 is updated to 5. From table n of the DB2 database, a data deletion operation is performed. Before the service execution, based on field 1 equal to A, field 2 equal to B, and field 3 equal to C, table n is queried, and database records in table n are deleted. After the service is executed, the tool executes the data recovery script generated by the data recovery sub-model to complete automatic data recovery. Each database operation information is automatically populated into the assertion column of the test script Excel, such as: table XXX.query condition 1.update 1, indicating that table XXX is queried based on query condition 1, and the queried database records are updated according to the values ​​described in update 1. These database operations will be performed after the service execution. Based on the type of data preparation request (update, delete) and the database type (MySQL, DB2, Oracle), the data is interpreted and SQL is concatenated to perform the corresponding database operations, thereby achieving automatic data cleanup. In operation S2314, a test script Excel file is generated based on the data preparation test script Excel file, the data assertion test script Excel file, and the data recovery test script Excel file.

[0130] In operation S2314, a test script Excel file is generated based on the data preparation test script Excel file, the data assertion test script Excel file, and the data recovery test script Excel file.

[0131] In one example, the three Excel files mentioned above are combined into a single test script Excel file according to a specific test scenario. This Excel file contains multiple test cases, including three types of test scripts: data preparation, data assertion, and data recovery.

[0132] Based on the above-described data integration model-based testing method, this disclosure also provides a data integration model-based testing apparatus. The following will combine... Figure 7 The device is described in detail.

[0133] Figure 7 A schematic block diagram of a test apparatus based on a data integration model according to an embodiment of the present disclosure is shown.

[0134] like Figure 7 As shown, the test device 800 based on the data integration model in this embodiment includes a database configuration module 810, a first generation module 820, a second generation module 830, and an execution module 840.

[0135] The database configuration module 810 is used to configure each database connection into the data integration model according to the database configuration file. In one embodiment, the database configuration module 810 can be used to perform the operation S210 described above, which will not be repeated here.

[0136] The first generation module 820 is used to input the business data processing flowchart into the data integration model to generate a target model definition file. In one embodiment, the first determination module 820 can be used to perform the operation S220 described above, which will not be repeated here.

[0137] The second generation module 830 is used to generate at least one test script case based on the target model definition file and the data integration model. In one embodiment, the second generation module 830 can be used to perform the operation S230 described above, which will not be repeated here.

[0138] The execution module 840 is used to execute the test script case to output visual test results. In one embodiment, the execution module 840 can be used to perform the operation S240 described above, which will not be repeated here.

[0139] According to embodiments of this disclosure, the first generation module 820 includes: an identification submodule, a first determination submodule, and a first generation submodule.

[0140] The identification submodule is used to identify the operation identifiers in the business data processing flowchart. In one embodiment, the identification submodule can be used to execute the operation S221 described above, which will not be repeated here.

[0141] The first determining submodule is used to determine the data relationship between the input / output fields of the service to be tested and the fields of each database table based on the operation identifier. In one embodiment, the first determining submodule can be used to perform the operation S222 described above, which will not be repeated here.

[0142] The first generation submodule is used to parse and generate a target model definition file based on the data relationships and database data operations in the data integration model. The target model definition file is in XML format. In one embodiment, the first generation submodule can be used to perform the operation S223 described above, which will not be repeated here.

[0143] According to embodiments of this disclosure, the second generation module includes a second generation submodule.

[0144] The second generation submodule is used to generate a test script Excel file and a test script execution Java file based on the target model definition file and the data integration model. In one embodiment, the second generation submodule can be used to perform the operation S241 described above, which will not be repeated here.

[0145] According to embodiments of this disclosure, the second generation submodule includes: a first generation unit, a second generation unit, and a third generation unit.

[0146] The first generation unit is configured to generate a data preparation test script Excel file based on the target model definition file and the data preparation sub-model. In one embodiment, the first generation unit may be used to perform the operation S2411 described above, which will not be repeated here.

[0147] The second generation unit is used to generate a data assertion test script Excel file based on the target model definition file and the data assertion sub-model. In one embodiment, the second generation unit can be used to perform the operation S2412 described above, which will not be repeated here.

[0148] The third generation unit is used to generate a data recovery test script Excel file based on the target model definition file and the data recovery sub-model. In one embodiment, the third generation unit can be used to perform the operation S2413 described above, which will not be repeated here.

[0149] The fourth generation unit is used to generate a test script Excel file based on the data preparation test script Excel file, the data assertion test script Excel file, and the data recovery test script Excel file. In one embodiment, the fourth generation unit can be used to perform the operation S2414 described above, which will not be repeated here.

[0150] According to embodiments of this disclosure, the database configuration module includes: a second determination submodule, a third determination submodule, and a connection configuration submodule.

[0151] The second determining submodule is used to determine the data source connection attributes based on the database definition XML file. These attributes include database names, database connection information, and database login verification information. In one embodiment, the second determining submodule can be used to perform the operation S211 described above, which will not be repeated here.

[0152] The third determining submodule is used to determine the attribute value corresponding to the data source connection attribute based on the attribute definition file. In one embodiment, the third determining submodule can be used to perform the operation S212 described above, which will not be repeated here.

[0153] The connection configuration submodule is used to configure each database connection to the data integration model according to the attribute values ​​corresponding to the data source connection attributes. In one embodiment, the connection configuration submodule can be used to perform the operation S213 described above, which will not be repeated here.

[0154] According to embodiments of this disclosure, any plurality of modules among the database configuration module 810, the first generation module 820, the second generation module 830, and the execution module 840 may be combined into one module, or any one of these modules may be split into multiple modules. Alternatively, at least a portion of the functionality of one or more of these modules may be combined with at least a portion of the functionality of other modules and implemented in one module. According to embodiments of this disclosure, at least one of the database configuration module 810, the first generation module 820, the second generation module 830, and the execution module 840 may be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging circuitry, or implemented in any one of software, hardware, and firmware methods, or in a suitable combination of any of these methods. Alternatively, at least one of the database configuration module 810, the first generation module 820, the second generation module 830, and the execution module 840 may be implemented at least partially as a computer program module, which can perform corresponding functions when the computer program module is run.

[0155] Figure 8 A block diagram schematically illustrates an electronic device suitable for implementing a test method based on a data integration model according to an embodiment of the present disclosure.

[0156] like Figure 8 As shown, an electronic device 900 according to an embodiment of the present disclosure includes a processor 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage portion 908 into a random access memory (RAM) 903. The processor 901 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 901 may also include onboard memory for caching purposes. The processor 901 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0157] RAM 903 stores various programs and data required for the operation of electronic device 900. Processor 901, ROM 902, and RAM 903 are interconnected via bus 904. Processor 901 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 902 and / or RAM 903. It should be noted that the programs may also be stored in one or more memories other than ROM 902 and RAM 903. Processor 901 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in said one or more memories.

[0158] According to embodiments of this disclosure, the electronic device 900 may further include an input / output (I / O) interface 905, which is also connected to a bus 904. The electronic device 900 may also include one or more of the following components connected to the I / O interface 905: an input section 906 including a keyboard, mouse, etc.; an output section 907 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 910 as needed so that computer programs read from it can be installed into the storage section 908 as needed.

[0159] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the test method based on the data integration model according to embodiments of this disclosure.

[0160] According to embodiments of this disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this disclosure, the computer-readable storage medium may include ROM 902 and / or RAM 903 and / or one or more memories other than ROM 902 and RAM 903 described above.

[0161] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code enables the computer system to implement the data integration model-based testing method provided in embodiments of this disclosure.

[0162] When the computer program is executed by the processor 901, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0163] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and downloaded and installed via the communication section 909, and / or installed from a removable medium 911. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.

[0164] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 909, and / or installed from the removable medium 911. When the computer program is executed by the processor 901, it performs the functions defined in the system of this disclosure embodiment. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0165] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0166] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0167] Those skilled in the art will understand that the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways, even if such combinations or combinations are not explicitly described in this disclosure. In particular, the features described in the various embodiments and / or claims of this disclosure can be combined or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.

[0168] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. The scope of this disclosure is defined by the appended claims and their equivalents. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.

Claims

1. A testing method based on a data integration model, characterized in that, The testing method includes: Configure each database connection into the data integration model according to the database configuration file; The business data processing flowchart is input into the data integration model to generate a target model definition file. The target model definition file is used to characterize the data relationships between the input and output of the service to be tested and each database table. The business data processing flowchart is determined based on the data integration model and the business data processing flow information. Generate at least one test script case based on the target model definition file and the data integration model; and Execute the test script example to output visual test results; The data integration model includes a data preparation sub-model, a data assertion sub-model, and a data recovery sub-model. The data preparation sub-model is used to generate a data preparation test script Excel file based on the target model definition file. The data assertion sub-model is used to generate a data assertion test script Excel file based on the target model definition file. The data recovery sub-model is used to generate a data recovery test script Excel file based on the target model definition file. The step of inputting the business data processing flowchart into the data integration model to generate the target model definition file includes: Identify the operation identifiers in the business data processing flowchart; The data relationship between the input / output fields of the service under test and the fields of each database table is determined based on the operation identifier; and The target model definition file is generated by parsing the database data operations in the data relationship and data integration model. The target model definition file is in XML format.

2. The test method according to claim 1, characterized in that, The step of generating at least one test script case based on the target model definition file and the data integration model includes: Based on the target model definition file and the data integration model, generate a test script Excel file and a test script execution Java file.

3. The test method according to claim 2, characterized in that, The step of generating a test script Excel file based on the target model definition file and the data integration model includes: Generate a data preparation test script Excel file based on the target model definition file and the data preparation sub-model; Generate a data assertion test script Excel file based on the target model definition file and the data assertion sub-model; Generate a data recovery test script Excel file based on the target model definition file and the data recovery sub-model; and Based on the data, prepare the test script Excel file, the data assertion test script Excel file, and the data recovery test script Excel file to generate the test script Excel file.

4. The test method according to claim 1, characterized in that, The database configuration file includes a database definition XML file, an attribute definition file, and a route definition file. The step of configuring each database connection into the data integration model according to the database configuration file includes: The data source connection attributes are determined based on the database definition XML file. The data source connection attributes include each database name, database connection information, and database login verification information. Determine the attribute values ​​corresponding to the data source connection attributes based on the attribute definition file; and Configure each database connection to the data integration model according to the attribute values ​​corresponding to the data source connection attributes.

5. The test method according to any one of claims 1 to 4, characterized in that, The databases mentioned include Oracle, MySQL, and DB2.

6. A testing device based on a data integration model, characterized in that, The testing apparatus includes: The database configuration module is used to configure the connections of each database into the data integration model according to the database configuration file; The first generation module is used to input the business data processing flowchart into the data integration model to generate a target model definition file. The target model definition file is used to characterize the data relationship between the input and output of the service to be tested and each database table. The business data processing flowchart is determined based on the data integration model and the business data processing flow information. The second generation module is used to generate at least one test script case based on the target model definition file and the data integration model; and The execution module is used to execute the test script cases to output visual test results; The data integration model includes a data preparation sub-model, a data assertion sub-model, and a data recovery sub-model. The data preparation sub-model is used to generate a data preparation test script Excel file based on the target model definition file. The data assertion sub-model is used to generate a data assertion test script Excel file based on the target model definition file. The data recovery sub-model is used to generate a data recovery test script Excel file based on the target model definition file. The first generation module is also used to identify the operation identifiers in the business data processing flowchart; determine the data relationship between the input and output fields of the service to be tested and the fields of each database table based on the operation identifiers; and generate a target model definition file based on the data relationship and the database data operation parsing in the data integration model, wherein the target model definition file is in XML format.

7. An electronic device, comprising: One or more processors; Storage device for storing one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors perform the method according to any one of claims 1 to 5.

8. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 5.

9. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 5.