Test data generation method and apparatus, electronic device, and medium

By determining the usage status of test environment data and generating rules during software testing, automated test data recovery across environments is achieved, solving the problem of multi-user waiting and improving testing efficiency and environment utilization.

CN113553264BActive Publication Date: 2025-11-04CHINA CITIC BANK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110833584.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-23
Publication Date
2025-11-04
Estimated Expiration
2041-07-23

AI Technical Summary

Technical Problem

In software testing, when multiple testers use the same testing environment simultaneously, it leads to queuing and waiting. Existing technologies consume manpower and time costs by creating new environments to restore test data.

Method used

By determining the usage status of test environment data, generating rules, and generating usable test data in new environments based on these rules, automated data recovery across environments is achieved.

Benefits of technology

It improves the efficiency of cross-environment recovery of test data, reduces user waiting time, and increases the utilization rate of the test environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113553264B_ABST
    Figure CN113553264B_ABST
Patent Text Reader

Abstract

The application provides a test data generation method and device, electronic equipment and medium, which are applied to the technical field of testing. The method comprises the following steps: when first test data in a first test environment is in a use state, second test data in a second test environment is generated based on a generation rule of the first test data and corresponding second test environment information, so that the second test data can be used for testing. Therefore, the test data can be quickly recovered between multiple test environments. In addition, the utilization efficiency of the test environment is improved, and the phenomenon of users queuing for test resources is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of testing, in particular, the present application relates to a test data generation method, device, system, electronic equipment and medium. BACKGROUND

[0002] In the test work of software, in order to be closer to the real use scene, it is usually necessary to pre-embed a large amount of test data in the test environment. In actual test work, it often happens that multiple testers need to use the pre-embedded test data in a test environment at the same time. In this case, multiple users will queue up to wait for the same test environment resource. At present, in order to reduce the queuing time, the commonly used solution is to create a new similar test environment, and restore the required test data in the new test environment. However, the restoration of test data needs to rely on a large amount of bottom data, and the restoration process needs a large amount of manual operation, resulting in a lot of unnecessary repetitive work, consuming a lot of manpower and time cost. SUMMARY

[0003] The present application provides a test data generation method, device, system, electronic equipment and medium, which is used to improve the cross-environment restoration of test data and improve the test efficiency. The technical scheme adopted by the present application is as follows:

[0004] In a first aspect, a test data generation method is provided, comprising:

[0005] determining whether the first test data under the first test environment condition is in a use state, the first test data nesting the first test environment information, so that the first test data can be used under the first test environment condition;

[0006] if the first test data under the first test environment condition is in a use state, obtaining the generation rule for generating the first test data;

[0007] generating the second test data under the second test environment based on the generation rule for generating the first test data and the second test environment information, the second test data nesting the second test environment information, so that the second test data can be used under the second test environment condition.

[0008] Optionally, the second test environment information includes the bottom data of the second test environment, and the method further comprises:

[0009] generating the second test data under the second test environment based on the generation rule for generating the first test data and the bottom data of the second test environment.

[0010] Optionally, the generation rule includes a test environment nesting rule, and the method further comprises:

[0011] The second test data under the second test environment is generated based on a test environment nesting rule in a generation rule for generating the first test data and second test environment information.

[0012] Optionally, the method further comprises:

[0013] receiving a calling request for the first test data under the first test environment condition;

[0014] determining whether the first test data under the first test environment condition is in a use state.

[0015] Optionally, the method further comprises:

[0016] when the first test data under the first test environment condition is in the use state, obtaining a state of each test environment, the state comprising a use state, an empty state;

[0017] determining a second test environment based on the state of each test environment.

[0018] Optionally, the method further comprises: the first test data comprises a plurality of first atomic data, and each of the first atomic data corresponds to a generation rule.

[0019] Optionally, the method further comprises:

[0020] determining each target atomic data under the first test environment that needs to be called for testing;

