Data construction method and device, equipment and storage medium
Through the automated data construction method, pre-configured task information and script templates are used to realize automatic number creation without manual scripting, solving the problems of high data cost, low efficiency and insufficient data diversity in the existing technology, and improving the The efficiency and diversity of numbers are achieved.
Patent Information
- Application Number
- CN202411742284.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-02-21
AI Technical Summary
In the prior art, testers need to manually write multiple fabrication scripts to generate test data, resulting in high cost, low efficiency, and inability to ensure the diversity of test data.
By determining the number table to be created in the pre-configured task information, the script template and script information are automatically determined, the task instance is generated and stored in the database, and the script information is executed according to the current time and environment to achieve automatic number creation.
The target data matching the number table to be created without manual scripting is generated, which improves the diversity and efficiency of the number and reduces costs.
Smart Images

Figure CN119493732A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of artificial intelligence technology, and in particular, to a data construction method, device, equipment and storage medium. Background Art
[0002] With the development of technology, more and more application systems are used to process business, so the performance of application systems affects the efficiency of business processing. Since application systems are built according to different business scenarios, it is also necessary to build test data that meets the corresponding business scenarios during the testing of application systems.
[0003] In the prior art, testers need to manually write multiple number-generating scripts based on tables as dimensions, and then execute the number-generating scripts to generate test data required for testing.
[0004] However, manually written number-generating scripts only support number generation for a limited number of tables and cannot guarantee the diversity of test data. In addition, number generation is costly and inefficient. Summary of the invention
[0005] The present invention provides a data construction method, device, equipment and storage medium, which realize data construction without manually writing scripts and improve the diversity of number creation.
[0006] In a first aspect, an embodiment of the present invention provides a data construction method, including:
[0007] Determine a script template according to the table of numbers to be created in the pre-configured task information, and determine script information according to the script template and configuration information of each variable in the script template;
[0008] Generate a task instance according to the task information and the script information, and store the task instance in a database;
[0009] When it is determined that the current time reaches the start time in the task information of the task instance and the current environment satisfies the number-making environment in the task information, target data matching the number table to be made is obtained by executing the script information.
[0010] The technical solution of the embodiment of the present invention provides a data construction method, comprising: determining a script template according to a table of numbers to be created in pre-configured task information, and determining script information according to the script template and configuration information of each variable in the script template; generating a task instance according to the task information and the script information, and storing the task instance in a database; determining that the current time reaches the start time in the task information of the task instance and the current environment satisfies the number creation environment in the task information, and obtaining target data matching the table of numbers to be created by executing the script information. According to the above technical solution, after determining the table to be created in the pre-configured task information, the field values of the table to be created can be replaced with variables to obtain a script template. The script information can also be determined according to the configuration information set by the tester for each variable in the script template. Specifically, each variable in the script template can be replaced with the configuration information corresponding to each variable to obtain the script information. The script information required for constructing the data matching the table to be created in the task information can be determined without manual writing, and the automatic generation of the script information can be realized. Then, according to the task information and the script information required for constructing the data matching the table to be created in the task information, a task instance for constructing the data matching the table to be created in the task information can be generated, and based on the task information and the generated task instance stored in the database, the start time of each task instance in the database and the current environment of the database are monitored in real time. After determining that the current time and the current environment meet the requirements of the task instance, the target data matching the table to be created in the task information of the task instance is constructed by executing the script information of the task instance, and automatic number creation based on the table to be created is realized.
[0011] Further, the script template is determined according to the table to be created in the pre-configured task information, including:
[0012] The script template is obtained by replacing each field value in the table to be created with a variable, wherein the variable is composed of a field name, a data type, a data length and a data attribute.
[0013] Further, the script information is determined according to the script template and the configuration information of each variable in the script template, including:
[0014] The script information is obtained by replacing each variable in the script template with the configuration information corresponding to each variable.
[0015] Furthermore, the task information includes the start time and the creation environment. Accordingly, after the task instance is stored in the database, it also includes:
[0016] The start time of the task instance is monitored; when it is determined that the current time reaches the start time of the task instance, determining whether the current environment satisfies the number-making environment.
[0017] Furthermore, the task information includes the number of concurrent threads. Accordingly, by executing the script information, target data matching the table to be created is obtained, including:
[0018] A corresponding number of threads are initiated according to the number of concurrent threads, and the script information is executed based on each of the threads to obtain target data matching the table to be created.
[0019] Furthermore, the task information includes the total amount of number generation. Accordingly, when executing the script information, it also includes:
[0020] Acquire the real-time creation quantity; and if it is determined that the real-time creation quantity is not less than the total creation quantity, suspend execution of the script information.
[0021] In a second aspect, an embodiment of the present invention further provides a data construction device, including:
[0022] A determination module, used to determine a script template according to a table to be created in pre-configured task information, and to determine script information according to the script template and configuration information of each variable in the script template;
[0023] A generation module, used to generate a task instance according to the pre-configured environment information, the task information and the script information, and store the task instance in a database;
[0024] The execution module is used to determine that when the current time reaches the start time in the task information of any task instance in the database and the current environment meets the environment information, obtain the target data matching the table to be created by executing the script information.
[0025] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:
[0026] at least one processor; and a memory communicatively coupled to the at least one processor;
[0027] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the data construction method as described in any one of the first aspects.
[0028] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, are used to execute the data construction method as described in any one of the first aspects.
[0029] In a fifth aspect, the present application provides a computer program product, which includes computer instructions. When the computer instructions are executed on a computer, the computer executes the data construction method provided in the first aspect.
[0030] It should be noted that the above-mentioned computer instructions may be stored in whole or in part on a computer-readable storage medium. The computer-readable storage medium may be packaged together with the processor of the data construction device, or may be packaged separately from the processor of the data construction device, and this application does not limit this.
[0031] The description of the second, third, fourth and fifth aspects in this application can refer to the detailed description of the first aspect; and the beneficial effects of the description of the second, third, fourth and fifth aspects can refer to the beneficial effect analysis of the first aspect, which will not be repeated here.
[0032] In this application, the name of the above-mentioned data construction device does not limit the device or functional module itself. In actual implementation, these devices or functional modules may appear with other names. As long as the functions of each device or functional module are similar to those of this application, they fall within the scope of the claims of this application and their equivalent technologies.
[0033] These and other aspects of the present application will become more apparent from the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0035] Figure 1 A flowchart of a data construction method provided by an embodiment of the present invention;
[0036] Figure 2 A flowchart of another data construction method provided by an embodiment of the present invention;
[0037] Figure 3 A schematic diagram of the structure of a data construction device provided by an embodiment of the present invention;
[0038] Figure 4 A schematic diagram of a data construction system provided by an embodiment of the present invention;
[0039] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0041] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0042] The terms "first" and "second" and the like in the specification and drawings of this application are used to distinguish different objects, or to distinguish different processing of the same object, rather than to describe a specific order of objects.
[0043] In addition, the terms "including" and "having" and any variations thereof mentioned in the description of the present application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include other steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.
[0044] It should be mentioned before discussing exemplary embodiments in more detail that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe various operations (or steps) as sequential processes, many operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of various operations can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to methods, functions, procedures, subroutines, subprograms, etc. In addition, the embodiments in the present invention and the features in the embodiments can be combined with each other without conflict.
[0045] It should be noted that, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0046] In the description of the present application, unless otherwise specified, “plurality” means two or more.
[0047] Figure 1A flowchart of a data construction method provided in an embodiment of the present invention is provided. This embodiment is applicable to situations where diversified data needs to be constructed at low cost. The method can be executed by a data construction device, such as Figure 1 As shown, the specific steps include:
[0048] Step 110: determine a script template according to the table to be created in the pre-configured task information, and determine script information according to the script template and configuration information of each variable in the script template.
[0049] Testers can pre-configure task information, specifically the table to be created, the environment for creating data, and the start time, among which the table to be created can be understood as the table structure information in the database, the environment for creating data can be understood as the database environment when constructing data, and the start time can be understood as the start time of constructing data.
[0050] Specifically, the script template can be determined according to the table structure information indicated by the table to be created in the task information. Specifically, the field values in the table to be created can be replaced with variables to obtain the script template corresponding to the table to be created. The table to be created includes at least one field value. Therefore, the script template includes at least one variable in the format of {field name, data type, data length and data attribute}. For example, {testid, varchar, 10, (notnull, pk)} indicates that the field name of the variable is testid, the data type is varchar, the data length is 10, and the data attribute is not empty and is the primary key. The variable name here has no actual meaning and provides a reference for testers to configure parameters.
[0051] The script template is sent to the terminal device corresponding to the tester. The tester can configure each variable in the script template, that is, to determine the configuration information of each variable. The configuration information of each variable indicates the value of the corresponding field in the table to be created. For example, the configuration information set for {testid, varchar, 10, (notnull, pk)} can be {uid, 10}, which indicates a self-increasing 10-digit length sequence number. Furthermore, each variable in the script template can be replaced based on the configuration information of each variable to obtain the script information.
[0052] In an embodiment of the present invention, after obtaining a script template by replacing each field value of the table to be created in the pre-configured task information with variables, the script information is determined according to the configuration information set by the tester for each variable in the script template. The script information required to construct the data matching the table to be created in the task information can be determined without manual writing, thereby realizing automatic generation of the script information.
[0053] Step 120: Generate a task instance according to the task information and the script information, and store the task instance in a database.
[0054] After the tester configures the task information, the database environment can be configured based on the number-building environment in the task information. The number-building environment can be understood as the environment information of the database when constructing data that matches the table to be built, including the database server IP, port, SCHEMA name and other related information. Therefore, the database environment can be configured based on the number-building environment.
[0055] Specifically, after it is determined that the database environment configuration is completed, a task instance can be generated according to the task information and the script information, and the state of the task instance can be set to be executed.
[0056] In the embodiment of the present invention, a task instance for matching data in a table to be created in the task information is generated according to the task information and the script information required for matching data in the table to be created in the task information, and the generated task instance is stored in a database.
[0057] Step 130: When it is determined that the current time reaches the start time in the task information of the task instance and the current environment satisfies the number-making environment in the task information, the target data matching the number-making table to be created is obtained by executing the script information.
[0058] At least one task instance is stored in the database, and the start time of each task instance in the database is monitored in real time. When it is determined that the current time reaches the start time of any task instance, it can be determined whether the current environment of the database satisfies the number-making environment in the task information of the task instance, and after determining that the current environment of the database satisfies the number-making environment in the task information of the task instance, it is determined that the script information corresponding to the task instance can be executed.
[0059] Specifically, when it is determined that the current time reaches the start time in the task information of the task instance and the current environment of the database satisfies the number-making environment in the task information of the task instance, the status of the task instance can be updated to executing. At this time, the script information corresponding to the task instance can be determined, and by executing the script information, the target data that matches the number-making table in the task information of the task instance can be obtained.
[0060] In an embodiment of the present invention, after determining that the current time and the current environment both meet the requirements of the task instance, the script information of the task instance is executed to construct target data that matches the table of numbers to be created in the task information of the task instance, thereby realizing automatic number creation based on the table of numbers to be created.
[0061] The data construction method provided by the embodiment of the present invention comprises: determining a script template according to a table to be created in pre-configured task information, and determining script information according to the script template and configuration information of each variable in the script template; generating a task instance according to the task information and the script information, and storing the task instance in a database; determining that the current time reaches the start time in the task information of the task instance and the current environment satisfies the number creation environment in the task information, and obtaining target data matching the table to be created by executing the script information. According to the above technical solution, after determining the table to be created in the pre-configured task information, the field values of the table to be created can be replaced with variables to obtain a script template. The script information can also be determined according to the configuration information set by the tester for each variable in the script template. Specifically, each variable in the script template can be replaced with the configuration information corresponding to each variable to obtain the script information. The script information required for constructing the data matching the table to be created in the task information can be determined without manual writing, and the automatic generation of the script information can be realized. Then, according to the task information and the script information required for constructing the data matching the table to be created in the task information, a task instance for constructing the data matching the table to be created in the task information can be generated, and based on the task information and the generated task instance stored in the database, the start time of each task instance in the database and the current environment of the database are monitored in real time. After determining that the current time and the current environment meet the requirements of the task instance, the target data matching the table to be created in the task information of the task instance is constructed by executing the script information of the task instance, and automatic number creation based on the table to be created is realized.
[0062] Figure 2 This is a flowchart of another data construction method provided by an embodiment of the present invention. This embodiment is specific based on the above embodiment. Figure 2 As shown, in this embodiment, the method may further include:
[0063] Step 210: Determine a script template according to the table to be created in the pre-configured task information.
[0064] In one implementation, step 210 may specifically include:
[0065] The script template is obtained by replacing each field value in the table to be created with a variable, wherein the variable is composed of a field name, a data type, a data length and a data attribute.
[0066] When testers pre-configure task information, they can configure the table to be created, the number of concurrent threads, the total number of numbers created, the environment for creating numbers, and the start time, among which the table to be created can be understood as the table structure information in the database, the number of concurrent threads can be understood as the number of threads that can be executed simultaneously when creating numbers, the total number of numbers created can be understood as the total amount of data created based on the table to be created, the environment for creating numbers can be understood as the database environment when constructing data, and the start time can be understood as the start time of constructing data.
[0067] For example, when the field values of the table to be created include testid VARCHAR2(10)not null, testno VARCHAR2(5)not null, testdate VARCHAR2(8), custname VARCHAR2(60), teststatus VARCHAR2(5), etc., replacing the field values with variables can obtain {testid,varchar,10,(notnull,pk)}, {testno,varchar,5,(notnull)}, {testdate,varchar,8}, {custname,varchar,60}, {teststatus,varchar,5}, etc. {testno,varchar,5,(notnull)} means that the field name of the variable is testno, the data type is varchar, the data length is 5, the data attribute is not null, {testdate,v archar,8} indicates that the field name of the variable is testdate, the data type is varchar, and the data length is 8. {custname,varchar,60} indicates that the field name of the variable is custname, the data type is varchar, and the data length is 60. {teststatus,varchar,5} indicates that the field name of the variable is teststatus, the data type is varchar, and the data length is 5. {testno,varchar,5,(notnull)} indicates that the field name of the variable is testno, the data type is varchar, the data length is 5, and the data attribute is not null.
[0068] Specifically, after the table to be created is determined in the pre-configured task information, the script template can be obtained by replacing the field values in the table to be created with variables.
[0069] In the embodiment of the present invention, the automatic determination of the script template is achieved by changing the field values of the table to be created in the pre-configured task information into variables.
[0070] Step 220: Determine script information according to the script template and configuration information of each variable in the script template.
[0071] In one implementation, step 220 may specifically include:
[0072] The script information is obtained by replacing each variable in the script template with the configuration information corresponding to each variable.
[0073] Specifically, after determining the script template, the script template can be sent to the terminal device corresponding to the tester. The tester can configure each variable in the script template based on the terminal device, that is, the field name, data type, data length and data attribute corresponding to each variable and the actual number generation need to determine the configuration information of each variable. The configuration information of each variable indicates the value-taking method of the corresponding field in the table to be generated. For example, the configuration information set for {testid, varchar, 10, (notnull, pk)} can be {uid, 10}, indicating a self-increasing 10-digit length sequence number, the configuration information set for {testno, varchar, 5, (notnull)} can be {rannum, 5}, indicating a 5-digit random number, the configuration information set for {testdate, varchar, 8} can be {date8, 8}, indicating an 8-digit random date, the configuration information set for {custname, varchar, 60} can be defined as custname as a data set, and 60 data are randomly obtained from the data set, and the configuration information set for {teststatus, varchar, 5} can be "2", indicating that the field value is fixed to 2.
[0074] Furthermore, each variable in the script template can be replaced based on the configuration information of each variable to obtain script information.
[0075] In the embodiment of the present invention, by replacing each variable in the script template with the configuration information set by the tester for each variable, the script information required to construct and match the data in the table to be constructed in the task information can be determined without manual writing, thereby realizing automatic generation of script information.
[0076] Step 230: Generate a task instance according to the task information and the script information, and store the task instance in a database.
[0077] Specifically, a task instance can be generated according to the task information and the script information, and a task identifier can be assigned to the task instance, and the task instance can be stored in the to-be-executed task table of the database based on the task identifier. The execution of the task instance requires that the current time reaches the start time, the current environment meets the number-making environment, the total number of concurrent threads for the execution of the task instance is the number of concurrent threads, and the termination condition of the task instance is that the amount of constructed data reaches the total amount of number-making.
[0078] Step 240: Monitor the start time of the task instance.
[0079] Specifically, task information of the task instance is acquired based on the task identifier of the task instance, and a start time is determined in the task information, and it is determined whether the current time reaches the start time.
[0080] Step 250: When it is determined that the current time reaches the start time, determine whether the current environment satisfies the number-generating environment.
[0081] Specifically, when it is determined that the current time reaches the start time, the number-making environment is determined in the task information, and then it can be determined whether the current environment meets the number-making environment, that is, it can be determined whether the current environment is consistent with the number-making environment. When it is determined that the current environment is consistent with the number-making environment, it is determined that the current environment meets the number-making environment.
[0082] In actual applications, you can perform availability checks on the database by executing statements such as select 1 from dual to determine whether the current environment meets the data creation environment.
[0083] Step 260: When it is determined that the current time reaches the start time in the task information of the task instance and the current environment satisfies the number-making environment in the task information, the target data matching the number-making table to be made is obtained by executing the script information.
[0084] In one implementation, the task information includes the number of concurrent threads. Accordingly, by executing the script information, target data matching the table to be created is obtained, including:
[0085] A corresponding number of threads are initiated according to the number of concurrent threads, and the script information is executed based on each of the threads to obtain target data matching the table to be created.
[0086] Specifically, when it is determined that the current time reaches the start time and the current environment meets the number-making environment, the number of concurrent threads is determined in the task information, the script information is obtained based on the task identifier of the task instance, and the corresponding number of threads is called according to the number of concurrent threads. The script information is executed based on each thread, and the target data matching the number table to be made can be obtained. For example, executing the above script information can obtain "0000000001", "12345", "20221012", "Zhang San", "2", etc.
[0087] Furthermore, the task information includes the total amount of number generation. Accordingly, when executing the script information, it also includes:
[0088] Acquire the real-time creation quantity; and if it is determined that the real-time creation quantity is not less than the total creation quantity, suspend execution of the script information.
[0089] Specifically, when it is determined that the current time reaches the start time and the current environment meets the number generation environment, the total number of numbers generated can also be determined in the task information. In the process of executing the script information to generate numbers, the real-time number of numbers generated can also be obtained. Specifically, the real-time number of numbers generated can be obtained by executing select count(1)from table name. If the real-time number of numbers generated reaches the total number of numbers generated, it can be determined that the task instance is successfully executed and the execution of the script information can be suspended.
[0090] It should be noted that the database stores at least one task instance, and the start time of each task instance in the database's to-be-executed task table is monitored in real time. Specifically, the task information of each task instance can be obtained based on the task identifier of each task instance, and the start time can be determined in the task information, and it is determined whether the current time reaches the start time of each task instance. When it is determined that the current time reaches the start time of any task instance, the number-making environment and the total number of numbers made are determined in the task information of the task instance, and it is determined whether the current environment of the database satisfies the number-making environment. After determining that the current environment of the database satisfies the number-making environment, the script information of the task instance is obtained based on the task identifier of the task instance, the number of concurrent threads is determined in the task information, the script information is obtained based on the task identifier of the task instance, the corresponding number of threads is called according to the number of concurrent threads, the script information is executed based on each thread, and the real-time number of numbers made is obtained at the same time. When it is determined that the real-time number of numbers made reaches the total number of numbers made, the execution of the script information is suspended to obtain the target data matching the to-be-made table.
[0091] In an embodiment of the present invention, after determining that the current time and the current environment both meet the requirements of the task instance, the script information of the task instance is executed by initiating threads with the same number of concurrent threads, and target data matching the table of numbers to be created in the task information of the task instance is constructed, thereby realizing automatic number creation based on the table of numbers to be created, and further realizing configurable number creation.
[0092] The data construction method provided by the embodiment of the present invention includes: determining a script template according to a table to be created in pre-configured task information; determining script information according to the script template and configuration information of each variable in the script template; generating a task instance according to the task information and the script information, and storing the task instance in a database; monitoring the start time of the task instance; when it is determined that the current time reaches the start time, determining whether the current environment satisfies the number creation environment; when it is determined that the current time reaches the start time in the task information of the task instance and the current environment satisfies the number creation environment in the task information, obtaining target data matching the table to be created by executing the script information. According to the above technical solution, after determining the table to be created in the pre-configured task information, the field values of the table to be created can be replaced with variables to obtain a script template. The script information can also be determined according to the configuration information set by the tester for each variable in the script template. Specifically, each variable in the script template can be replaced with the configuration information corresponding to each variable to obtain the script information. The script information required for constructing the data matching the table to be created in the task information can be determined without manual writing, and the automatic generation of the script information can be realized. Then, according to the task information and the script information required for constructing the data matching the table to be created in the task information, a task instance for constructing the data matching the table to be created in the task information can be generated, and based on the task information and the generated task instance stored in the database, the start time of each task instance in the database and the current environment of the database are monitored in real time. After determining that the current time and the current environment meet the requirements of the task instance, the target data matching the table to be created in the task information of the task instance is constructed by executing the script information of the task instance, and automatic number creation based on the table to be created is realized.
[0093] Moreover, by executing the script information, it is possible to automatically generate numbers for a variety of number tables to be generated in a variety of environments, thus achieving the diversity of number generation. At the same time, by storing the task instances in the database, the persistence of the task instances is achieved, which improves the reusability of the script information and reduces the workload of manual maintenance by the testers.
[0094] Figure 3 This is a schematic diagram of a data construction device provided by an embodiment of the present invention, which can be applied to situations where low-cost construction of diversified data is required. The device can be implemented by software and / or hardware and is generally integrated in an electronic device, such as a computer device.
[0095] like Figure 3 As shown, the device comprises:
[0096] The determination module 310 is used to determine the script template according to the table to be created in the pre-configured task information, and determine the script information according to the script template and the configuration information of each variable in the script template;
[0097] A generating module 320, configured to generate a task instance according to the pre-configured environment information, the task information and the script information, and store the task instance in a database;
[0098] The execution module 330 is used to determine that when the current time reaches the start time in the task information of any task instance in the database and the current environment meets the environment information, obtain the target data matching the table to be created by executing the script information.
[0099] The data construction device provided in this embodiment determines a script template according to a table of numbers to be created in pre-configured task information, and determines script information according to the script template and configuration information of each variable in the script template; generates a task instance according to the task information and the script information, and stores the task instance in a database; and obtains target data matching the table of numbers to be created by executing the script information when it is determined that the current time reaches the start time in the task information of the task instance and the current environment satisfies the number creation environment in the task information. According to the above technical solution, after determining the table to be created in the pre-configured task information, the field values of the table to be created can be replaced with variables to obtain a script template. The script information can also be determined according to the configuration information set by the tester for each variable in the script template. Specifically, each variable in the script template can be replaced with the configuration information corresponding to each variable to obtain the script information. The script information required for constructing the data matching the table to be created in the task information can be determined without manual writing, and the automatic generation of the script information can be realized. Then, according to the task information and the script information required for constructing the data matching the table to be created in the task information, a task instance for constructing the data matching the table to be created in the task information can be generated, and based on the task information and the generated task instance stored in the database, the start time of each task instance in the database and the current environment of the database are monitored in real time. After determining that the current time and the current environment meet the requirements of the task instance, the target data matching the table to be created in the task information of the task instance is constructed by executing the script information of the task instance, and automatic number creation based on the table to be created is realized.
[0100] Based on the above embodiment, the determination module 310 is specifically used for:
[0101] The script template is obtained by replacing each field value in the table to be created with a variable, wherein the variable is composed of a field name, a data type, a data length and a data attribute; and the script information is obtained by replacing each variable in the script template with the configuration information corresponding to each variable.
[0102] Based on the above embodiment, the task information includes the start time and the number-making environment. Accordingly, the device further includes:
[0103] A monitoring module is used to monitor the start time of the task instance; when it is determined that the current time reaches the start time, determine whether the current environment meets the number-making environment.
[0104] Based on the above embodiment, the task information includes the number of concurrent threads. Accordingly, the execution module 330 is specifically used to:
[0105] When it is determined that the current time reaches the start time in the task information of the task instance and the current environment satisfies the number-making environment in the task information, a corresponding number of threads are initiated according to the number of concurrent threads, and the script information is executed based on each of the threads to obtain target data matching the number table to be made.
[0106] Furthermore, the execution module 330 is further configured to:
[0107] When executing the script information, the real-time creation quantity is obtained; when it is determined that the real-time creation quantity is not less than the total creation quantity, the execution of the script information is suspended.
[0108] The data construction device provided in the embodiment of the present invention can execute the data construction method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the data construction method.
[0109] It is worth noting that in the embodiment of the above-mentioned data construction device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0110] Figure 4 A schematic diagram of a data construction system provided by an embodiment of the present invention, such as Figure 4 As shown, the system includes a first database, a second database, a configuration device, a scheduling device, an execution device and a monitoring device. The configuration device is used to configure the generation of task information, script information and task instances. The first database is used to store task instances based on a to-be-executed task table. The scheduling device is used to periodically scan the to-be-executed task table of the database, and after determining that the current time and the current environment meet the requirements of any task instance, send the task identifier of the task instance to the execution module. The execution device is used to obtain the script information of the task instance in the first database based on the task identifier, generate target data matching the to-be-created table in the task information of the task instance by executing the script information, and store the target data in the second database. The monitoring device is used to determine the real-time creation quantity by monitoring the second database, and synchronize the real-time creation quantity to the first database.
[0111] The data construction system provided by the embodiment of the present invention can execute the data construction method provided by any embodiment of the present invention, and has the corresponding beneficial effects of executing the data construction method.
[0112] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 5 A block diagram of an exemplary electronic device 5 suitable for implementing embodiments of the present invention is shown. Figure 5 The electronic device 5 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0113] like Figure 5 As shown, the electronic device 5 is in the form of a general purpose computing electronic device. The components of the electronic device 5 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 connecting different system components (including the system memory 28 and the processing unit 16).
[0114] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0115] The electronic device 5 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 5, including volatile and non-volatile media, removable and non-removable media.
[0116] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 5 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 5 not shown, usually called a "hard drive"). Although Figure 5Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.
[0117] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0118] The electronic device 5 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), one or more devices that enable a user to interact with the electronic device 5, and / or any device that enables the electronic device 5 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the electronic device 5 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 20. Figure 5 As shown, the network adapter 20 communicates with other modules of the electronic device 5 via the bus 18. It should be understood that although Figure 5 Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 5, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0119] The processing unit 16 executes various functional applications and page displays by running the programs stored in the system memory 28, for example, implementing the data construction method provided in the embodiment of the present invention, which includes:
[0120] Determine a script template according to the table of numbers to be created in the pre-configured task information, and determine script information according to the script template and configuration information of each variable in the script template;
[0121] Generate a task instance according to the task information and the script information, and store the task instance in a database;
[0122] When it is determined that the current time reaches the start time in the task information of the task instance and the current environment satisfies the number-making environment in the task information, target data matching the number table to be made is obtained by executing the script information.
[0123] Of course, those skilled in the art can understand that the processor can also implement the technical solution of the data construction method provided by any embodiment of the present invention.
[0124] An embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, for example, a data construction method provided in an embodiment of the present invention is implemented. The method includes:
[0125] Determine a script template according to the table of numbers to be created in the pre-configured task information, and determine script information according to the script template and configuration information of each variable in the script template;
[0126] Generate a task instance according to the task information and the script information, and store the task instance in a database;
[0127] When it is determined that the current time reaches the start time in the task information of the task instance and the current environment satisfies the number-making environment in the task information, target data matching the number table to be made is obtained by executing the script information.
[0128] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0129] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0130] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0131] Computer program code for performing the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0132] It should be understood by those skilled in the art that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented by a program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0133] In addition, the acquisition, storage, use, and processing of data in the technical solution of the present invention are in compliance with the relevant provisions of national laws and regulations.
[0134] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A data construction method, characterized in that: include: Determine a script template according to the table of numbers to be created in the pre-configured task information, and determine script information according to the script template and configuration information of each variable in the script template; Generate a task instance according to the task information and the script information, and store the task instance in a database; When it is determined that the current time reaches the start time in the task information of the task instance and the current environment satisfies the number-making environment in the task information, target data matching the number table to be made is obtained by executing the script information.
2. The data construction method according to claim 1, characterized in that: The script template is determined according to the table of numbers to be created in the pre-configured task information, including: The script template is obtained by replacing each field value in the table to be created with a variable, wherein the variable is composed of a field name, a data type, a data length and a data attribute.
3. The data construction method according to claim 1, characterized in that: Determining script information according to the script template and configuration information of each variable in the script template includes: The script information is obtained by replacing each variable in the script template with the configuration information corresponding to each variable.
4. The data construction method according to claim 1, characterized in that: The task information includes the start time and the creation environment. Accordingly, after the task instance is stored in the database, it also includes: Monitoring the start time of the task instance; When it is determined that the current time reaches the start time, it is determined whether the current environment satisfies the number creation environment.
5. The data construction method according to claim 1, characterized in that: The task information includes the number of concurrent threads. Accordingly, by executing the script information, target data matching the table to be created is obtained, including: A corresponding number of threads are initiated according to the number of concurrent threads, and the script information is executed based on each of the threads to obtain target data matching the table to be created.
6. The data construction method according to claim 1, characterized in that: The task information includes the total amount of number generation, and accordingly, when executing the script information, it also includes: Get the real-time production quantity; When it is determined that the real-time number of creations is not less than the total number of creations, the execution of the script information is suspended.
7. A data construction device, characterized in that: include: A determination module, used to determine a script template according to a table to be created in pre-configured task information, and to determine script information according to the script template and configuration information of each variable in the script template; A generating module, used for generating a task instance according to the task information and the script information, and storing the task instance in a database; The execution module is used to determine that when the current time reaches the start time in the task information of the task instance and the current environment meets the number-making environment in the task information, obtain the target data matching the number table to be made by executing the script information.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the data construction method as described in any one of claims 1-6.
9. A storage medium containing computer executable instructions, characterized in that: When the computer executable instructions are executed by a computer processor, they are used to perform the data construction method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the data construction method according to any one of claims 1 to 6.