Test data generation method and device, equipment, storage medium and program product
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-15
- Publication Date
- 2026-08-11
AI Technical Summary
[0005]本申请提供一种测试数据生成方法、装置、设备、存储介质和程序产品,用于解决现有技术中通过人工准备测试数据,存在的工作量大,费时费力,且不够灵活的缺陷
[0043]The test data generation method provided in this application involves obtaining master data based on business data; setting the master data and tag information in a configuration file of a data table to obtain a data file; the tag information being used to indicate rules for data processing based on the master data to generate new test data; and the data file containing a data script for generating new test data based on the master data; finally, running the data file to generate test data. This method not only ensures that the obtained test data guarantees normal transaction processing but also allows for the regeneration of test data based on the master data using tag information, eliminating the need for manual intervention and reducing the workload of test data generation, thus achieving high efficiency.
Smart Images

Figure CN115422071B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a test data generation method, apparatus, device, storage medium, and program product. Background Technology
[0002] For internet application software, performance is a crucial component of its quality. Currently, software performance testing is generally used to measure software performance.
[0003] In software performance testing, to identify system performance bottlenecks to the greatest extent possible, multiple and numerous concurrent stress tests are often required, which necessitates a large amount of test data. Current technology commonly employs manual preparation of test data tailored to specific business scenarios when generating test data.
[0004] However, existing technologies rely on manual preparation of test data, which is labor-intensive, time-consuming, and inflexible. Summary of the Invention
[0005] This application provides a test data generation method, apparatus, device, storage medium, and program product to address the shortcomings of existing technologies that rely on manual preparation of test data, which involves a large workload, is time-consuming and labor-intensive, and lacks flexibility.
[0006] On the one hand, this application provides a method for generating test data, including:
[0007] Obtain master data based on business data;
[0008] The master data and tag information are set in the configuration file of the data table to obtain a data file. The tag information is used to indicate the rules for data processing based on the master data to generate new test data. The data file records the data script for generating new test data based on the master data.
[0009] Run the data file to generate test data.
[0010] Optionally, the tag information includes: quantity tags and at least one field tag group, each field tag group being used to indicate the rules for data processing based on the master data to generate test data corresponding to each field tag group; running the data file to generate test data includes:
[0011] The master data is processed according to each field label group and the quantity label to generate test data corresponding to each field label group; wherein, the data volume of each field in the data file is determined according to the quantity label.
[0012] Optionally, the field label group includes a data repetition count label and a data value range label; the step of processing the master data according to each field label group and the quantity label to generate test data corresponding to each field label group includes:
[0013] Based on the data value range labels, determine the value range of the test data corresponding to each field label group, wherein the starting value of the value range is the master data;
[0014] Based on the data repetition count label, determine the repetition count of the value range;
[0015] Based on the number of repetitions within the value range and the quantity label, test data corresponding to each field label group is generated.
[0016] Optionally, generating test data corresponding to each field label group based on the number of repetitions within the value range and the quantity label includes:
[0017] Based on the number of repetitions within the range of values, determine the number of repetitions for each data unit within the range of values;
[0018] Based on the number of repetitions of each data unit, each data unit in the value range is processed repeatedly until the repetition process is completed or the amount of test data generated is equal to the target amount of data indicated by the quantity label, so as to obtain the test data corresponding to each field label group.
[0019] Wherein, the amount of data obtained after the repeated processing is less than or equal to the target amount of data.
[0020] Optionally, the field label group further includes: a parameterized configuration label, wherein the parameterized configuration label is used to indicate whether the field is a personalized field; when the parameterized configuration label indicates that the field is not a personalized field, the method further includes:
[0021] The master data is used as the test data corresponding to the field label group, wherein the data repetition count label and the data value range label are invalid when the parameterized configuration label indicates that the field is a non-personalized field.
[0022] Optionally, the field label group further includes a data initialization label, wherein the master data is set in the fill position corresponding to the data initialization label.
[0023] Optionally, running the data file to obtain test data includes:
[0024] Obtain the execution function option. If the execution function option is used to indicate importing data, then run the data file to import the test data corresponding to the data file into the database.
[0025] Secondly, this application provides a test data generation apparatus, comprising:
[0026] The acquisition module is used to obtain master data based on business data;
[0027] The processing module is used to set the master data and tag information in the configuration file of the data table to obtain a data file. The tag information is used to indicate the rules for data processing based on the master data to generate new test data. The data file records the data script for generating new test data based on the master data.
[0028] The generation module is used to run the data file and generate test data.
[0029] Optionally, the label information includes: quantity labels and at least one field label group, each field label group being used to indicate the rules for data processing based on the master data to generate test data corresponding to each field label group;
[0030] The generation module is specifically used to process the master data according to each field label group and the quantity label to generate test data corresponding to each field label group; wherein, the data volume of each field in the data file is determined according to the quantity label.
[0031] Optionally, the field label group includes a data repetition count label and a data value range label; the generation module is specifically used to determine the value range of the test data corresponding to each field label group based on the data value range label, wherein the starting value of the value range is the master data; determine the repetition count of the value range based on the data repetition count label; and generate test data corresponding to each field label group based on the repetition count of the value range and the quantity label.
[0032] Optionally, the generation module is specifically used to determine the number of repetitions of each data unit in the value range based on the number of repetitions in the value range; and to perform repetition processing on each data unit in the value range based on the number of repetitions of each data unit until the repetition processing is completed or the amount of test data generated is equal to the target amount of data indicated by the quantity label, thereby obtaining test data corresponding to each field label group; wherein, the amount of data obtained after the repetition processing is completed is less than or equal to the target amount of data.
[0033] Optionally, the field label group further includes: a parameterized configuration label, wherein the parameterized configuration label is used to indicate whether the field is a personalized field; the generation module is further used to use the master data as the test data corresponding to the field label group when the parameterized configuration label indicates that the field is not a personalized field, wherein the data repetition count label and the data value range label are invalid when the parameterized configuration label indicates that the field is a non-personalized field.
[0034] Optionally, the field label group further includes a data initialization label, wherein the master data is set in the fill position corresponding to the data initialization label.
[0035] Optionally, the generation module is specifically used to obtain execution function options. If the execution function options are used to indicate data import, then the data file is run to import the test data corresponding to the data file into the database.
[0036] Thirdly, this application provides a test data generation device, comprising:
[0037] Memory;
[0038] processor;
[0039] The memory stores computer-executed instructions;
[0040] The processor executes computer execution instructions stored in the memory to implement the test data generation method as described in the first aspect and various possible implementations of the first aspect above.
[0041] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the test data generation method as described in the first aspect and various possible implementations of the first aspect above.
[0042] Fifthly, this application provides a program product comprising: a computer program, which, when executed by a processor, implements the test data generation method as described in the first aspect and various possible implementations thereof.
[0043] The test data generation method provided in this application involves obtaining master data based on business data; setting the master data and tag information in a configuration file of a data table to obtain a data file; the tag information being used to indicate rules for data processing based on the master data to generate new test data; and the data file containing a data script for generating new test data based on the master data; finally, running the data file to generate test data. This method not only ensures that the obtained test data guarantees normal transaction processing but also allows for the regeneration of test data based on the master data using tag information, eliminating the need for manual intervention and reducing the workload of test data generation, thus achieving high efficiency. Attached Figure Description
[0044] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0045] Figure 1 The process of the test data generation method provided in this application Figure 1 ;
[0046] Figure 2 The process of the test data generation method provided in this application Figure 2 ;
[0047] Figure 3 This is a schematic diagram of the data file shown in this embodiment;
[0048] Figure 4 This is a schematic diagram of the test data provided in this embodiment;
[0049] Figure 5 A schematic diagram of the test data generation device provided in this application;
[0050] Figure 6 A schematic diagram of the test data generation device provided in this application.
[0051] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0052] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0053] The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented, for example, in orders other than those illustrated or described herein.
[0054] First, the terms used in this application will be explained:
[0055] Performance testing: Performance testing verifies whether the software's performance can still meet performance indicators under normal environmental and system conditions, and at the same time discovers performance bottlenecks in the system. It obtains the maximum service level that the system can provide by identifying a system's bottleneck or unacceptable performance point.
[0056] Personalized fields: Personalized fields are used to distinguish each piece of test data and identify the differences in the important parts of each piece of data.
[0057] For internet application software, performance is a crucial component of its quality. Software performance testing, as an important means of addressing software performance issues, is widely known and receives significant attention. System performance testing is often conducted when a new system is launched or a major software version is updated to identify any performance problems.
[0058] In order to discover system performance bottlenecks to the greatest extent, multiple concurrent stress tests are often required in performance testing, which requires a large amount of test data.
[0059] Current technologies often involve manually preparing test data for specific business scenarios and then manually importing the data into a database. However, these technologies require preparing test data separately for different tables, which is labor-intensive, time-consuming, and inflexible.
[0060] To address the shortcomings of existing technologies, this application provides a test data generation method. This method obtains master data based on business data, derives rules for generating new test data based on tag information, processes the master data according to these rules, generates a data file including a data script, runs the data file, and obtains test data, thereby enabling the convenient generation of large quantities of test data.
[0061] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0062] Figure 1 The flow of the test data generation method provided in the embodiments of this application Figure 1 .like Figure 1 As shown in this embodiment, the test data generation method includes:
[0063] S101: Obtain master data based on business data.
[0064] Business data refers to data in existing database tables that can ensure the normal operation of the tested transactions.
[0065] In performance testing, the required test data only needs to ensure that the transaction can be carried out normally and cover the core functionalities and performance overhead points of the transaction. Therefore, in the existing database table, select the business data that can ensure the transaction can be carried out normally during the test, and use the business data as the master data so that the test data generated later can ensure that the transaction is normal.
[0066] Users can modify the master data as needed, but critical parts, especially required fields, cannot be empty. If a transaction requires data from multiple tables, the master data obtained must be specific to the transaction and cannot be just a few unrelated records.
[0067] S102: Set the master data and tag information in the configuration file of the data table to obtain a data file. The tag information is used to indicate the rules for data processing based on the master data to generate new test data. The data file records the data script for generating new test data based on the master data.
[0068] The label information can be preset by the user or set in real time according to user needs. The rule can be, for example, repeating the entire master data or repeating the master data extracted from a preset position. This application does not impose any special restrictions on this.
[0069] The configuration file can be a preset template file, for example. By setting the master data and label information in this configuration file, a data file can be obtained. This data file is a script file, which records the data script that generates new test data based on the master data. For example, the master data and label information can be filled into the corresponding positions in the configuration file to obtain the data file.
[0070] S103: Run the data file to generate test data.
[0071] After obtaining the data file, it is run to generate test data. Those skilled in the art will understand that when running the data file, the master data is processed based on the rules indicated by the master data and label information recorded in the data file to generate test data. For example, the master data may be repeatedly processed to obtain the test data.
[0072] The test data generation method provided in this embodiment obtains master data based on business data; sets the master data and tag information in a configuration file of a data table; then generates a data file based on the configuration file; and runs the data file to obtain test data. Since the configuration file in the data table is set based on the master data and tag information, it not only ensures that the obtained test data guarantees normal transaction processing, but also allows for the regeneration of test data based on the master data using tag information, eliminating the need for manual intervention and reducing the workload of test data generation, thus achieving high efficiency.
[0073] Figure 2 The flow of the test data generation method provided in the embodiments of this application Figure 2 . Figure 3 This is a schematic diagram of the data file shown in this embodiment. Figure 4 This is a schematic diagram of the test data provided in this embodiment. Figure 2 As shown, this embodiment is based on the above. Figure 1 Based on the implementation examples, combined with Figure 3 and 4 The test data generation method is described in detail below. It should be noted that, for ease of understanding by those skilled in the art, all personalized fields in this embodiment are replaced with numbers. The test data generation method shown in this embodiment includes:
[0074] S201: Obtain master data based on business data.
[0075] Step S201 is similar to step S101 above, and will not be repeated here.
[0076] S202: Set the master data and tag information in the configuration file of the data table to obtain a data file. The tag information includes: quantity tag and at least one field tag group. The field tag group includes a data repetition count tag and a data value range tag.
[0077] Each field label group is used to indicate the rules for data processing based on the master data to generate test data corresponding to each field label group.
[0078] The quantity label is used to indicate the size of the test data to be generated. The size of the data for each field can be determined based on the quantity label.
[0079] Each field label group is used to indicate the rules for processing the master data and generating the corresponding test data for that field. This field label group includes multiple field labels, such as data repetition count labels, data initialization labels, and data value range labels.
[0080] The master template data is set in the padding position corresponding to the data initialization tag. It can be understood that when setting the configuration file based on the master template data, the master template data is set in the padding position corresponding to the data initialization tag. The data repetition count and data value range are rules for processing the master template data.
[0081] Combination Figure 3 It can be seen that, Figure 3 The diagram shows two field label groups. The first field label group indicates a repetition count of 10, an initial value of 00001, and a value range of 00001...99999999. The second field label group indicates a repetition count of 10, an initial value of 01, and a value range of 01...999.
[0082] S203: Determine whether the parameterized configuration label in the field label group indicates that the field is a personalized field; if yes, proceed to step S204; if no, proceed to step S205.
[0083] The field label group also includes a parameterized configuration label, which is used to indicate whether a field is a personalized field.
[0084] If the parameterized configuration label indicates that the current field is a non-personalized field (e.g.) Figure 3 If the value shown is no), then the master data will be used as the test data corresponding to the field label group, i.e., S204 will be executed.
[0085] If the parameterized configuration label indicates that the current field is a personalized field (e.g.) Figure 3If the result is yes), then the master data is processed according to each field label group and quantity label to generate test data corresponding to each field label group, i.e., S205 to S207 are executed.
[0086] S204: Use the master data as the test data corresponding to the field label group.
[0087] S205: Based on the data value range labels, determine the value range of the test data corresponding to each field label group, wherein the starting value of the value range is the master data.
[0088] The data value range label is used to indicate the value range of the test data corresponding to each field label group.
[0089] S206: Determine the number of repetitions within the value range based on the data repetition count label.
[0090] The data repetition count label is used to indicate the number of repetitions for each value range in step S205 above.
[0091] After determining the range of test data values, it is also necessary to determine the number of repetitions for each range.
[0092] S207: Generate test data corresponding to each field label group based on the number of repetitions of the value range and the quantity label.
[0093] Since the label information includes at least one field label group, test data corresponding to each field label group can be generated based on the data repetition count label, data value range label, and quantity label of each field label group.
[0094] For example, each data point in the range of test data corresponding to the label group of this field can be repeated a preset number of times. Then, when the amount of test data generated is equal to the number of labels, the test data corresponding to this label group of this field is generated.
[0095] For example, one possible implementation is given here. The repetition frequency of each data unit within the value range is determined based on the repetition frequency of the value range; each data unit within the value range is processed repeatedly based on its repetition frequency until the repetition processing is completed or the amount of test data generated equals the target amount of data indicated by the quantity label, thus obtaining the test data corresponding to each field label group; wherein the amount of data obtained after the repetition processing is completed is less than or equal to the target amount of data.
[0096] In this system, each data point within the value range is treated as a separate data unit. The repetition frequency of each data unit is determined based on the repetition frequency of the value range. Then, for each data unit, the repetition process is repeated according to the corresponding repetition frequency until the repetition process is completed or the amount of test data generated equals the target amount of data indicated by the quantity label, thus obtaining the test data corresponding to the field label group.
[0097] Figure 4 This is a schematic diagram of the test data provided in this embodiment. Figure 4 Two test data examples are given, such as Figure 4 As shown in Figure A, if the quantity label is 45, the value range is 0-9, the number of repetitions within the value range is 10, and the starting value of the value range (i.e., the master data) is 0, then when generating test data corresponding to the field label group, 10 values of 0, 10 values of 1, 10 values of 2, and so on, are generated sequentially until the amount of generated data equals the target data amount of 45 in the quantity label. This yields the test data corresponding to that field label group. It can be seen that the generated test data includes: 10 values of 0, 10 values of 1, 10 values of 2, 10 values of 3, and 5 values of 4, which is exactly equal to the target data amount.
[0098] For example Figure 4 As shown in B, if the quantity label is 65, the value range is 0-4, the number of repetitions of the value range is 10, and the starting value of the value range, i.e., the master data, is 0. When generating test data corresponding to the field label group, first generate 10 data with a value of 0, 10 data with a value of 1, 10 data with a value of 2, and so on, until 10 data with a value of 4 are generated. At this point, it can be known that the values have been used up, and a total of 50 data have been generated, but the amount of data generated (50) has not yet reached the target amount of data (65). Then, start generating 10 data with a value of 0 again from the first value range (0). When the number of generated test data equals the target amount of data, stop generating new data. When stop generating new data, the generated test data includes: 20 data with a value of 0, 15 data with a value of 1, 10 data with a value of 2, 10 data with a value of 3, and 10 data with a value of 4.
[0099] By generating data in the above manner, test data of equal quantity to the target data volume can be generated, thereby meeting the user's need to deal with large batches of test data.
[0100] S208: Obtain the execution function option. If the execution function option is used to indicate importing data, then run the data file to import the test data corresponding to the data file into the database.
[0101] The execution function option indicates whether to import the generated test data into the database.
[0102] Users can select the functions they need to execute according to their own needs. The function options include: saving test data or saving and importing test data. If performance testing is needed at present, users can choose to save and import test data to perform performance testing directly; if performance testing is not needed at present, users can choose to save test data for use when performance testing is needed later.
[0103] After obtaining the data file, you can access the execution function options. When the execution function option indicates to import data, the data file will be run. The generated test data will be saved in a preset location and imported into the database to test the performance of the application software.
[0104] By saving and importing the generated test data into the database when the function option indicates data import, the saved test data can be reused in subsequent tests to improve testing efficiency. At the same time, it also avoids users having to manually perform the import operation through the database client, thus improving the user experience.
[0105] Optionally, if the execution function option indicates to save data, the data file is run, and the generated test data is saved in a preset location for use when the application software performance needs to be tested later.
[0106] Optionally, the generated test data is saved in a first directory, where the data file is placed.
[0107] The test data generation method provided in this embodiment can generate a large amount of test data by customizing the configuration file, flexibly responding to data change requirements in different scenarios. At the same time, by saving and importing the generated test data into the database when executing the function option to import data, the saved test data can be reused in subsequent tests to improve testing efficiency. It also avoids the need for users to manually perform import operations through the database client. Furthermore, before generating test data, users can choose to generate only test data or complete the test data preparation work with one click, improving the flexibility of user operation.
[0108] Figure 5 A schematic diagram of the test data generation device provided in this application. Figure 5 As shown, this application provides a test data generation apparatus 300, which includes:
[0109] Module 301 is used to obtain master data based on business data;
[0110] The processing module 302 is used to set the master data and tag information in the configuration file of the data table to obtain a data file. The tag information is used to indicate the rules for data processing based on the master data to generate new test data. The data file records the data script for generating new test data based on the master data.
[0111] The generation module 303 is used to run the data file and generate test data.
[0112] Optionally, the label information includes: quantity labels and at least one field label group, each field label group being used to indicate the rules for data processing based on the master data to generate test data corresponding to each field label group;
[0113] The generation module 303 is specifically used to process the master data according to each field label group and the quantity label to generate test data corresponding to each field label group; wherein, the data volume of each field in the data file is determined according to the quantity label.
[0114] Optionally, the field label group includes a data repetition count label and a data value range label; the generation module 303 is specifically used to determine the value range of the test data corresponding to each field label group based on the data value range label, wherein the starting value of the value range is the master data; determine the repetition count of the value range based on the data repetition count label; and generate test data corresponding to each field label group based on the repetition count of the value range and the quantity label.
[0115] Optionally, the generation module 303 is specifically used to determine the number of repetitions of each data unit in the value range based on the number of repetitions in the value range; and to perform repetition processing on each data unit in the value range based on the number of repetitions of each data unit until the repetition processing is completed or the amount of test data generated is equal to the target amount of data indicated by the quantity label, thereby obtaining test data corresponding to each field label group; wherein, the amount of data obtained after the repetition processing is completed is less than or equal to the target amount of data.
[0116] Optionally, the field label group further includes: a parameterized configuration label, wherein the parameterized configuration label is used to indicate whether the field is a personalized field; the generation module 303 is further used to use the master data as the test data corresponding to the field label group when the parameterized configuration label indicates that the field is not a personalized field, wherein the data repetition count label and the data value range label are invalid when the parameterized configuration label indicates that the field is a non-personalized field.
[0117] Optionally, the field label group further includes a data initialization label, wherein the master data is set in the fill position corresponding to the data initialization label.
[0118] Optionally, the generation module 303 is specifically used to obtain execution function options. If the execution function options are used to indicate data import, the data file is run to import the test data corresponding to the data file into the database.
[0119] Figure 6 A schematic diagram of the test data generation device provided in this application. Figure 6 As shown, this application provides a test data generation device 400, which includes a receiver 401, a transmitter 402, a processor 403, and a memory 404.
[0120] Receiver 401 is used to receive instructions and data;
[0121] Transmitter 402 is used to send commands and data;
[0122] Memory 404 is used to store instructions executed by the computer;
[0123] The processor 403 is used to execute computer execution instructions stored in the memory 404 to implement the various steps of the test data generation method in the above embodiments. For details, please refer to the relevant descriptions in the foregoing test data generation method embodiments.
[0124] Alternatively, the memory 404 can be either standalone or integrated with the processor 403.
[0125] When the memory 404 is set up independently, the electronic device also includes a bus for connecting the memory 404 and the processor 403.
[0126] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the test data generation method performed by the test data generation device described above.
[0127] This application also provides a program product that includes a computer program, which, when executed by a processor, implements the test data generation method performed by the test data generation device described above.
[0128] It will be understood by those skilled in the art that all or some of the steps, systems, or apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software may be distributed on a computer-readable medium, which may include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0129] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0130] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for generating test data, characterized in that, include: Master data is obtained from business data, and the master data is a record of business data that ensures the normal operation of test transactions. The master data and tag information are set in the configuration file of the data table to obtain a data file. The tag information includes: quantity tags and at least one field tag group. Each field tag group is used to indicate the rules for data processing based on the master data to generate test data corresponding to each field tag group. The data file records a data script for generating new test data based on the master data. The field tag group includes a data repetition count tag and a data value range tag. The data volume of each field in the data file is determined according to the quantity tags. Determine whether the parameterized configuration label in the field label group indicates that the field is a personalized field; If so, the master data will be used as the test data corresponding to the field label group; If not, then determine the value range of the test data corresponding to each field label group based on the data value range label, wherein the starting value of the value range is the master data; Based on the data repetition count label, determine the repetition count of the value range; Based on the number of repetitions within the value range and the quantity label, test data corresponding to each field label group is generated.
2. The method according to claim 1, characterized in that, The step of generating test data corresponding to each field label group based on the number of repetitions within the value range and the quantity label includes: Based on the number of repetitions within the range of values, determine the number of repetitions for each data unit within the range of values; Based on the number of repetitions of each data unit, each data unit in the value range is processed repeatedly until the repetition process is completed or the amount of test data generated is equal to the target amount of data indicated by the quantity label, so as to obtain the test data corresponding to each field label group. Wherein, the amount of data obtained after the repeated processing is less than or equal to the target amount of data.
3. The method according to claim 2, characterized in that, The data repetition count label and data value range label become invalid when the parameterized configuration label indicates that the field is a non-personalized field.
4. The method according to any one of claims 1 to 3, characterized in that, The field label group also includes a data initialization label, and the master data is set in the fill position corresponding to the data initialization label.
5. The method according to claim 1, characterized in that, Also includes: Obtain the execution function option. If the execution function option is used to indicate importing data, then run the data file to import the test data corresponding to the data file into the database.
6. A test data generation device, characterized in that, include: The acquisition module is used to acquire master data based on business data. The master data is a record of business data that can ensure the normal operation of test transactions. The processing module is used to set the master data and tag information in the configuration file of the data table to obtain a data file. The tag information includes: quantity tags and at least one field tag group. Each field tag group is used to indicate the rules for data processing based on the master data to generate new test data. The data file records a data script for generating new test data based on the master data. The field tag group includes a data repetition count tag and a data value range tag. The data volume of each field in the data file is determined according to the quantity tags. The generation module is used to run the data file and generate test data; The generation module is specifically used to determine whether the parameterized configuration label in the field label group indicates that the field is a personalized field. If so, the master data will be used as the test data corresponding to the field label group; If not, then determine the value range of the test data corresponding to each field label group based on the data value range label, wherein the starting value of the value range is the master data; Based on the data repetition count label, determine the repetition count of the value range; Based on the number of repetitions within the value range and the quantity label, test data corresponding to each field label group is generated.
7. A test data generation device, characterized in that, include: Memory; processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the test data generation method as described in any one of claims 1-5.
8. A computer storage medium, characterized in that, The computer storage medium stores computer execution instructions, which, when executed by a processor, are used to implement the test data generation method as described in any one of claims 1-5.
9. A program product comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the test data generation method as described in any one of claims 1-5.
Citation Information
Patent Citations
Test data generation method and device, electronic equipment and storage medium
CN110908891A