[0021] if the test data under the first test environment condition is in the use state, obtaining a generation rule for generating each target atomic data under the first test environment;

[0022] generating each target atomic data under the second test environment based on the generation rule for generating each target atomic data and the second test environment.

[0023] Optionally, the method further comprises:

[0024] performing testing based on the generated second test data under the second test environment.

[0025] In a second aspect, a test data generation apparatus is provided, comprising:

[0026] a first determination module, configured to determine whether first test data under a first test environment condition is in a use state, the first test data nesting first test environment information, so that the first test data can be used under the first test environment condition;

[0027] The first obtaining module is configured to obtain a generation rule for generating the first test data if the first test data under the first test environment condition is in a use state.

[0028] The generating module is configured to generate second test data under the second test environment based on the generation rule for generating the first test data and second test environment information, the second test data being nested with the second test environment information, so that the second test data can be used under the second test environment condition.

[0029] Optionally, the second test environment information comprises bottom data of the second test environment, and the generating module is specifically configured to generate the second test data under the second test environment based on the generation rule for generating the first test data and the bottom data of the second test environment.

[0030] Optionally, the generation rule comprises a test environment nesting rule, and the generating module is specifically configured to generate the second test data under the second test environment based on the test environment nesting rule in the generation rule for generating the first test data and the second test environment information.

[0031] Optionally, the apparatus further comprises:

[0032] The receiving module is configured to receive a calling request for the first test data under the first test environment condition.

[0033] The second judging module is configured to judge whether the first test data under the first test environment condition is in a use state.

[0034] Optionally, the apparatus further comprises:

[0035] The second obtaining module is configured to obtain a state of each test environment when the first test data under the first test environment condition is in a use state, the state comprising a use state and an empty state.

[0036] The first determining module is configured to determine a second test environment based on the state of each test environment.

[0037] Optionally, the first test data comprises a plurality of first atomic data, and each of the first atomic data corresponds to a generation rule.

[0038] Optionally, the apparatus further comprises:

[0039] The second determining module is configured to determine each target atomic data under a first test environment that needs to be called.

[0040] The first obtaining module is specifically configured to obtain a generation rule of each target atomic data in the first test environment if the test data in the first test environment is in a use state.

[0041] The generation module is specifically configured to generate each target atomic data in the second test environment based on the generation rule of generating each target atomic data and the second test environment.

[0042] Optionally, the apparatus further comprises:

[0043] The test module is configured to perform a test based on the generated second test data in the second test environment.

[0044] In a third aspect, an electronic device is provided, and the electronic device comprises:

[0045] One or more processors;

[0046] Memory;

[0047] One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the test data generation method shown in the first aspect.

[0048] In a fourth aspect, a computer readable storage medium is provided, and the computer storage medium is used to store computer instructions, when the computer instructions are run on a computer, the computer can execute the test data generation method shown in the first aspect.

[0049] The application provides a test data generation method, device, system, electronic equipment and medium. Compared with the prior art, when first test data in a first test environment is in a use state, other test tasks can only be tested after the first test data is used by a current test task, the application judges whether the first test data in the first test environment is in the use state, the first test data is nested with first test environment information, so that the first test data can be used in the first test environment condition; if the first test data in the first test environment condition is in the use state, a generation rule of the first test data is acquired; the second test data in the second test environment is generated based on the generation rule of the first test data and second test environment information, the second test data is nested with second test environment information, so that the second test data can be used in the second test environment condition. That is, when the first test data in the first test environment is in the use state, the second test data in the second test environment is generated based on the generation rule of the first test data and corresponding second test environment information, so that the test can be performed based on the second test data. Therefore, the test data can be quickly recovered between multiple test environments, and in addition, the utilization efficiency of the test environment is improved, and the phenomenon of queuing for test resources by users is reduced.

[0050] Additional aspects and advantages of the application will be made apparent by the following description and the appended claims. BRIEF DESCRIPTION OF DRAWINGS

