Data migration service testing system, method, equipment, medium and product
By providing a data migration service test system, automate the test process and reduce repetitive work, the problems of high thresholds and repetitive work in data migration service testing are solved, improving testing efficiency and simplifying data initialization operations.
Patent Information
- Application Number
- CN202411776812.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-04-04
AI Technical Summary
There is a lot of repetitive work in the data migration service testing. Testers need to manually execute SQL statements to generate test data, and they need to verify the main process in each iteration, which raises the threshold for testing.
Provides a data migration service testing system, including a test process orchestration module, a task debugging and execution module, a test library management module and a test data management module. These modules can automate the test process, reduce repetitive work, and support customized methods and online debugging.
By automating the test process and reducing repetitive work, the threshold for testing is lowered, testing efficiency is improved, data initialization operations are simplified, and the time for testing data migration services is shortened.
Smart Images

Figure CN119759761A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of software testing technology, and in particular to a data migration service testing system, method, device, medium and product. Background Art
[0002] Data migration services involve the migration of multiple types and versions of databases. To ensure the stability, reliability, and accuracy of data migration services, it is usually necessary to verify the migration of objects, field types, and other contents of various databases. Before verifying the functions of data migration services, testers usually need to complete a series of preparatory work such as database installation and configuration, test data generation, migration scenario generation, and data consistency judgment.
[0003] Since data migration services involve migration between multiple types of databases, testers also need to understand the corresponding SQL syntax and generate correct test data during the test data generation phase. These requirements undoubtedly raise the threshold for testing. In addition, during the product iteration process, there are some repetitive tasks, such as executing SQL statements in the source database to generate migration data and manually configuring migration tasks. Therefore, how to effectively reduce repetitive tasks, lower the test threshold, and form a unified process specification is a problem that needs to be solved at present. Summary of the invention
[0004] Embodiments of the present invention provide a data migration service testing system, method, device, medium and product to at least partially solve the above problems.
[0005] A first aspect of an embodiment of the present invention provides a data migration service testing system, the system comprising: a test process arrangement module, a task debugging and execution module, a test library management module and a test data management module; The test process orchestration module is used to receive configuration information and orchestrate the data migration service test task, wherein the configuration information is used to configure the global parameters of the test task, the test method of the test case, and the test assertion; The test library management module is used to manage the Docker container of the database included in the data migration service, including: database startup, configuration, connection and destruction; A test data management module, used to receive test data configuration information, and call the test library management module to configure test data based on the test data configuration information. The test data management module provides data migration services including all objects supported by the database, including tables, table data, views, functions, triggers, events, and stored procedures; The task debugging and execution module is used to obtain the test script corresponding to the test task based on the global parameters of the test task, the test method of the test case, the test assertion and the test data, send the test script to each agent node for execution, and obtain the execution result and execution log.
[0006] Optionally, the system further comprises: a task management module; The task management module is used to receive the execution time information for the test task, control the task debugging and execution module to execute the test task according to the execution time information of the test task, receive the execution result and execution log, generate and display the test report.
[0007] Optionally, the system further comprises: a use case management module, a test method management module, a test assertion module and a parameter management module; The use case management module is used to add, modify, delete, copy and export use case sets and test cases; The test method management module is used to save test methods and add, modify and delete test methods; The test assertion module is used to assert the output of the test method; The parameter management module is used to add, modify and delete parameter groups and parameters, so as to apply parameters to test cases by means of variable substitution; The test process arrangement module is used for: Based on the configuration information, configure the global parameters of the test task through the parameter management module; Create a use case set for the test task based on the use case management module, and create corresponding test cases under the use case set; Edit the test case, obtain the test method from the test method management module based on the configuration information, and configure the test method for the test case; Based on the configuration information, obtaining a test assertion from the test assertion module, and configuring a test assertion for the test case; Debugging the test method; If the test method is debugged successfully, debug the test case; When the test case is debugged successfully, the test case is saved.
[0008] Optionally, the test process arrangement module is also used to: When parameters need to be provided to subsequent test methods, the output of the test method is configured as local parameters for subsequent test methods to call.
[0009] A second aspect of an embodiment of the present invention provides a data migration service testing method, the method comprising: Configure the global parameters of the test task; Create a use case set and create corresponding test cases under the use case set; Edit the test case and configure the test method for the test case; Configure the input and test assertion of the test method for the test case; the input of the test method is the global parameter; Debugging the test method; If the test method is debugged successfully, debug the test case; If the test case is debugged successfully, save the test case; Obtain the test data and test cases corresponding to the test task and test the data migration service.
[0010] Optionally, obtain test data and test cases corresponding to the test task and test the data migration service, including: Get the test data corresponding to the test task; Get the test case set and global parameters included in the test task; Get the step topology diagram and test method of the test case; Replace the test method with a script, use the global parameters to replace the global parameters in the script, and generate a test script according to the step topology diagram; Executing the test script, generating local parameters according to the test script, and replacing the local parameters before executing each test method; Obtain and display the execution results and execution logs of each test script; Execute each test case in the test case set in sequence; Statistics the execution results and logs of each test case and generate a test report.
[0011] Optionally, obtain test data and test cases corresponding to the test task and test the data migration service, including: Receiving execution time information for the test task, and executing the test task according to the execution time information of the test task; Statistics the execution results and execution logs of each test case, and generate a test report.
[0012] A third aspect of an embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the data migration service testing method as described in the second aspect of the present invention when executed.
[0013] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the data migration service testing method as described in the second aspect of the present invention is implemented.
[0014] A fifth aspect of an embodiment of the present invention provides a computer program product, including a computer program / instruction, which is used by a processor to implement the steps in the data migration service testing method described in the second aspect of the present invention.
[0015] There is a lot of repetitive work in the verification process of the data migration service, and it is necessary to manually execute SQL statements on the database to generate test data. In addition, the main process needs to be verified in each iteration. Through the technical solution provided by the embodiment of the present invention, the tester only needs to paste the test data to the corresponding position of the system, and complete the configuration of the test data through the test data management module, and the test work can be carried out through the test assertions provided in the system.
[0016] In the embodiment of the present invention, the test tasks of the data migration service can be arranged through a visual interface, and custom methods and online debugging are supported. The test process arrangement module can be used to arrange the test process of the data migration service, support the reference of global / local parameters, online debugging and viewing logs, simplify the test operation, and improve the standardization and readability of the code. This allows testers with zero programming knowledge to quickly get started with the automated test process, greatly reducing the amount of code. In the embodiment of the present invention, the execution log and execution results can also be returned in real time, shortening the time for debugging use cases and lowering the threshold for testing.
[0017] The programmable data migration service test system provided by the embodiment of the present invention provides data templates of various databases, includes all objects supported by the data migration service, and supports user customization, thereby simplifying data initialization operations and shortening the time of data migration service testing.
[0018] In addition, based on the embodiment of the present invention, it can be set to be automatically triggered during non-working hours, and a visual test report will be generated after the test is completed. The tester only needs to locate the problem based on the failed test case, which can greatly improve the test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0020] Figure 1It is a schematic diagram of the structure of a data migration service test system provided by an embodiment of the present invention; Figure 2 is a flowchart of the steps of the data migration service testing method provided by an embodiment of the present invention; Figure 3 It is a flowchart of specific steps of arranging a test process in the data migration service testing method provided by an embodiment of the present invention; Figure 4 This is an example diagram of the topology arrangement of Oracle->PostgreSQL data migration steps obtained by the data migration service testing method provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of an execution log of an Oracle->PostgreSQL data migration test method obtained by a data migration service test method provided by an embodiment of the present invention; Figure 6 The specific content of the Oracle->PostgreSQL data migration test method execution log obtained by the data migration service test method provided by the embodiment of the present invention; Figure 7 It is an exemplary Python script exported by the data migration service testing method provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0021] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0022] First, the relevant terms involved in the embodiments of the present invention are explained: Global Parameters: Global parameters are pre-defined variables in the test environment. They remain unchanged throughout the test cycle or multiple test cases or are set once before the test starts. They are used to store common data that needs to be used in multiple test cases, such as database connection information, API endpoints, user authentication information, etc. Global parameters can be set in the configuration file or initialized in the test script.
[0023] Test Data: Test data is data prepared for specific test cases to simulate the actual operating environment and verify the expected results of the test cases.
[0024] Test Case: A test case is a set of conditions and steps to verify whether a specific function or scenario of the software works as expected. It usually contains preconditions, test steps, test data, expected results, etc.
[0025] Test Step Topology: A test step topology is a graphical representation of the order and dependencies of the steps in a test case. It helps to understand the structure and flow of the test case, as well as the logical relationship between the test steps. The test step topology can guide the design and execution of test cases.
[0026] Test Method: A test method is a function or procedure that implements a specific test step in a test case. It can be a separate test script or a method of a test class in a test framework. A test method usually accepts input parameters, executes test steps, and returns test results.
[0027] Test Script: A test script is a code that implements the test method and contains the specific logic for executing the test steps. A test script can be an automated test script or a guide document for manual testing. Test scripts are usually written in programming languages, such as Python, Java, C#, etc.
[0028] Test Assertions: A test assertion is a logical judgment in a test case, which is used to verify whether the result of the test execution meets the expectations and is the criterion for whether the test case is successful or not. Local Parameters: Local parameters are variables defined in a test case or test step, and their scope is limited to the current test case or test step.
[0029] In an embodiment of the present invention, a data migration service testing system is provided. Specifically, Figure 1 As shown, the data migration service testing system 100 includes: a test process arrangement module 101 , a task debugging and execution module 102 , a test library management module 103 and a test data management module 104 .
[0030] The test process orchestration module 101 is used to receive configuration information and orchestrate the data migration service test task, wherein the configuration information is used to configure the global parameters of the test task, the test method of the test case, and the test assertion; The test library management module 103 is used to manage the Docker container of the database included in the data migration service, including: starting, configuring, connecting and destroying the database; A test data management module 104, configured to receive test data configuration information and call the test library management module to configure test data based on the test data configuration information; The task debugging and execution module 102 is used to obtain the test script corresponding to the test task based on the global parameters of the test task, the test method of the test case, the test assertion and the test data, send the test script to each agent node for execution, and obtain the execution result and execution log.
[0031] Specifically, in the embodiment of the present invention, the user can complete the arrangement of the test task through the test process arrangement module 101, and complete the configuration of the test task global parameters, test cases, test methods and test assertions. When the data migration service needs to be tested, the test data management module 104 cooperates with the test library management module 103 to configure the test data, and finally the task debugging and execution module 102 can execute the test task based on the global parameters of the test task, the test method of the test case, the test assertion and the test data, and obtain the execution results and execution logs.
[0032] In the embodiment of the present invention, the test library management module is responsible for the Docker container management of databases related to data migration services such as MySQL, Oracle, and PostgreSQL, including the startup, configuration, connection, and destruction of the database. In addition, it also provides the client operation function of the database, supports the execution of SQL statements and the acquisition of execution results, and effectively reduces the burden of testers to manually execute SQL.
[0033] In the embodiment of the present invention, the test data management module provides data templates for databases such as MySQL, Oracle, and PostgreSQL, including all objects supported by the data migration service, such as tables, table data, views, functions, triggers, events, and stored procedures. At the same time, it also supports data management (including data initialization and update) of the TPCC model (i.e., the TPC-C model) and the generation of random data for the table. Users can customize test data according to their needs, and all data are loaded into the test library in SQL.
[0034] Specifically, during the data migration process, the test data configuration information may be an SQL statement, and the test data management module calls the test library management module based on the test data configuration information to create corresponding data in the test library.
[0035] In an embodiment of the present invention, a test task refers to a series of test activities that need to be completed during the data migration service test process. A test case is a specific component of a test task, and a test case defines how to verify whether a specific function or scenario works as expected. The test case provides specific steps and expected results for executing the test, which are used to determine how to conduct the test. The test task defines which test cases need to be executed, as well as the execution order and priority of these test cases. The test case is a refinement of the test task, and each test case corresponds to a specific test point. Multiple test cases together cover the test scope defined by the test task. The execution results (pass, fail, blocked, etc.) of the test case will be recorded and reported to obtain the execution results and execution logs, which can be used to evaluate the quality of the data migration service later.
[0036] In the embodiment of the present invention, the task debugging and execution module can execute each test case in turn according to the execution order of each test case included in the test task, and return the execution result and the execution log.
[0037] In the embodiment of the present invention, the agent node Agent can be a physical server, a virtual machine or a container, which is responsible for running the test script and returning the test results. The agent can be deployed on multiple nodes to support distributed test execution. In this way, multiple test cases can be run in parallel to improve test efficiency.
[0038] The Python scripts corresponding to the test cases can be distributed to various agents for execution. Therefore, the test scripts do not need to be executed at the same location where the test is initiated, but can be run in different environments where the agents are located. Each agent can provide an isolated test environment to ensure that the execution of test cases does not interfere with each other, which is especially important for data migration tests that require specific environment configurations. Agents can make full use of the computing resources in the cluster, especially when a large amount of computing resources is required for data migration testing, Agents can help distribute the load. After the agent executes the test case, it will return the execution log and test results to the central node or test management platform for testers to analyze and evaluate. The agent can capture errors and exceptions during the test execution process and record this information in the execution log for subsequent analysis by testers.
[0039] Therefore, a test report can be automatically generated based on the execution log and results returned by the Agent, showing the execution status of the test cases and the test results of the data migration service.
[0040] In an optional implementation manner of the present invention, the system further comprises: a task management module; The task management module is used to receive the execution time information for the test task, control the task debugging and execution module to execute the test task according to the execution time information of the test task, receive the execution result and execution log, generate and display the test report.
[0041] In an embodiment of the present invention, the definition, start, and pause of test tasks can be managed through the task management module, and the execution time information of the test tasks can also be set to support the scheduled execution of test tasks. During the execution of the data migration task, execution logs will be collected and a test report will be displayed after the execution is completed, which is convenient for testers to analyze and evaluate the test results.
[0042] In the embodiment of the present invention, the system further includes: a use case management module, a test method management module, a test assertion module and a parameter management module.
[0043] The use case management module is used to add, modify, delete, copy and export use case sets and test cases.
[0044] The test method management module is used to save test methods and add, modify and delete test methods.
[0045] The test assertion module is used to assert the output of the test method.
[0046] The parameter management module is used to add, modify and delete parameter groups and parameters, so as to apply parameters to test cases by means of variable substitution.
[0047] In an embodiment of the present invention, the data migration service testing system can add, modify, delete, copy, export and other operations on use case sets and use cases based on the use case management module. Use cases can be exported as Python scripts, and users can enter the test process orchestration through the editing task of the test case.
[0048] In an embodiment of the present invention, the test method management module provides a large number of built-in test methods. Users can add, modify, and delete methods by themselves, or call the debugging module to debug the test method online. The test method adopts a standard json format, including input, method body, output, input and output. The method body is a python+pytest script. This module can ensure the standardization and accuracy of the test.
[0049] In the embodiment of the present invention, the test assertion module can assert the output of the test method and support multiple assertion types, including but not limited to equal to, not equal to, contain, not contain, greater than, greater than or equal to, less than, less than or equal to. The module can not only assert the status code, request header, response text and other contents returned by the interface request, but also assert the consistency of the source and target database data, thereby realizing the test of the data audit function provided in the data migration service.
[0050] In the embodiment of the present invention, the parameter management module provides parameter group and parameter management functions, can support adding, modifying and deleting operations, and through variable replacement, parameters can be flexibly applied to test cases, thereby improving the reusability and flexibility of the code.
[0051] In the embodiment of the present invention, the task debugging and execution module distributes the Python scripts generated by the task management module, the test process orchestration module, the test data management module, the test library management module, the test assertion module and the test method management module to each Agent for execution. During the execution process, logs and execution results are returned in real time to ensure the smooth progress of the test process.
[0052] In the embodiment of the present invention, the test process arrangement module 101 is used to: Based on the configuration information, configure the global parameters of the test task through the parameter management module; create a use case set of the test task based on the use case management module, and create corresponding test cases under the use case set; edit the test case, obtain the test method from the test method management module based on the configuration information, and configure the test method for the test case; obtain the test assertion from the test assertion module based on the configuration information, and configure the test assertion for the test case; debug the test method; if the test method is debugged successfully, debug the test case; if the test case is debugged successfully, save the test case.
[0053] In the embodiment of the present invention, the test process arrangement module 101 provides a visual interface for arranging the data migration service test process, supports test step definition, setting parallel / serial processes, step dragging, conditional branches, etc., and users can reference global parameters and local parameters. In addition, the module also supports online debugging and viewing logs to help testers quickly locate problems.
[0054] In the embodiment of the present invention, the test method generally refers to a single test step or a function in a test script. In the process of arranging test cases, the following method can be used to determine whether the test method has been debugged: Expected result matches: The result after the test method is executed exactly matches the expected result.
[0055] Error and exception handling: The test method can correctly handle possible errors and exceptions, and the execution will not be interrupted by unhandled exceptions.
[0056] Boundary Condition Validation: The test method is able to handle boundary conditions and works properly under these conditions.
[0057] Code review: The code logic is clear, without redundancy or unnecessary complexity, and has passed code review.
[0058] Repeated execution consistency: When the test method is repeated multiple times, the same results are obtained, indicating that the test method is stable.
[0059] Code coverage: The test method is able to cover all branches and paths of the code it is responsible for testing.
[0060] In the embodiment of the present invention, the test case may include multiple test steps or test methods. In the process of arranging the test case, the following method can be used to determine whether the test case has been debugged: All Steps Passed: All steps or sub-test methods in the test case have been debugged and passed, with no failed steps.
[0061] Verification of expected results: After the test case is executed, the actual result is exactly the same as the expected result.
[0062] Error and exception checking: Test cases can catch and verify expected errors and exceptions.
[0063] Log and output review: Check the logs and output during test case execution to ensure there are no unexpected warnings or error messages.
[0064] Regression testing: After the code is changed, the test cases can pass stably, indicating that no new defects have been introduced.
[0065] Test coverage: The test cases cover all functional points and scenarios they are responsible for verifying.
[0066] Test data validity: The data used by the test case is valid and can support the expected results of the test case.
[0067] Test environment consistency: Test cases can run and pass stably in different test environments.
[0068] In the embodiment of the present invention, the specific debugging method may include: Step-by-step debugging: Use debugging tools to execute test code step by step and observe the execution status and variable status of each step.
[0069] Logging: Add logging in your test code to track the execution flow and status of your program during test execution.
[0070] Assert verification: Use assertions in test code to verify the expected results of key points and ensure that the code behaves as expected.
[0071] In an optional implementation manner of the present invention, during the test process arrangement process, the test process arrangement module is further used to: When parameters need to be provided to subsequent test methods, the output of the test method is configured as local parameters for subsequent test methods to call.
[0072] In the embodiment of the present invention, local parameters are configured so that the output result of a test method is used as an input parameter of a subsequent method in the test process. This approach helps to achieve data transfer and dependency management between test steps.
[0073] In the embodiment of the present invention, the execution of the test case depends on the data (such as Excel file or JSON file) provided by the test data management module and the test library management module. The test system reads data from these data sources and passes it to the test case as a parameter.
[0074] In some test scenarios, the output of one test method may be the input of another test method. For example, in a test of a user registration process, the first test method may be to fill in the registration form, and its output (such as user ID) can be used as an input parameter for subsequent test methods (such as logging in or sending a verification email).
[0075] In the embodiment of the present invention, local parameters refer to variables temporarily created during the test execution process, which are only valid in a specific test step or test case. These parameters can store the output results of the test step and be referenced by subsequent steps.
[0076] When writing a test script, you can implement parameter passing through programming logic. For example, in Python, you can define a function to execute test steps and return a result, and then pass this result as a parameter to another function.
[0077] Based on the same inventive concept, an embodiment of the present invention provides a data migration service testing method, such as Figure 2 As shown, it shows a flowchart of the steps of the data migration service testing method. Specifically, the method includes the following steps: S201, configure global parameters of the test task.
[0078] S202, create a use case set, and create corresponding test cases under the use case set.
[0079] S203, edit the test case and configure a test method for the test case.
[0080] S204, configuring the input of the test method and the test assertion for the test case; the input of the test method is the global parameter.
[0081] S205, debugging the test method.
[0082] S206, when the test method is debugged successfully, debug the test case.
[0083] S207, when the test case is debugged successfully, save the test case.
[0084] S208, obtaining test data and test cases corresponding to the test task, and testing the data migration service.
[0085] In an embodiment of the present invention, the data migration service testing method is executed by the data migration service testing system described in any one of the embodiments above.
[0086] In the embodiment of the present invention, steps S201 to S207 are steps for arranging the test process, which can be completed in advance and can be implemented by the test process arrangement module, the test library management module, the test data management module, the case management module, the test method management module, the test assertion module and the parameter management module in the data migration service test system.
[0087] Step S208 is a test task execution step, which can be specifically executed by the task debugging and execution module. Specifically, it may include the following sub-steps: S2081, obtaining test data corresponding to the test task; S2082, obtaining the use case set and global parameters included in the test task; S2083, obtaining a step topology diagram and a test method for the test case; S2084, replacing the test method with a script, using the global parameters to replace the global parameters in the script, and generating a test script according to the step topology diagram; S2085, executing the test script, generating local parameters according to the test script, and replacing the local parameters before executing each test method; S2086, obtaining and displaying the execution result and execution log of each test script; S2087, execute each test case in the test case set in sequence; S2088, count the execution results and logs of each test case and generate a test report.
[0088] In an embodiment of the present invention, first, based on the test task that has been completed, the use case set and global parameters contained in the task can be obtained. The test cases are executed in the order of each test case to obtain the step topology diagram and test method of the first test case. Based on the test method management module, the test method is replaced with a script, and the global parameters in the test script are further replaced. The test script is generated according to the parallel, serial order, and conditional branches specified in the topology diagram. The test script is executed, local parameters are generated according to the script, and the local parameters are replaced before executing each method. The execution results and execution logs of each script are obtained and displayed in real time. After executing the first test case, other use cases are executed in sequence according to the corresponding process. Finally, the execution results and logs of all test cases are counted through the task management module to generate a test report.
[0089] In an optional implementation manner of the invention, step S208 includes: Receive the execution time information for the test task, and execute the test task according to the execution time information of the test task; count the execution results and execution logs of each test case, and generate a test report.
[0090] In an embodiment of the present invention, the definition, start, and pause of test tasks can be managed through the task management module, and the execution time information of the test tasks can also be set to support the scheduled execution of test tasks. During the execution of the data migration task, execution logs will be collected and a test report will be displayed after the execution is completed, which is convenient for testers to analyze and evaluate the test results.
[0091] Specifically, Figure 3 As shown, it shows a flowchart of specific steps of arranging the test process in the data migration service testing method provided by the embodiment of the present invention.
[0092] In an embodiment of the present invention, the test process of arranging the data migration service test method includes: S1, configure global parameters.
[0093] Specifically, the configuration information can be received based on the visual interface provided by the test process orchestration module, and the global parameters can be configured based on the configuration information. Specifically, the user can customize the parameter group, and the parameters generally include the test environment information of the data migration service such as URL, user name, password, SSH login information, database information, Zookeeper information, etc. If the user does not use the test library management module provided by the embodiment of the present invention and uses a self-built library, the connection information of MySQL, Oracle, PG and other libraries can also be configured in the global parameters. The user can also define the timeout period, data migration service task cleanup method and other business-related configurations.
[0094] S2, create test cases. Specifically, you can create a use case set through the use case management page provided by the use case management module, and create corresponding use cases under the use case set.
[0095] S3, add / edit test method.
[0096] S4, determine whether the test exists in the test method management module, If the test method management module provides the required test method, it can be used directly.
[0097] If the system does not provide the required test method, you need to customize the test method. Specifically, you can jump to the custom method page and add the test method yourself. In the embodiment of the present invention, the test method consists of three parts: input, method body, and output. The input and output are in standard json format, and the method body is a python+pytest script. After the user defines the test method, it can be debugged on the current page and can also be applied to debug in the use case.
[0098] S4, configure test data (input). After the user selects a method, the user can configure the input (test data) of the test method through the test data management module combined with the test library management module. The test data here is the input of the method, which is standard json format data. The global parameter ${{parameter group name.parameter name}} and the local parameter ${parameter name} can be configured as input.
[0099] S5, configure the test assertion. After selecting the test method, the user can select an appropriate method from the assertion methods provided by the test assertion module to assert the output of the method, or arrange the assertion as a separate test method.
[0100] S6, configure test output. After the user selects a test method, the test output can be configured for the test method. It should be noted that this step is only required when parameters need to be provided for subsequent methods to use. The output can be configured as a local parameter for subsequent method calls. For method configuration, refer to Figure 4 , Figure 4An example of an Oracle->PostgreSQL data migration step orchestration topology obtained based on the data migration test method provided by an embodiment of the present invention is shown. In this example, the test flow of the process of migrating from an Oracle database to a PostgreSQL database is shown, wherein the input of the test method includes the detailed configuration of the migration task, such as the source database connection information (src_oracle), the target database connection information (des_pg), the migration management name (managerName), the migration type (mces_type), whether transactions are included (inc_trans), the total number of migrations (total_trans), and other migration-related settings. The output of the test method includes the configuration ID (planConfigId) and channel ID (channelId) of the migration task. The test assertion is "planConfigId" in $(CreateTrans).output, which is used to verify whether the migration task is successfully created and the expected configuration ID is output.
[0101] S7, debug the test method. After running the test method, the interface will provide real-time feedback on the log and running status, and you can judge whether the method is executed successfully based on the log.
[0102] If the debugging is successful, the test case can be debugged. If the debugging is not successful, return to S4, reconfigure the test method, and continue the subsequent process.
[0103] S8, debug the test case. After all methods are configured, debug the entire test case. After running the test case, the interface will provide real-time feedback on the log and running status of each method. You can refer to the log (the log can be found in the Figure 5 and Figure 6 ) to determine whether the method is executed successfully. Figure 5 The execution log of the Oracle->PostgreSQL data migration test method obtained based on the data migration test method provided by the embodiment of the present invention is shown. Figure 6 exhibit Figure 5 The specific contents of the execution log.
[0104] If the execution fails, it returns to S3, adjusts the method execution order and branch logic, and then continues the subsequent process. If the execution succeeds, you can save the use case and export the use case as a Python script (for exporting scripts, refer to Figure 7 , Figure 7 1 shows an exemplary Python script exported in an embodiment of the present invention), and the entire use case step arrangement is completed.
[0105] In the embodiment of the present invention, the test process for the data migration service is arranged using a visual interface, which lowers the test threshold and improves code readability; a large number of test methods are provided for the data migration service, and users can also customize the test methods, and can debug the test methods and test cases online, and obtain execution results and logs in real time.
[0106] In the embodiment of the present invention, a test assertion for a data migration service is provided. In addition to conventional comparison assertions and interface value assertions, data consistency assertions for source and target libraries can also be performed.
[0107] The test library management module in the embodiment of the present invention uses a Docker container to pull up various databases, configure databases, and destroy databases, and provides a test method to read and write database data.
[0108] In the embodiment of the present invention, the test data management module provides data templates of various database objects (such as tables, views, functions, etc.), provides data of the TPCC model (data initialization and data update), and provides table random data.
[0109] Furthermore, the data migration test system provided by the embodiment of the present invention supports script export, and can export use cases as Python scripts to run independently of the platform.
[0110] Based on the same inventive concept, an embodiment of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes, the steps in the data migration service testing method described in any of the above embodiments are implemented.
[0111] Based on the same inventive concept, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps in the data migration service testing method described in any of the above embodiments are implemented.
[0112] Based on the same inventive concept, an embodiment of the present invention provides a computer program product, including a computer program / instruction, which implements the steps in the data migration service testing method described in any of the above embodiments when executed by a processor.
[0113] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0114] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0115] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (apparatus), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0116] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0117] These computer program instructions can also be loaded onto a computer or other programmable terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0118] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0119] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0120] The above is a detailed introduction to a data migration service testing method provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A data migration service testing system, characterized in that: The system includes: a test process arrangement module, a task debugging and execution module, a test library management module and a test data management module; The test process orchestration module is used to receive configuration information and orchestrate the data migration service test task, wherein the configuration information is used to configure the global parameters of the test task, the test method of the test case, and the test assertion; The test library management module is used to manage the Docker container of the database included in the data migration service, including: database startup, configuration, connection and destruction; A test data management module, used to receive test data configuration information, and call the test library management module to configure test data based on the test data configuration information. The test data management module provides data migration services including all objects supported by the database, including tables, table data, views, functions, triggers, events, and stored procedures; The task debugging and execution module is used to obtain the test script corresponding to the test task based on the global parameters of the test task, the test method of the test case, the test assertion and the test data, send the test script to each agent node for execution, and obtain the execution result and execution log.
2. The data migration service testing system according to claim 1, characterized in that: The system also includes: a task management module; The task management module is used to receive the execution time information for the test task, control the task debugging and execution module to execute the test task according to the execution time information of the test task, receive the execution result and execution log, generate and display the test report.
3. The data migration service testing system according to claim 1, characterized in that: The system also includes: a use case management module, a test method management module, a test assertion module and a parameter management module; The use case management module is used to add, modify, delete, copy and export use case sets and test cases; The test method management module is used to save test methods and add, modify and delete test methods; The test assertion module is used to assert the output of the test method; The parameter management module is used to add, modify and delete parameter groups and parameters, so as to apply parameters to test cases by means of variable substitution; The test process arrangement module is used for: Based on the configuration information, configure the global parameters of the test task through the parameter management module; Create a use case set for the test task based on the use case management module, and create corresponding test cases under the use case set; Edit the test case, obtain the test method from the test method management module based on the configuration information, and configure the test method for the test case; Based on the configuration information, obtaining a test assertion from the test assertion module, and configuring a test assertion for the test case; Debugging the test method; If the test method is debugged successfully, debug the test case; When the test case is debugged successfully, the test case is saved.
4. The data migration service testing system according to claim 3, characterized in that: The test process arrangement module is also used for: When parameters need to be provided to subsequent test methods, the output of the test method is configured as local parameters for subsequent test methods to call.
5. A data migration service testing method, characterized in that: The method comprises: Configure the global parameters of the test task; Create a use case set and create corresponding test cases under the use case set; Edit the test case and configure the test method for the test case; Configure the input and test assertion of the test method for the test case; the input of the test method is the global parameter; Debugging the test method; If the test method is debugged successfully, debug the test case; If the test case is debugged successfully, save the test case; Obtain the test data and test cases corresponding to the test task and test the data migration service.
6. The data migration service testing method according to claim 5, characterized in that: Obtain the test data and test cases corresponding to the test task and test the data migration service, including: Get the test data corresponding to the test task; Get the test case set and global parameters included in the test task; Get the step topology diagram and test method of the test case; Replace the test method with a script, use the global parameters to replace the global parameters in the script, and generate a test script according to the step topology diagram; Executing the test script, generating local parameters according to the test script, and replacing the local parameters before executing each test method; Obtain and display the execution results and execution logs of each test script; Execute each test case in the test case set in sequence; Statistics the execution results and logs of each test case and generate a test report.
7. The data migration service testing method according to claim 6, characterized in that: Obtain the test data and test cases corresponding to the test task and test the data migration service, including: Receiving execution time information for the test task, and executing the test task according to the execution time information of the test task; Statistics the execution results and execution logs of each test case, and generate a test report.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the data migration service testing method described in any one of claims 5 to 7 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data migration service testing method described in any one of claims 5 to 7 is implemented.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps in the data migration service testing method described in any one of claims 5 to 7 are implemented.