Model-based data resource automatic testing method and system
Through the model-based data resource automation testing method, the test case model is generated and maintained, and the problem of inability to automatically test and identify changes in data resource in the existing technology is solved, and efficient and accurate data resource development and testing is achieved.
Patent Information
- Application Number
- CN202411906161.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2044-12-23
AI Technical Summary
The existing technology cannot automatically develop test data resources through scientific and continuous methods, and the existing automated testing methods cannot effectively identify changes in data resources and cannot cover changes in multiple data resources, resulting in inefficient testing.
A model-based data resource automation testing method is proposed. Through the steps of generating data resource test case models, generating test cases, and automatically maintaining test case models, we can automatically identify data resource changes and continuously automated testing.
It realizes automatic maintenance of data resource test case model, which is suitable for scenarios where different data resources change dynamically, improves the efficiency and accuracy of data resource development and testing, and reduces enterprise costs.
Smart Images

Figure CN120029903A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data resource development and testing, and more specifically, to a model-based automated testing method and system for data resources. Background Art
[0003] At present, the vast majority of units are unable to conduct automated testing on data resource development through scientific and continuous methods. Although a few well-funded enterprises solve the problem of data resource development and testing by hiring data development and testing teams, this method is usually only a one-time solution and cannot be automatically executed. Continuous capital investment is required, so it is not universal for most enterprises.
[0004] Currently, most of the automated testing after data resource development uses the method of generating random test sets and preset use case sets. However, this method cannot detect changes in the same data resource, cannot cover changes in multiple data resources, and cannot improve the efficiency of data resource development and testing. Summary of the Invention
[0005] In view of this, the purpose of the present invention is to propose a model-based automated testing method and system for data resources. By generating the test case model name of the data resource, generating the test cases of the data resource, generating the test case model of the data resource, and automatically maintaining the test cases of the data resource, the method can automatically identify changes in the data resource, continuously conduct automated testing, make up for and optimize the technical gaps in related fields of data resource development and testing. It can not only automatically maintain the test case model of the data resource, but also be applicable to scenarios with dynamic changes in different data resources. According to the result analysis, it can update, iterate or discard the original use case model, and generate a new test case model. At the same time, it saves the execution result tags before and after the change of the test cases of the data resource, which is convenient for users to trace the data resource and improve the efficiency of data resource development.
[0006] The present invention provides a model-based automated testing method for data resources, including the following steps:
[0007] S1. Connect to the database corresponding to the data resource (and test that the database connection is in a successful state); connect to the target database where the data resource needs to be stored (and test that the database connection is in a successful state, and the target database is the data resource center); configure the metadata collection task of the data resource, and copy the metadata of the data resource in the target database; generate the test case suite name of the data resource and generate the test case model names at different levels of the data resource.
[0008] S2. Configure the collection tasks from different databases for scheduling tasks, select the operation cycle (minutes, hours, days, weeks, months) and operation validity period according to the iteration frequency of data resources, set the failed tasks to be re-run, and publish the metadata collection tasks in the scheduling list as effective after the scheduling task configuration is completed; complete the reading of data resources for each test case, and process them into writing data resources; use the test cases to execute the test;
[0009] S3. Publish the test cases that have been successfully executed and mark them as data resource test case models. Select one or more test cases that are marked as valid and publish them as test case models. Configure the data resource test case model scheduling task, select the data resource test case model, select the operation cycle (minutes, hours, days, weeks, months), the operation validity period, set the failed task to be re-run, and publish the data resource test case model in the scheduling list as effective after the task configuration is completed.
[0010] S4. Analyze the execution results of the scheduling task, extract the execution result information and compare it with the original test case information. When the execution result is successful, keep the test case unchanged; when the execution result is failed, obtain the information of the data resource changes in the execution log and compare it with the data resource information of the original test case. The original test case is automatically marked, and the data resource test case model is regenerated after the data resource changes.
[0011] Specifically, data resource changes include the following situations:
[0012] When the data resource table name is modified: the original use case model is offline, and the original variable component is modified accordingly. At the same time, the identification field records the date and change information. The original use case model becomes an invalid use case and is no longer executed. A new test case model is automatically generated according to the new table name, and the scheduling component is started to publish the new test case to a valid state;
[0013] When a new data resource table name is added: a new test case is automatically generated based on the table name, and the table fields are assigned to component variables to form a new data resource test case model. The scheduling component is started to publish the new test case to a valid state;
[0014] If the data resource table name is deleted: the original use case model is automatically offline and marked, and the test case becomes an invalid use case and is no longer automatically executed;
[0015] When the fields in the data resource table are modified: the original use case model is offline, the original fields are changed to new field information, the field records the date and change information, and the scheduling component starts to publish new test cases to a valid state;
[0016] When new data resource fields are added: the original use case model is offline, the target table adds new fields based on the metamodel, the identification field records the date and change information, and the scheduling component starts to publish new test cases to a valid state;
[0017] In the case where data resource fields are deleted: the original use case model is offline, the target table deletes the fields according to the metamodel, the identification field records the date and change information, and the scheduling component starts to publish new test cases to a valid state.
[0018] Further, the method of generating the test case suite name of the data resource in step S1 includes: naming the main suite name in the form of the names of data resources A to data resources N, the lower layer of the main suite name sequentially includes the following levels of sub-suite names: ODS data resource source layer, DWD standard layer cleaning and conversion, DWS data resource summary layer, and generating the test case suite name of the data resource;
[0019] The method for generating test case model names of different levels of data resources in step S1 includes: using SQL statements to obtain the table names of data resources A to data resources N, placing them in a small model, and naming the test case models of data resources with ODS_table name 1_data resource A, ODS_table name 1_data resource N, DWD_table name 1_data resource A, and DWD_table name 1_data resource N, respectively.
[0020] Furthermore, the method of completing the reading of data resources for each test case in step S2 and processing the processing to write data resources includes:
[0021] Use SQL statements to obtain the field names of data resources and complete variable assignment of field names; insert an operation time field on the metadata consistent with the data resource structure corresponding to the target database (i.e., data resource center); determine whether it is a partitioned table. If it is a non-partitioned table, convert the non-partitioned table to a partitioned table; if it is a partitioned table, read the data resource library after successfully processing the partitioned table, select the metamodel, select the entity table resource name, select the field to be processed, and complete the operation of reading data resources; select to write to the target table corresponding to the data resource, select the copied metamodel and target table name, select the column to be written, select the number of concurrency, and complete the operation of writing data resources.
[0022] Furthermore, the method for configuring the metadata collection task of the data resource in step S1 includes:
[0023] Add a collection task of data resources from different databases, run the collection task to obtain metadata of the data resources, and change the collected metadata to a published state.
[0024] Furthermore, the method of copying metadata of data resources in the target database in step S1 includes:
[0025] Select the metadata of one or more data resources for replication or batch replication, and generate metadata consistent with the structure of the data resources in the target database for subsequent data resource exchange.
[0026] Furthermore, the method for parsing the execution result of the scheduling task in step S4 includes:
[0027] The data resource test case model is automatically executed according to the scheduled time, and the date and execution success or failure identification information are marked in the data resource target table.
[0028] Furthermore, the method of publishing and marking the test cases that have been successfully executed as data resource test case models in step S3 includes:
[0029] According to the analysis of the execution log information, each test case is marked as a valid data resource test case after successful execution; one or more data resource test cases marked as valid are selected and published as a data resource test case model.
[0030] The present invention also provides a model-based data resource automated testing system, which executes the model-based data resource automated testing method as described above, including:
[0031] Data resource test case model name generation module: used to access the database corresponding to the data resource; access the target database where the data resource needs to be stored; configure the metadata collection task of the data resource, and copy the metadata of the data resource in the target database; generate the test case suite name of the data resource, and generate the test case model names of different levels of the data resource;
[0032] Data resource test case generation module: used to configure the collection tasks from different databases into scheduling tasks, select the operation cycle and operation validity period according to the data resource iteration frequency, set the failed tasks to be re-run, and publish the metadata collection tasks in the scheduling list as effective after the scheduling task configuration is completed; complete the reading of data resources for each test case, and process them into writing data resources; use the test cases to execute the test;
[0033] Data resource test case model generation module: used to mark the test cases that have been successfully executed as data resource test case models, select one or more test cases marked as valid, and publish them as test case models; configure the data resource test case model scheduling task, select the data resource test case model, select the operation cycle and operation validity period, set the failed task to be re-run, and publish the data resource test case model in the scheduling list as effective after the task configuration is completed;
[0034] Data resource test case model automatic maintenance module: used to parse the execution results of the scheduling tasks, extract the execution result information and compare it with the original test case information. When the execution result is successful, the test case remains unchanged; when the execution result is failed, the information of the changed part of the data resource in the execution log is obtained and compared with the data resource information of the original test case. The original test case is automatically marked, and the data resource test case model is regenerated after the data resource changes.
[0035] The model-based data resource automation testing method and system provided by the present invention have a closed-loop process for fully automated acquisition of data resource development test data, covering data resource connection, test suite and test case generation, test case formation use case model, model task trigger scheduling execution, execution result analysis, and use case automatic maintenance, which has good timeliness; the scenarios are subdivided according to data resource changes, so that data resource automation testing is more targeted and the test results are more accurate; in the automatic maintenance of test cases, a model formed by multiple components is used to make the use case maintenance process and results more scientific, and the quantitative results can be intuitively compared with peers; the entire process of the model-based data resource automation testing method is executed by computer programs to achieve full automation, effectively improving the sustainability and reusability of data resource automation testing, and can replace manually written use cases and commonly used script execution modes, reducing enterprise costs.
[0036] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the model-based data resource automatic testing method as described above are implemented.
[0037] The present invention also provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the model-based data resource automated testing method as described above are implemented.
[0038] Compared with the prior art, the present invention has the following beneficial effects:
[0039] The model-based data resource automated testing method and system provided by the present invention automatically identifies data resource changes and performs continuous automated testing through four steps: generating a data resource test case model name, generating a data resource test case, generating a data resource test case model, and automatically maintaining a data resource test case. This fills in and optimizes the technical gaps in the field of data resource development and testing. The method and system can not only automatically maintain the data resource test case model, but also be applicable to scenarios where different data resources change dynamically. The original test case model can be updated or discarded based on result analysis to generate a new test case model. At the same time, the execution result labels before and after the data resource test case changes are saved, which is convenient for users to trace data resources and effectively improves the efficiency of data resource development. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the following detailed description of the preferred embodiment.The drawings are only for the purpose of illustrating the preferred embodiments and are not to be construed as limiting the invention.
[0041] In the attached picture:
[0042] Figure 1 This is a basic flow chart of the model-based data resource automated testing according to an embodiment of the present invention;
[0043] Figure 2 is a simplified diagram of a data resource test case model according to an embodiment of the present invention;
[0044] Figure 3 It is a data resource test case model diagram that is automatically maintained after the data resource metadata changes and components are automatically updated in an embodiment of the present invention;
[0045] Figure 4 A flow chart of a model-based data resource automated testing method of the present invention;
[0046] Figure 5 The figure is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0047] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and products consistent with some aspects of the present disclosure as detailed in the appended claims.
[0048] The terms used in this disclosure are for the purpose of describing specific embodiments only and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0049] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0050] The embodiments of the present invention are described in further detail below.
[0051] The present invention provides a data resource automation testing method based on a model. Figure 4 As shown, the following steps are included:
[0052] S1. Access the database corresponding to the data resource; access the target database (i.e., data resource center) where the data resource needs to be stored; configure the metadata collection task of the data resource, and copy the metadata of the data resource in the target database; generate the test case suite name of the data resource, and generate the test case model names of different levels of the data resource;
[0053] The method for generating a test case suite name for a data resource includes: naming a main suite name in the form of names of data resources A to data resources N, wherein the lower layer of the main suite name sequentially includes sub-suite names of the following levels: ODS data resource source layer, DWD standard layer cleaning and conversion, DWS data resource summary layer, and generating a test case suite name for the data resource;
[0054] The method for generating test case model names for different levels of data resources includes: using SQL statements to obtain table names from data resources A to data resources N, placing them in a small model, and naming the test case models of data resources respectively with the names ODS_table name 1_data resource A, ODS_table name 1_data resource N, DWD_table name 1_data resource A, and DWD_table name 1_data resource N.
[0055] Methods for configuring metadata collection tasks for data resources include:
[0056] Add a collection task of data resources from different databases, run the collection task to obtain metadata of the data resources, and change the collected metadata to a published state.
[0057] Methods for replicating metadata of data resources in the target database include:
[0058] Select the metadata of one or more data resources for replication or batch replication, and generate metadata consistent with the structure of the data resources in the target database for subsequent data resource exchange, such as Figure 2 shown.
[0059] S2. Configure the collection tasks from different databases for scheduling tasks, select the operation cycle (minutes, hours, days, weeks, months) and operation validity period according to the iteration frequency of data resources, set the failed tasks to be re-run, and publish the metadata collection tasks in the scheduling list as effective after the scheduling task configuration is completed; complete the reading of data resources for each test case, and process them into writing data resources; use the test cases to execute the test;
[0060] The method of completing the reading of data resources for each test case and processing it into writing data resources includes:
[0061] Use SQL statements to obtain the field names of data resources and complete variable assignment of field names; insert an operation time field on the metadata consistent with the data resource structure corresponding to the target database (data resource center); determine whether it is a partitioned table. If it is a non-partitioned table, convert the non-partitioned table to a partitioned table; if it is a partitioned table, read the data resource library after successfully processing the partitioned table, select the metamodel, select the entity table resource name, select the field to be processed, and complete the operation of reading data resources; select to write to the target table corresponding to the data resource, select the copied metamodel and target table name, select the column to be written, select the number of concurrency, and complete the operation of writing data resources.
[0062] S3. Publish the test cases that have been successfully executed and mark them as data resource test case models. Select one or more test cases that are marked as valid and publish them as test case models. Configure the data resource test case model scheduling task, select the data resource test case model, select the operation cycle (minutes, hours, days, weeks, months), the operation validity period, set the failed task to be re-run, and publish the data resource test case model in the scheduling list as effective after the task configuration is completed.
[0063] The method of marking the release of test cases that have successfully executed the test as a data resource test case model includes:
[0064] According to the analysis of the execution log information, each test case is marked as a valid data resource test case after successful execution; one or more data resource test cases marked as valid are selected and published as a data resource test case model.
[0065] S4. Analyze the execution result of the scheduling task, extract the execution result information and compare it with the original test case information. When the execution result is successful, keep the test case unchanged; when the execution result is failed, obtain the information of the data resource changes in the execution log and compare it with the data resource information of the original test case. The original test case is automatically marked, and the data resource test case model is regenerated after the data resource changes, such as Figure 3 shown.
[0066] Methods for parsing the execution results of scheduled tasks include:
[0067] The data resource test case model is automatically executed according to the scheduled time, and the date and execution success or failure identification information are marked in the data resource target table.
[0068] Data resource changes include the following situations:
[0069] When the data resource table name is modified: the original use case model is offline, and the original variable component is modified accordingly. At the same time, the identification field records the date and change information. The original use case model becomes an invalid use case and is no longer executed. A new test case model is automatically generated according to the new table name, and the scheduling component is started to publish the new test case to a valid state;
[0070] When a new data resource table name is added: a new test case is automatically generated based on the table name, and the table fields are assigned to component variables to form a new data resource test case model. The scheduling component is started to publish the new test case to a valid state;
[0071] If the data resource table name is deleted: the original use case model is automatically offline and marked, and the test case becomes an invalid use case and is no longer automatically executed;
[0072] When the fields in the data resource table are modified: the original use case model is offline, the original fields are changed to new field information, the field records the date and change information, and the scheduling component starts to publish new test cases to a valid state;
[0073] When new data resource fields are added: the original use case model is offline, the target table adds new fields based on the metamodel, the identification field records the date and change information, and the scheduling component starts to publish new test cases to a valid state;
[0074] In the case where data resource fields are deleted: the original use case model is offline, the target table deletes the fields according to the metamodel, the identification field records the date and change information, and the scheduling component starts to release new test cases to a valid state.
[0075] Figure 1 The basic process of the model-based data resource automated testing in this embodiment is shown.
[0076] The embodiment of the present invention further provides a model-based data resource automatic testing system, which executes the model-based data resource automatic testing method as described above, including:
[0077] Data resource test case model name generation module: used to access the database corresponding to the data resource; access the target database where the data resource needs to be stored; configure the metadata collection task of the data resource, and copy the metadata of the data resource in the target database; generate the test case suite name of the data resource, and generate the test case model names of different levels of the data resource;
[0078] Data resource test case generation module: used to configure the collection tasks from different databases into scheduling tasks, select the operation cycle and operation validity period according to the data resource iteration frequency, set the failed tasks to be re-run, and publish the metadata collection tasks in the scheduling list as effective after the scheduling task configuration is completed; complete the reading of data resources for each test case, and process them into writing data resources; use the test cases to execute the test;
[0079] Data resource test case model generation module: used to mark the test cases that have been successfully executed as data resource test case models, select one or more test cases marked as valid, and publish them as test case models; configure the data resource test case model scheduling task, select the data resource test case model, select the operation cycle and operation validity period, set the failed task to be re-run, and publish the data resource test case model in the scheduling list as effective after the task configuration is completed;
[0080] Data resource test case model automatic maintenance module: used to parse the execution results of the scheduling tasks, extract the execution result information and compare it with the original test case information. When the execution result is successful, the test case remains unchanged; when the execution result is failed, the information of the changed part of the data resource in the execution log is obtained and compared with the data resource information of the original test case. The original test case is automatically marked, and the data resource test case model is regenerated after the data resource changes.
[0081] The model-based data resource automated testing method and system of this embodiment completes the continuous automated testing after automatically identifying data resource changes through four steps: generating a data resource test case model name, generating a data resource test case, generating a data resource test case model, and automatically maintaining a data resource test case. This fills in and optimizes the technical gaps in the fields related to data resource development and testing. It can not only automatically maintain the data resource test case model, but also be applicable to scenarios where different data resources change dynamically. It can update, iterate or discard the original test case model based on the result analysis to generate a new test case model. At the same time, it saves the execution result labels before and after the data resource test case changes to facilitate users to trace data resources.
[0082] An embodiment of the present invention further provides a computer device, Figure 5 is a schematic diagram of the structure of a computer device provided by an embodiment of the present invention; see the accompanying drawings Figure 5 As shown, the computer device includes: an input system 23, an output system 24, a memory 22 and a processor 21; the memory 22 is used to store one or more programs; when the one or more programs are executed by the one or more processors 21, the one or more processors 21 implement the model-based data resource automated testing method provided in the above embodiment; wherein the input system 23, the output system 24, the memory 22 and the processor 21 can be connected by a bus or other means, Figure 5 The example of connecting through bus is taken in the following.
[0083] The memory 22 is a readable and writable storage medium of a computing device, and can be used to store software programs, computer executable programs, such as the program instructions corresponding to the model-based data resource automated testing method described in the embodiment of the present invention; the memory 22 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application required for a function; the data storage area can store data created according to the use of the device, etc.; in addition, the memory 22 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device; in some instances, the memory 22 can further include a memory remotely arranged relative to the processor 21, and these remote memories can be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0084] The input system 23 may be used to receive input digital or character information, and to generate key signal input related to user settings and function control of the device; the output system 24 may include display devices such as display screens.
[0085] The processor 21 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 22, that is, realizes the above-mentioned model-based data resource automatic testing method.
[0086] The computer device provided above can be used to execute the model-based data resource automated testing method provided in the above embodiment, and has corresponding functions and beneficial effects.
[0087] The embodiment of the present invention also provides a storage medium containing computer executable instructions, which are used to execute the model-based data resource automated testing method provided by the above embodiment when executed by a computer processor. The storage medium is any of various types of memory devices or storage devices, and the storage medium includes: installation media, such as CD-ROM, floppy disk or tape system; computer system memory or random access memory, such as DRAM, DDRRAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (such as hard disk or optical storage); registers or other similar types of memory elements, etc.; the storage medium may also include other types of memory or combinations thereof; in addition, the storage medium may be located in the first computer system in which the program is executed, or may be located in a different second computer system, the second computer system is connected to the first computer system via a network (such as the Internet); the second computer system may provide program instructions to the first computer for execution. The storage medium includes two or more storage media that can reside in different locations (for example, in different computer systems connected via a network). The storage medium can store program instructions (for example, specifically implemented as a computer program) that can be executed by one or more processors.
[0088] Of course, the computer executable instructions of a storage medium containing computer executable instructions provided in an embodiment of the present invention are not limited to the model-based data resource automated testing method described in the above embodiment, and can also execute related operations in the model-based data resource automated testing method provided in any embodiment of the present invention.
[0089] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments, but it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.
[0090] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A model-based data resource automated testing method, characterized in that: The following steps are involved: S1, access the database corresponding to the data resource; Access the target database where the data resources need to be stored; configure the metadata collection task of the data resources, and copy the metadata of the data resources in the target database; generate the test case suite name of the data resources, and generate the test case model names of different levels of the data resources; S2. Configure the collection tasks from different databases as scheduling tasks, select the operation cycle and validity period according to the iteration frequency of data resources, set the failed tasks to be re-run, and publish the metadata collection tasks in the scheduling list as effective after the scheduling task configuration is completed; complete the reading of data resources for each test case, and process them into writing data resources; executing the test using the test case; S3. Publish the test cases that have been successfully executed and mark them as data resource test case models. Select one or more test cases that are marked as valid and publish them as test case models. Configure the data resource test case model scheduling task, select the data resource test case model, select the run cycle and run validity period, set the failed task to be re-run, and publish the data resource test case model in the scheduling list as effective after the task configuration is completed. S4. Analyze the execution result of the scheduled task, extract the execution result information and compare it with the original test case information. When the execution result is successful, keep the test case unchanged; When the execution result is failure, the information of the data resource changes in the execution log is obtained and compared with the data resource information of the original test case. The original test case is automatically marked, and the data resource test case model is regenerated after the data resource changes.
2. The model-based data resource automated testing method according to claim 1, characterized in that: The method for generating the test case suite name of the data resource in step S1 includes: naming the main suite name in the form of the names of data resources A to data resources N, the lower layer of the main suite name sequentially includes the sub-suite names of the following levels: ODS data resource source layer, DWD standard layer cleaning and conversion, DWS data resource summary layer, and generating the test case suite name of the data resource; The method for generating test case model names of different levels of data resources in step S1 includes: using SQL statements to obtain the table names of data resources A to data resources N, placing them in a small model, and naming the test case models of data resources with ODS_table name 1_data resource A, ODS_table name 1_data resource N, DWD_table name 1_data resource A, and DWD_table name 1_data resource N, respectively.
3. The model-based data resource automated testing method according to claim 1, characterized in that: The method of completing the reading of data resources for each test case in step S2 and processing the processing to write data resources includes: Use SQL statements to obtain the field names of data resources and complete variable assignment of field names; insert an operation time field on the metadata that is consistent with the data resource structure corresponding to the target database; determine whether it is a partitioned table. If it is a non-partitioned table, convert the non-partitioned table to a partitioned table; if it is a partitioned table, read the data resource library after successfully processing the partitioned table, select the metamodel, select the entity table resource name, select the field to be processed, and complete the operation of reading the data resource; select to write to the target table corresponding to the data resource, select the copied metamodel and target table name, select the column to be written, select the number of concurrency, and complete the operation of writing the data resource.
4. The model-based data resource automated testing method according to claim 1, characterized in that: The method for configuring the metadata collection task of the data resource in step S1 includes: Add a collection task of data resources from different databases, run the collection task to obtain metadata of the data resources, and change the collected metadata to a published state.
5. The model-based data resource automated testing method according to claim 1, characterized in that: The method for copying metadata of data resources in the target database in step S1 includes: Select metadata of one or more data resources for replication or batch replication, and generate metadata consistent with the structure of the data resources in the target database.
6. The model-based data resource automated testing method according to claim 1, characterized in that: The method for parsing the execution result of the scheduling task in step S4 includes: The data resource test case model is automatically executed according to the scheduled time, and the date and execution success or failure identification information are marked in the data resource target table.
7. The model-based data resource automated testing method according to claim 1, characterized in that: The method of publishing the test case that has been successfully executed and marking it as a data resource test case model in step S3 includes: According to the analysis of the execution log information, each test case is marked as a valid data resource test case after successful execution; one or more data resource test cases marked as valid are selected and published as a data resource test case model.
8. A model-based data resource automated testing system, characterized in that: Executing the model-based data resource automated testing method according to any one of claims 1 to 7, comprising: Data resource test case model name generation module: used to access the database corresponding to the data resource; access the target database where the data resource needs to be stored; configure the metadata collection task of the data resource, and copy the metadata of the data resource in the target database; generate the test case suite name of the data resource, and generate the test case model names of different levels of the data resource; Data resource test case generation module: used to configure the collection tasks from different databases into scheduling tasks, select the operation cycle and operation validity period according to the data resource iteration frequency, set the failed tasks to be re-run, and publish the metadata collection tasks in the scheduling list as effective after the scheduling task configuration is completed; complete the reading of data resources for each test case, and process them into writing data resources; use the test cases to execute the test; Data resource test case model generation module: used to mark the test cases that have been successfully executed as data resource test case models, select one or more test cases marked as valid, and publish them as test case models; configure the data resource test case model scheduling task, select the data resource test case model, select the operation cycle and operation validity period, set the failed task to be re-run, and publish the data resource test case model in the scheduling list as effective after the task configuration is completed; Data resource test case model automatic maintenance module: used to parse the execution results of the scheduling tasks, extract the execution result information and compare it with the original test case information. When the execution result is successful, the test case remains unchanged; when the execution result is failed, the information of the changed part of the data resource in the execution log is obtained and compared with the data resource information of the original test case. The original test case is automatically marked, and the data resource test case model is regenerated after the data resource changes.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the model-based data resource automated testing method according to any one of claims 1 to 7 are implemented.
10. A computer 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 program, the steps of the model-based data resource automated testing method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Big data testing method and device, electronic equipment and storage medium
CN114416845A
Data warehouse test method, device and equipment
CN115203024A
Method and equipment for quickly and automatically constructing system cases based on mapping model
CN118820116A
Regression testing method, device and equipment based on SDK (Software Development Kit) and medium
CN119127691A
Method, apparatus and computer program for automatically generating test case for software quality assurance
KR102500433B1