[0051] The above and / or additional aspects and advantages of the application will become apparent and be readily understood by considering the following detailed description, including the accompanying drawings, in which:

[0052] Figure 1 A flowchart of a test data generation method according to an embodiment of the application;

[0053] Figure 2 A structural diagram of a test data generation device according to an embodiment of the application;

[0054] Figure 3 A test data recovery example diagram according to an embodiment of the application;

[0055] Figure 4 A structural diagram of an electronic equipment according to an embodiment of the application. DETAILED DESCRIPTION

[0056] Embodiments of the present application are described below in detail, examples of which are shown in the accompanying drawings, wherein the same or similar notations represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as a limitation on the present application.

[0057] Those skilled in the art can understand that, unless specifically stated, the singular forms "a", "an" and "the" used herein also include the plural forms. It should be further understood that the use of the phrase "comprise" in the specification of the present application means that the features, integers, steps, operations, elements and / or components exist, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. The phrase "and / or" used herein includes all or any one of the associated listed items and all combinations thereof.

[0058] In order to make the purposes, technical solutions and advantages of the present application clearer, the embodiments of the present application will be described in further detail below with reference to the accompanying drawings.

[0059] The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail below with specific examples. The following specific examples can be combined with each other, and the same or similar concepts or processes can not be described again in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.

[0060] Embodiment one

[0061] The embodiments of the present application provide a test data generation method, as shown in Figure 1 The method comprises the following steps:

[0062] Step S101, it is judged whether the first test data under the first test environment condition is in use state or not, the first test data is nested with the first test environment information, so that the first test data can be used under the first test environment condition; wherein the test data can only be used under the corresponding test environment condition, and cannot be used under other test environment; for example, the first test data can only be used under the corresponding first test environment, and cannot be used under the second test environment; wherein the test data can include two parts of test data information (i.e. the data used for testing and irrelevant to the test environment) and test environment information (i.e. the test data information can be used under the corresponding test environment information of the test environment).

[0063] Step S102, if the first test data under the first test environment condition is in use state, the generation rule of the first test data is acquired;

[0064] Specifically, the test data corresponds to a test data generation rule, and the corresponding test data can be generated based on the test data generation rule.

[0065] In step S103, the second test data in the second test environment is generated based on the generation rule of the first test data and the second test environment information, and the second test data is nested with the second test environment information, so that the second test data can be used in the second test environment.

[0066] When migrating test data between multiple test environments, the test data Da in the test environment A is directly copied to the test environment B to obtain the test data Da', which may not be available in B. Because the test data needs to be compatible with the test environment, the direct copying method does not consider the differences between the environments, and a large amount of manual operation is required to complete the test data adaptation in the new environment, which leads to an increase in the workload of cross-environment test data recovery. To solve the problem encountered in actual work, the data items of the test data are refined and extracted in the test preparation work, and a data generation rule library is constructed. When cross-environment test data recovery needs to be performed, the rule library is imported into the test data recovery engine, and the target environment of data recovery is specified for the data recovery engine, so that the test data recovery can be automatically performed, and the test data adapted to the target environment can be generated.

[0067] Specifically, the second test data in the second test environment is generated based on the generation rule of the first test data and the second test environment information, so that the second test data in the second test environment is obtained, and the test can be performed based on the second test data, without waiting for the first test data to be used up before performing the test, thereby improving the efficiency of the test and the utilization rate of the test environment.

[0068] The test environment information can include hardware environment and software environment, the hardware environment mainly includes PC, and the software environment includes operating system (main operating systems: windows, Linux, Unix), database (Oracle, MySQL, SqlServer, DB2, etc.), web application server (Apache, IIS, tomcat, Nginx, etc.) and cluster environment (such as load balancing).

[0069] The application provides a test data generation method. Compared with the prior art, when first test data under a first test environment is in a use state, other test tasks can only be tested after the first test data is used by a current test task, the application judges whether the first test data under the first test environment is in the use state, the first test data is nested with first test environment information, so that the first test data can be used under the first test environment condition; if the first test data under the first test environment condition is in the use state, a generation rule of the first test data is obtained; second test data under a second test environment is generated based on the generation rule of the first test data and second test environment information, the second test data is nested with second test environment information, so that the second test data can be used under the second test environment condition. That is, when the first test data under the first test environment is in the use state, the second test data under the second test environment is generated based on the generation rule of the first test data and corresponding second test environment information, so that the test can be performed based on the second test data. Therefore, the test data can be quickly recovered between multiple test environments, and in addition, the utilization efficiency of the test environment is improved, and the phenomenon of queuing for test resources by users is reduced.

[0070] Optionally, the second test environment information includes base data of the second test environment, and the method further includes: generating the second test data under the second test environment based on the generation rule of the first test data and the base data of the second test environment.

[0071] The base data is a large amount of data stored in a database before performance testing, in addition to business logic data, which has no actual influence on business logic, but can be used to test the performance of the system under different data levels.

[0072] Specifically, the test data includes two parts, test data information (for example, user name data, certificate number data, transaction serial number data) and test environment information. The data generation rule can be a test data information generation rule or a test environment information nesting rule. For the application embodiment, the data generation rule can be a test data information generation rule, so that the second test data can be generated based on the test data information generation rule corresponding to the first test data and the base data under the second test environment, wherein the base data under the second test environment contains corresponding test environment information, so that the generated second test data contains the second test environment information, and thus can be used under the second test condition.

[0073] Optionally, the generation rule includes a test environment nesting rule, and the method further includes:

[0074] The second test data under the second test environment is generated based on a test environment nesting rule in a generation rule of the first test data and second test environment information.

[0075] Specifically, for the embodiment of the application, the generation rule includes the test environment nesting rule and the test data information generation rule, which can generate the second test data according to the test data information generation rule and the test environment nesting rule and the second test environment information, so that the second test data that can be used under the second test environment condition can be generated without a large amount of underlying data.

[0076] Optionally, the method further includes:

[0077] receiving a calling request for the first test data under the first test environment condition;

[0078] determining whether the first test data under the first test environment condition is in a use state.

[0079] Optionally, the method further includes:

[0080] when the first test data under the first test environment condition is in the use state, obtaining a state of each test environment, the state including a use state, an idle state;

[0081] determining a second test environment based on the state of each test environment.

[0082] For the embodiment of the application, the test environment in the idle state is determined as the second test environment, so that the test environment is fully utilized.

[0083] Optionally, the method further includes that the first test data includes a plurality of first atomic data, and each of the first atomic data corresponds to a generation rule.

[0084] Specifically, the test data can include a plurality of atomic data, and each atomic data corresponds to a generation rule, i.e., an atomic data generation rule, which is similar to the aforementioned test data generation rule, wherein the atomic data can include atomic data information and atomic data environment information.

[0085] Exemplarily, as Figure 3As shown, the corresponding data recovery template can be determined according to the generation rule of each atomic data of the test data, and when the data is recovered, the corresponding data template can be directly called to recover the data. Specifically, the data production engine can use the bottom data of the corresponding test environment to recover the test data under the corresponding test environment. The method of the present application atomically manages the test data according to the minimum data item unit, and stores the generation rules of these data items in the test data generation stage. Assuming that there is test data TDx, x1, x2, x3, …, xn are obtained by decomposing TDx, and corresponding atomic data generation rules r1, r2, r3, …, rn are obtained. TDx is initially generated on the test environment Env1, and the atomic data generation rules (r1, r2, r3, …, rn) defined in the TDx generation stage are recorded in the data generation rule set Rx. When the environment Env1 is occupied by the user a, the user b needs to use the data items x1, x3, xx … in Env1 to perform an emergency test task. The user b can be allocated an idle test environment Env2, and the corresponding data generation rules r1, r3, rx … are selected to form a data recovery template Tr, and Tr is imported into the data production engine to perform data recovery on the Env2 environment.

[0086] This rule combination method reduces the coupling degree between the data generation rule and the business system, and the data items of the record data generation rule can be reused by combining different data rule atoms. When the data generation rule changes, the overall data generation rule can be changed by only maintaining the data items, and the maintainability and scalability of the system are also improved.

[0087] Among them, the automated test data recovery engine reproduces the test data on the new environment according to the above-mentioned atomized test data generation rule library and the bottom data of the new environment, thereby realizing the multi-environment recovery of the test data. The test data recovery engine is associated with the transaction interface required in the test data production, and based on the agreed semantic expression in the above-mentioned rule library, the data recovery process does not require manual intervention and can be automatically executed throughout the process. In the rule library, the data generation rule is distributed in an atomized form, which is the basic unit of data management. In the data recovery engine, the atomized data items need to be arranged and combined into a data recovery template. The test data recovery engine is directly oriented to the demand, that is, which data needs to be recovered. For example, in the above example, the data to be recovered is x1, x3, xx …, and only the corresponding rules r1, r3, rx … need to be selected from the rule library to form a data recovery template Tr. The data recovery engine will identify the transactions and bottom data required for data recovery according to Tr, and perform data recovery on the target environment to realize the recovery of test data among multiple environments.

[0088] Optionally, the method further comprises:

[0089] determining each target atomic data in a first test environment which needs to be invoked by a test;

[0090] if the test data in the first test environment condition is in use, obtaining a generation rule for generating each target atomic data in the first test environment;

[0091] generating each target atomic data in the second test environment based on the generation rule for generating each target atomic data and the second test environment.

[0092] Specifically, in actual use, the test data information of the corresponding part of the atomic data in the first test environment may be used, and only the generation rule of the corresponding atomic data to be used is used to generate the target atomic data in the second test environment, so as to realize the flexibility of data recovery, and all atomic data in the first test environment does not need to be recovered.

[0093] In the embodiment of the application, in the test preparation work, the data items of the test data are refined and extracted, the data generation rule is stored in an atomic manner, an atomic data generation rule library is constructed, and cross-environment recovery of atomic data is realized.

[0094] Optionally, the method further comprises:

[0095] performing a test based on the generated second test data in the second test environment.

[0096] Embodiment two

[0097] The embodiment of the application provides another test data generation device, as shown in Figure 2 comprises;

[0098] The first judgment module 201 is configured to judge whether the first test data in the first test environment condition is in use, and the first test data is nested with first test environment information, so that the first test data can be used in the first test environment condition.

[0099] The first acquisition module 202 is configured to obtain a generation rule for generating the first test data if the first test data in the first test environment condition is in use.

[0100] The generation module 203 is configured to generate second test data in the second test environment based on the generation rule for generating the first test data and second test environment information, and the second test data is nested with second test environment information, so that the second test data can be used in the second test environment condition.

[0101] Optionally, the second test environment information comprises bottom data of the second test environment, and the generating module is specifically configured to generate the second test data under the second test environment based on the generation rule of generating the first test data and the bottom data of the second test environment.

[0102] Optionally, the generation rule comprises a test environment nesting rule, and the generating module is specifically configured to generate the second test data under the second test environment based on the test environment nesting rule in the generation rule of generating the first test data and the second test environment information.

[0103] Optionally, the apparatus further comprises:

[0104] a receiving module configured to receive a calling request for the first test data under the first test environment condition;

[0105] a second judging module configured to judge whether the first test data under the first test environment condition is in a use state.

[0106] Optionally, the apparatus further comprises:

[0107] a second obtaining module configured to obtain states of each test environment when the first test data under the first test environment condition is in the use state, the states comprising the use state and an empty state;

[0108] a first determining module configured to determine a second test environment based on the states of each test environment.

[0109] Optionally, the first test data comprises a plurality of first atomic data, and each of the first atomic data corresponds to a generation rule.

[0110] Optionally, the apparatus further comprises:

[0111] a second determining module configured to determine each target atomic data under the first test environment which needs to be called;

[0112] the first obtaining module is specifically configured to, if the test data under the first test environment condition is in the use state, obtain the generation rule of generating each target atomic data under the first test environment;

[0113] the generating module is specifically configured to generate each target atomic data under the second test environment based on the generation rule of generating each target atomic data and the second test environment.

[0114] Optionally, the apparatus further comprises:

[0115] a testing module configured to perform testing based on the generated second test data under the second test environment.

[0116] The embodiment of the present application provides a test data generation device. Compared with the prior art, when the first test data under the first test environment is in a use state, other test tasks can only be tested after the current test task uses the first test data and ends, the first test data under the first test environment is judged to be in the use state, the first test data is nested with first test environment information, so that the first test data can be used under the first test environment condition; if the first test data under the first test environment condition is in the use state, a generation rule of the first test data is acquired; the second test data under the second test environment is generated based on the generation rule of the first test data and second test environment information, the second test data is nested with second test environment information, so that the second test data can be used under the second test environment condition. That is, when the first test data under the first test environment is in the use state, the second test data under the second test environment is generated based on the generation rule of the first test data and the corresponding second test environment information, so that the test can be performed based on the second test data. Therefore, the test data can be quickly recovered between multiple test environments, and in addition, the utilization efficiency of the test environment is improved, and the phenomenon of user queuing for test resources is reduced.

[0117] Embodiment three

[0118] The embodiment of the present application provides an electronic device, such as Figure 4 As shown in the figure, Figure 4 The electronic device 40 shown in the figure includes a processor 401 and a memory 403. Wherein, the processor 401 and the memory 403 are connected, such as through the bus 402. Further, the electronic device 40 can also include a transceiver 404. It should be noted that in actual application, the transceiver 404 is not limited to one, and the structure of the electronic device 40 does not constitute a limitation to the embodiment of the present application. Wherein, the processor 401 is applied to the embodiment of the present application, and is used to realize the functions of the modules shown in the figure. Figure 2 The transceiver 404 includes a receiver and a transmitter.

[0119] The processor 401 can be a CPU, a general processor, a DSP, an ASIC, an FPGA or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can realize or execute various exemplary logical blocks, modules and circuits described in combination with the disclosure. The processor 401 can also be a combination of computing functions, such as one or more microprocessor combinations, combinations of DSP and microprocessor, etc.

[0120] The bus 402 can include a path that carries information between the aforementioned components. The bus 402 can be a PCI bus or an EISA bus, etc. The bus 402 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the figure to represent the bus, but it does not mean that there is only one bus or only one type of bus.

[0121] The memory 403 can be a ROM or other type of static storage device that can store static information and instructions, a RAM or other type of dynamic storage device that can store information and instructions, an EEPROM, a CD-ROM or other optical disk storage, an optical disk storage (including a compact disk, a laser disk, an optical disk, a digital versatile disk, a Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but not limited to this.

[0122] The memory 403 is used to store application program code for implementing the scheme of the present application, and is controlled by the processor 401 to execute. The processor 401 is used to execute the application program code stored in the memory 403 to realize Figure 2 The device provided by the embodiment shown in the figure realizes the function of the device.

[0123] The embodiment of the present application provides an electronic device suitable for the above-mentioned method embodiment, and the specific implementation manner and technical effects will not be repeated here.

[0124] Embodiment Four

[0125] The embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores a computer program. The program is executed by a processor to realize the test data generation method shown in the above-mentioned embodiment.

[0126] The embodiment of the present application provides a computer readable storage medium suitable for the above-mentioned method embodiment, and the specific implementation manner and technical effects will not be repeated here.

[0127] It should be understood that although each step in the flowchart of the accompanying drawings is shown in sequence according to the direction of the arrow, these steps are not necessarily executed in sequence according to the direction of the arrow. Unless otherwise stated herein, the execution of these steps is not strictly limited in sequence, and they can be executed in other sequences. Moreover, at least part of the steps in the flowchart of the accompanying drawings can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or sub-steps or stages of other steps.

[0128] The above merely preferred embodiments of the present application and it should be noted that for those of ordinary skill in the art, without departing from the principles of the present application, can make a number of improvements and refinements, these improvements and refinements should also be considered as the scope of protection of the present application.

Claims

1. A test data generation method, characterized by, include: Determine whether the first test data under the first test environment condition is in use. The first test data is nested with the first test environment information so that the first test data can be used under the first test environment condition. If the first test data under the first test environment condition is in use, obtain the generation rule for generating the first test data; the generation rule includes test environment nesting rules and test data information generation rules. Based on the generation rules for generating the first test data and the second test environment information, second test data is generated under the second test environment. The second test data is nested with the second test environment information so that the second test data can be used under the second test environment conditions. The first test data includes multiple first atomic data, and each first atomic data corresponds to a first atomic data generation rule. Specifically, according to the first atomic data generation rule, the data production engine is used to atomically manage the first test data according to the first atomic data, and the first atomic data generation rule is sliced ​​and stored in the second test data generation stage. When the first test data under the first test environment condition is in use, the status of each test environment is obtained, including the use status and the idle status. The second test environment is determined based on the status of each test environment. The second test environment information includes the foundation data of the second test environment, and the method further includes: Based on the generation rules for generating the first test data and the underlying data of the second test environment, the second test data in the second test environment is generated.

2. The method according to claim 1, characterized in that, The method also includes: The second test data under the second test environment is generated based on the test environment nesting rules in the generation rules for generating the first test data and the second test environment information.

3. The method according to claim 1, characterized in that, The method also includes: Receive a request to access the first test data under the first test environment conditions; Determine whether the first test data under the first test environment condition is in use.

4. The method according to claim 1, characterized in that, The method also includes: Determine the target atom data that needs to be called in the first test environment; If the test data under the first test environment condition is in use, obtain the generation rules for generating the target atom data under the first test environment; Based on the generation rules for generating each target atom data and the second test environment, the target atom data under the second test environment is generated.

5. The method according to any one of claims 1-4, characterized in that, The method also includes: The test is performed based on the second test data generated in the second test environment.

6. A test data usage device, characterized in that, include: The first judgment module is used to determine whether the first test data under the first test environment condition is in use. The first test data is nested with the first test environment information so that the first test data can be used under the first test environment condition. The first acquisition module is used to acquire the generation rules for generating the first test data if the first test data under the first test environment condition is in use; the generation rules include test environment nesting rules and test data information generation rules. The generation module is used to generate second test data under the second test environment based on the generation rules for generating the first test data and the second test environment information. The second test data is nested with the second test environment information so that the second test data can be used under the second test environment conditions. The device also includes the second test environment information, which includes the base data of the second test environment; The generation module is further configured to generate second test data in the second test environment based on the generation rules for generating the first test data and the underlying data of the second test environment; the device further includes: the first test data includes multiple first atomic data, each of the first atomic data corresponds to a first atomic data generation rule, specifically, the first test data is atomically managed according to the first atomic data using a data production engine according to the first atomic data, and the first atomic data generation rule is sliced ​​and stored in the second test data generation stage; The device further includes: when the first test data under the first test environment condition is in use, acquiring the status of each test environment, the status including a use state and an idle state; and determining a second test environment based on the status of each test environment.

7. An electronic device, characterized in that, include: One or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications being configured to: perform the test data generation method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store computer instructions that, when executed on a computer, cause the computer to perform the test data generation method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Test data generation method and device

    CN110399309A