A method, apparatus, medium and device for generating test data

By constructing a tree-like structure feature model, using business demand information to generate test data, the data dependence problem in the test forward phase is solved and the testing efficiency is improved.

CN114416574BActive Publication Date: 2025-07-25AGRICULTURAL BANK OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210073104.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-21
Publication Date
2025-07-25
Estimated Expiration
2042-01-21

AI Technical Summary

Technical Problem

During the test forward phase, in the face of the lack of development code and original data for the project to be delivered, the existing technology cannot generate high coverage test data, resulting in inefficiency of testers.

Method used

By obtaining business requirements information, building a tree-like structure feature model, generating test data, and reducing dependence on code and original data.

Benefits of technology

Improve the work efficiency of testers and generate complete and logical test data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114416574B_ABST
    Figure CN114416574B_ABST
Patent Text Reader

Abstract

An embodiment of the present application discloses a method, device, medium, and equipment for generating test data. Among them, the method includes: obtaining business requirement information of a project to be delivered; constructing a tree-structured feature model of the project to be delivered according to the business requirement information; and determining test data of the project to be delivered according to the tree-structured feature model. With this technical solution, a tree-structured feature model can be constructed through business requirement information to generate complete and logical test data, thereby reducing the dependence of test data on code and original data and greatly improving the work efficiency of testers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the field of software technology, and in particular, to a method, apparatus, medium, and device for generating test data. Background Art

[0002] Currently, common methods for generating test data can be roughly divided into two categories. One category is designed for the program code itself, that is, by analyzing the code logic or class, obtaining the corresponding path, and designing test data that covers this path. This type of strategy is only effective for white-box testing. The other category is by repeatedly learning the original data, obtaining the main attributes of the test data, and generating a large amount of test data by setting parameters. This type of method highly depends on the original data.

[0003] However, in the pre-test stage, when facing a project to be delivered, there is no complete development code as a basis, nor original data as a reference. Testers cannot obtain a set of effective test data. Even if the test data estimated by the testers cannot guarantee a high level of test coverage. Summary of the Invention

[0004] Embodiments of the present application provide a method, apparatus, medium, and device for generating test data, which can construct a tree-structured feature model through business requirement information, generate complete and logical test data, thereby reducing the dependence of test data on code and original data, and greatly improving the work efficiency of testers.

[0005] In a first aspect, embodiments of the present application provide a method for generating test data, the method comprising:

[0006] Obtaining business requirement information of a project to be delivered;

[0007] Constructing a tree-structured feature model of the project to be delivered according to the business requirement information;

[0008] Determining test data of the project to be delivered according to the tree-structured feature model.

[0009] In a second aspect, embodiments of the present application provide a device for generating test data, the device comprising:

[0010] A business requirement information acquisition module, configured to obtain business requirement information of a project to be delivered;

[0011] A tree-structured feature model construction module, configured to construct a tree-structured feature model of the project to be delivered according to the business requirement information;

[0012] A test data generation module, configured to determine test data of the project to be delivered according to the tree-structured feature model.

[0013] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the method for generating test data as described in the embodiment of the present application.

[0014] In a fourth aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the method for generating test data as described in the embodiment of the present application.

[0015] The technical solution provided by the embodiment of the present application can construct a tree-structured feature model through service requirement information, generate complete and logical test data, thereby reducing the dependence of test data on code and original data, and greatly improving the work efficiency of testers. Description of the Drawings

[0016] Figure 1A is a flowchart of the method for generating test data provided in Embodiment 1 of the present application;

[0017] Figure 1B is a schematic diagram of the tree-structured feature model provided by the embodiment of the present application;

[0018] Figure 2 is a flowchart of the method for generating test data provided in Embodiment 2 of the present application;

[0019] Figure 3 is a schematic diagram of the structure of a test data generation device provided in Embodiment 3 of the present invention;

[0020] Figure 4 is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present application. Detailed Embodiments

[0021] The present application will be further described in detail below with reference to the drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the present application, rather than limiting the present application. Additionally, it should be noted that for the sake of description, only parts related to the present application are shown in the drawings rather than all structures.

[0022] Before discussing the exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts depict the steps as sequential processes, many of the steps can be implemented in parallel, concurrently, or simultaneously. In addition, the order of the steps can be rearranged. The process can be terminated when its operations are completed, but it can also have additional steps not included in the figures. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0023] Embodiment 1

[0024] Figure 1A It is a flowchart of a method for generating test data provided in Embodiment 1 of the present application. This embodiment is applicable to any scenario for generating test data, especially applicable to the scenario of generating test data before project development. This method can be executed by a device for generating test data provided in the embodiments of the present application. The device can be implemented in software and / or hardware and can be integrated into an electronic device.

[0025] As Figure 1A shown, the method for generating test data includes:

[0026] S110, obtain the business requirement information of the project to be delivered.

[0027] This solution can be executed by an electronic device such as a computer. After the project is established, the electronic device can obtain the business requirement information of the project to be delivered from the business system. The business requirement information can be a system business requirement specification formed by business personnel after collecting customer requirements. Developers can complete the software development of a specified project based on the business requirement specification. In the test shift-ahead stage, testers can generate test data based on the business requirement specification. Therefore, testers do not need to wait for developers to complete the software development task and can manufacture test data in advance to complete the test tasks at each stage in a timely manner and accelerate the project delivery process.

[0028] The business requirement information can include contents such as project objectives, overall business processes, functional requirements, and performance requirements. The functional requirements can include contents such as input requirements, output requirements, and business rules. The performance requirements can include contents such as the number of users, data scale, and response time.

[0029] S120, construct a tree-structured feature model of the project to be delivered according to the business requirement information.

[0030] Among them, the features can be used to describe the main functions of the system, and the feature model can be composed of a set of features and the relationships between the features. According to the overall business process, the functional requirements and performance requirements of each process node, and other business requirement information, the electronic device can construct the to-be-delivered project into an overall tree-structured feature model. The electronic device can also divide the to-be-delivered project into each sub-project and construct a respective tree-structured feature model for each sub-project.

[0031] It can be understood that the tree-structured feature model can include at least two levels of features. The tree structure can be an unordered tree, an ordered tree, or a binary tree. For example, the tree-structured feature model can be a binary tree structure feature model with the project goal as the root feature unit, the functional requirement as the left subtree feature, and the performance requirement as the right subtree feature.

[0032] In this solution, optionally, constructing the tree-structured feature model of the to-be-delivered project according to the business requirement information includes:

[0033] Determining at least two levels of features of the to-be-delivered project according to the business requirement information; wherein, each level of features includes at least one feature unit;

[0034] Constructing the tree-structured feature model of the to-be-delivered project according to the at least two levels of features.

[0035] Figure 1B It is a schematic diagram of the tree-structured feature model provided by an embodiment of the present application. Taking a specific example, assume that a financial product needs to be developed. The tree-structured feature model of the to-be-delivered project constructed by the electronic device can be as Figure 1B shown. Figure 1B The shown tree-structured feature model has 4 levels of features, and each level of features includes at least one feature unit. Among them, the first-level feature of the tree-structured feature model, which can also be called the root feature unit, can be the project goal, that is, the financial product. For a financial product, the fundraising period, the closed period, and the maturity date, etc. can all be used as the next-level features of the root feature unit. Among them, the fundraising period, the closed period, and the maturity date, etc. can be called the feature units in the second-level features. Continuing to analyze the sub-feature units of each feature unit in the second-level features, subsequent levels of features can be extended until the feature unit cannot be divided into sub-feature units, and the construction of the tree-structured feature model of the to-be-delivered project is completed.

[0036] This solution can describe the business requirement information as a tree-structured feature model with hierarchical characteristics, which is beneficial to quickly generating test data that meets the customer's requirements.

[0037] S130. Determining the test data of the to-be-delivered project according to the tree-structured feature model.

[0038] The test data can be a series of input values designed to test a certain function of the software. The electronic device can traverse the feature units of the constructed tree-structured feature model in a preset traversal manner to obtain one or more linear sequences. Then, the electronic device can generate test data for the project to be delivered based on the linear sequences. When there are multiple linear sequences, there may be a logical relationship between the linear sequences, and the electronic device can take this logical relationship into account during the process of generating test data to obtain high-quality test data.

[0039] The technical solution provided by the embodiments of the present application can construct a tree-structured feature model through business requirement information, generate complete and logical test data, thereby reducing the dependence of test data on code and original data, and greatly improving the work efficiency of testers.

[0040] Embodiment 2

[0041] Figure 2 It is a flowchart of the method for generating test data provided by Embodiment 2 of the present application. This embodiment is optimized based on the above embodiment.

[0042] As Figure 2 shown, the method of this embodiment specifically includes the following steps:

[0043] S210, obtain the business requirement information of the project to be delivered.

[0044] S220, according to the business requirement information, determine at least two levels of features of the project to be delivered; wherein, each level of features includes at least one feature unit.

[0045] S230, determine the refinement relationship between the feature units at each level, and the constraint relationship between each feature unit.

[0046] Among them, the refinement starts from the root feature unit and organizes feature units with different granularities into a tree structure. For a complete tree-structured feature model, assuming it has a total of n levels of features, the root feature unit can be the first-level feature. Correspondingly, the sub-feature unit of the root feature unit is the second-level feature, and so on until the sub-feature unit cannot be refined again, that is, the nth-level feature.

[0047] When refining a parent feature unit, if the child feature unit is a mandatory feature, that is, without this child feature unit, the function of the parent feature unit is incomplete, then this child feature unit must be retained; if the child feature unit is an optional feature, that is, in the absence of this child feature unit, its function can be replaced by other mandatory child feature units, then this child feature unit can be retained or not retained. It can be understood that the child feature unit can be a part of the parent feature unit and can be the partial function of the function corresponding to the parent feature unit that obtains the same feedback or the same nature feedback under partial inputs.

[0048] The constraint relationship can be used to describe the dependency relationship between different feature units and is a rule that must be followed when determining feature units. Its purpose is to ensure the legality of feature model construction. The constraint relationship can include a first relationship, a second relationship, a third relationship, and a fourth relationship. Among them, the first relationship can be the relationship where two feature units exist simultaneously. The second relationship can be the relationship where two feature units do not exist simultaneously. The third relationship can be the relationship where at least one of at least two feature units is retained. The fourth relationship is the relationship where at least one of at least two feature units is retained.

[0049] S240. Construct a tree-structured feature model of the to-be-delivered project according to the refinement relationship and the constraint relationship.

[0050] In a specific example, after determining the root feature unit, the feature set can be expressed as represents the first feature unit at the first level. The steps to construct the tree-structured feature model of the to-be-delivered project can be as follows:

[0051] The first step: According to the business relationship information in the business requirement information, find the functional elements that have a direct business relationship with the root feature unit, ensure that the constraint relationship between each child feature unit at the same level is a mutually exclusive relationship, and determine the second-level features to expand the feature set. At this time, the feature set can be expressed as where 1 ≤ i ≤ k, k ≥ 1, f i 2 represents the i-th feature unit at the second level;

[0052] The second step: Repeat the first step until the feature unit cannot be further refined. At this time, the feature set can be denoted as where 0 ≤ m ≤ n, m ≥ 1;

[0053] Step 3: For the n-th level feature unit, determine its corresponding constraint relationship according to the service requirement information, determine the (n + 1)-th level feature unit, and establish a set of constraint relationships. Assume that there are p feature units in the (n + 1)-th level. Since each feature unit in the n-th level corresponds to at least one constraint relationship, p ≥ n. For all the first relationships, it can be denoted as 2 ≤ j ≤ p, where r j (n,i) indicates that the j-th feature unit has a first relationship with the i-th feature unit in the n-th level. Similarly, the third relationship set can be denoted as where, for a determined feature unit, indicates that starting from the (j + 1)-th feature unit, a total of m feature units have a third relationship with the i-th feature unit in the n-th level. Similarly, the fourth relationship of the feature unit can be represented by the set O = {O1, O2, …, O k}}. Specifically, the set O can be represented as: where, for a determined feature i, indicates that starting from the (j + 1)-th feature unit, a total of m feature units have a fourth relationship with the i-th feature unit in the n-th level. So far, the preliminary construction of the tree-structured feature model is completed. It should be noted that the sub-feature units will inherit the second relationship between the parent feature units.

[0054] S250, use the feature units in the tree-structured feature model that do not have lower-level feature units as the test data entry; and, use the feature units in the tree-structured feature model that do not have upper-level feature units as the test data exit.

[0055] Based on the tree-structured feature model established in S240, the electronic device can search the tree-structured feature model to determine the feature units that do not have lower-level feature units. Such feature units do not have lower-level feature units, so there is no data transfer from lower-level feature units to them, and they can be used as the test data entry. The electronic device can use the feature units that do not have upper-level feature units as the test data exit. Such feature units cannot transfer data upward, so they can be used as the test data exit.

[0056] It should be noted that the above test data entry and test data exit can be formulated for generating a complete data path and may not be used as the actual test data entry and actual data exit. The actual test data entry and / or exit can be determined by traversing each feature unit on the data path to judge whether the feature unit requires data input and / or output.

[0057] S260. Generate the data paths from each test data entry to each test data exit according to the refinement relationship and the constraint relationship.

[0058] For the feature set obtained in the second step of S240 and each test data entry and each test data exit determined in S250, based on the constraint relationship and the refinement relationship, sort out different data paths. For the set R, each element in the set corresponds to a data path; for the set X, each sub-element in the set corresponds to a data path, but only one sub-element can be selected each time; for the set O, each element in the set selects at least one sub-element to correspond to a data path. That is, the data path set Where

[0059] S270. Generate the test data for the project to be delivered according to the data paths.

[0060] For each data path in the data path set obtained in S260, the electronic device can detect whether each feature unit in the data path needs to input and / or output data, the input and / or output data type, and the input and / or output data range and other information. The electronic device can design corresponding test data according to the above information.

[0061] In a preferred solution, the generating the test data for the project to be delivered according to the data paths includes:

[0062] Generate a test data selection range that satisfies the refinement relationship and the constraint relationship according to the data qualification sets of each feature unit in the data path;

[0063] Generate the test data for the project to be delivered within the test data selection range.

[0064] It is easy to understand that, according to the attribute information of each feature unit, the electronic device can obtain the data definition set of each feature unit. For example, if the feature unit A requires input of character-type data, the electronic device can define the input data definition set of the feature unit A as {a, b, …}. Suppose the feature unit B needs to output enumerated-type data, and the electronic device can define the input data definition set of the feature unit B as {1, 0}. Suppose the feature unit C needs to input digital-type data within the range of 500 - 1000, and the electronic device can define the input data definition interval of the feature unit C as [500, 1000]. At the same time, according to the refinement relationship and constraint relationship between feature units, the electronic device can further determine the test data selection range based on the data definition set of the feature units. Suppose the feature unit D is a subordinate feature unit of the feature unit C, and the relationship between the feature unit C and the feature unit D is a mandatory relationship. According to the attribute information of the feature unit D, its input data definition interval is [600, 2000]. According to the refinement relationship, the data selection range of the feature unit D can be [600, 1000], that is, the intersection of the input data definition intervals of the feature unit C and the feature unit D. Suppose the feature unit E and the feature unit C are feature units at the same level, and the two have a second relationship. From the attribute information of the feature unit E, the input data definition interval of the feature unit E is [400, 1500]. According to the constraint relationship, the electronic device can determine the data selection range of the feature unit E as [400, 500) ∪ (1000, 1500], that is, the complement of the input data definition interval of the feature unit E in the input data definition interval of the feature unit C.

[0065] The electronic device can randomly select one or more data from the obtained data selection range as the input and / or output data of the feature unit, and then generate the test data for the entire project to be delivered.

[0066] This solution generates the test data selection range that satisfies the refinement relationship and constraint relationship according to the data definition set of each feature unit, can generate complete and logical test data, and greatly improves the work efficiency of testers.

[0067] In this solution, optionally, constructing a tree-structured feature model of the project to be delivered according to the refinement relationship includes:

[0068] If the refinement relationship is a mandatory relationship, then in the tree-structured feature model, connect the mandatory subordinate feature units of the current superior feature unit through a mandatory relationship structure line;

[0069] If the refinement relationship is an optional relationship, then in the tree-structured feature model, connect the optional subordinate feature units of the current superior feature unit through an optional relationship structure line.

[0070] Specifically, constructing a tree - structured feature model of the project to be delivered according to the constraint relationship includes:

[0071] If the constraint relationship between two feature units is the first relationship, then in the tree - structured feature model, connect the two feature units through a necessary relationship structure line; where the two feature units are feature units at the same level; the first relationship is a relationship where the two feature units exist simultaneously.

[0072] If the constraint relationship between two feature units is the second relationship, then in the tree - structured feature model, connect the two feature units through a mutually exclusive relationship structure line; where the two feature units are feature units at the same level; the second relationship is a relationship where the two feature units do not exist simultaneously.

[0073] If the constraint relationship between at least two feature units is the third relationship, then in the tree - structured feature model, connect from the superior feature unit to the at least two feature units through a third - relationship structure line; where the at least two feature units are feature units at the same level; the third relationship is a relationship where only one of the at least two feature units is retained.

[0074] If the constraint relationship between at least two feature units is the fourth relationship, then in the tree - structured feature model, connect from the superior feature unit to the at least two feature units through a fourth - relationship structure line; where the at least two feature units are feature units at the same level; the fourth relationship is a relationship where at least one of the at least two feature units is retained.

[0075] In a specific example, the project to be delivered is to launch a financial product, and its tree - structured feature model can be as Figure 1B shown. For the root feature unit of the financial product, the fundraising period, the closed - period, and the maturity date must exist and can be used as mandatory features. The connecting lines between the financial product and the fundraising period, the closed - period, and the maturity date are the first - relationship connecting lines. Among the second - level features, the feature unit of the opening period is not required to exist and can be used as an optional feature. The connecting line between the financial product and the opening period is the second - relationship connecting line. Similarly, for the fundraising period, the maturity date, and the opening period, their corresponding mandatory features and optional features can be listed respectively until no further refinement is possible.

[0076] For the sub - feature units of the root feature unit of the financial product, any two of the fundraising period, the maturity date, the opening period, and the closed - period are in the second relationship, that is, the time of any two cannot overlap. As Figure 1B shown, the connecting lines between any two of the fundraising period, the maturity date, the opening period, and the closed - period are the second - relationship connecting lines. It should be noted that if there is a second relationship between the parent features, then there is also a second relationship between their corresponding sub - features.

[0077] For different services, Figure 1B the corresponding constraint relationships are listed. For the subscription and purchase services, there must be at least one subscription and purchase record of the account, that is, the relationship between the subscription and purchase services and the corresponding sub - feature units is the fourth relationship; and since a wealth management product can only mature once, the corresponding maturity service and the total maturity amount are in the first relationship; for the redemption service, each redemption transaction must meet the condition that the holding share is greater than the redeemed share, and the two are in the first relationship; for the dividend service, since a wealth management product can have multiple dividends, but for each dividend, there is one and only one total dividend amount, that is, the dividend feature unit and the corresponding lower - level feature unit are in the third relationship.

[0078] This solution can intuitively and clearly represent the refinement relationship and constraint relationship between feature units, which is beneficial for the electronic device to generate logical test data. At the same time, it is beneficial for developers to understand customer requirements and develop software that meets customer requirements.

[0079] The technical solution provided by the embodiment of this application can construct a tree - structured feature model through business requirement information, generate complete and logical test data, thereby reducing the dependence of test data on code and original data, and greatly improving the work efficiency of testers.

[0080] Embodiment III

[0081] Figure 3 It is a schematic structural diagram of a test data generation device provided by Embodiment III of the present invention. This device can execute the test data generation method provided by any embodiment of the present invention and has corresponding functional modules and beneficial effects for executing the method. As Figure 3 shown, this device may include:

[0082] A business requirement information acquisition module 310, configured to acquire the business requirement information of the project to be delivered;

[0083] A tree - structured feature model construction module 320, configured to construct a tree - structured feature model of the project to be delivered according to the business requirement information;

[0084] A test data generation module 330, configured to determine the test data of the project to be delivered according to the tree - structured feature model.

[0085] In this solution, optionally, the tree - structured feature model construction module 320 includes:

[0086] A feature determination unit, configured to determine at least two - level features of the project to be delivered according to the business requirement information; where each level of feature includes at least one feature unit;

[0087] A tree - like structure feature model determination unit for constructing a tree - like structure feature model of the project to be delivered according to the at least two - level features.

[0088] Based on the above - mentioned solution, optionally, the tree - like structure feature model determination unit is specifically configured to:

[0089] Determine the refinement relationship between feature units at all levels and the constraint relationship between each feature unit;

[0090] Construct a tree - like structure feature model of the project to be delivered according to the refinement relationship and the constraint relationship.

[0091] Based on the above - mentioned solution, optionally, constructing a tree - like structure feature model of the project to be delivered according to the refinement relationship includes:

[0092] If the refinement relationship is a mandatory relationship, in the tree - like structure feature model, connect the mandatory subordinate feature units of the current superior feature unit through a mandatory relationship structure line;

[0093] If the refinement relationship is an optional relationship, in the tree - like structure feature model, connect the optional subordinate feature units of the current superior feature unit through an optional relationship structure line.

[0094] Based on the foregoing solution, optionally, constructing a tree - like structure feature model of the project to be delivered according to the constraint relationship includes:

[0095] If the constraint relationship between two feature units is a first relationship, in the tree - like structure feature model, connect the two feature units through a necessary relationship structure line; wherein, the two feature units are feature units in the same level; the first relationship is a relationship where the two feature units exist simultaneously;

[0096] If the constraint relationship between two feature units is a second relationship, in the tree - like structure feature model, connect the two feature units through a mutually exclusive relationship structure line; wherein, the two feature units are feature units in the same level; the second relationship is a relationship where the two feature units do not exist simultaneously;

[0097] If the constraint relationship of at least two feature units is a third relationship, in the tree - like structure feature model, connect from the superior feature unit to the at least two feature units through a third relationship structure line; wherein, the at least two feature units are feature units in the same level; the third relationship is a relationship where only one of the at least two feature units is retained;

[0098] If the constraint relationship of at least two feature units is the fourth relationship, then in the tree - structured feature model, the at least two feature units are connected by a fourth - relationship structure line from a superior feature unit; wherein, the at least two feature units are feature units in the same level; the fourth relationship is a relationship in which at least one of the at least two feature units is retained.

[0099] In a feasible solution, optionally, the test data generation module 330 includes:

[0100] A test data inlet - outlet determination unit, configured to use the feature units in the tree - structured feature model that have no subordinate feature units as test data inlets; and use the feature units in the tree - structured feature model that have no superior feature units as test data outlets;

[0101] A data path generation unit, configured to generate data paths from each test data inlet to each test data outlet according to the refinement relationship and the constraint relationship;

[0102] A test data generation unit, configured to generate test data for the to - be - delivered project according to the data paths.

[0103] In a preferred solution, the test data generation unit is specifically configured to:

[0104] Generate a test data selection range that satisfies the refinement relationship and the constraint relationship according to the data definition sets of the feature units in the data paths;

[0105] Generate test data for the to - be - delivered project within the test data selection range.

[0106] The above - mentioned product can execute the test data generation method provided in the embodiments of the present application, and has functional modules and beneficial effects corresponding to the execution of the method.

[0107] Embodiment 4

[0108] Embodiment 4 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, it implements the test data generation method provided in all the inventive embodiments of the present application:

[0109] Obtain the business requirement information of the to - be - delivered project;

[0110] Construct a tree - structured feature model of the to - be - delivered project according to the business requirement information;

[0111] Determine the test data of the to - be - delivered project according to the tree - structured feature model.

[0112] Any combination of one or more computer-readable media may be employed. The computer-readable media may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present document, a computer-readable storage medium may be any tangible medium that contains or stores a program which can be used by or in connection with an instruction execution system, apparatus, or device.

[0113] A computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which the computer-readable program code is carried. Such a propagated data signal may take many forms, including—but not limited to—electromagnetic signals, optical signals, or any suitable combination of the foregoing. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device.

[0114] The program code contained 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.

[0115] The computer program code for performing the operations of the present invention may be written in one or more programming languages or combinations thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and also including conventional procedural programming languages such as the "C" language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the 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., through the Internet using an Internet service provider).

[0116] Example Five

[0117] Embodiment 5 of the present application provides an electronic device. Figure 4 It is a schematic structural diagram of an electronic device provided in Embodiment 5 of the present application. As Figure 4 shown, this embodiment provides an electronic device 400, which includes: one or more processors 420; a storage device 410 for storing one or more programs, and when the one or more programs are executed by the one or more processors 420, the one or more processors 420 implement the method for generating test data provided in the embodiments of the present application. This method includes:

[0118] Obtain the business requirement information of the project to be delivered;

[0119] According to the business requirement information, construct a tree - like structure feature model of the project to be delivered;

[0120] According to the tree - like structure feature model, determine the test data of the project to be delivered.

[0121] Of course, those skilled in the art can understand that the processor 420 also implements the technical solutions of the method for generating test data provided in any embodiment of the present application.

[0122] Figure 4 The displayed electronic device 400 is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present application.

[0123] As Figure 4 shown, the electronic device 400 includes a processor 420, a storage device 410, an input device 430, and an output device 440; the number of processors 420 in the electronic device can be one or more, Figure 4 and one processor 420 is taken as an example here; the processor 420, storage device 410, input device 430, and output device 440 in the electronic device can be connected through a bus or other means, Figure 4 and connection through the bus 450 is taken as an example here.

[0124] The storage device 410, as a computer - readable storage medium, can be used to store software programs, computer - executable programs, and module units, such as the program instructions corresponding to the method for generating test data in the embodiments of the present application.

[0125] The storage device 410 may mainly include a program storage area and a data storage area. Among them, the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created according to the use of the terminal, etc. In addition, the storage device 410 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some instances, the storage device 410 may further include a memory remotely provided with respect to the processor 420, and these remote memories may be connected through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0126] The input device 430 can be used to receive input digital, character information or voice information, and generate key signal inputs related to the user settings and function controls of the electronic device. The output device 440 may include electronic devices such as a display screen and a speaker.

[0127] The electronic device provided by the embodiments of the present application can construct a tree structure feature model through service requirement information, generate complete and logical test data, thereby reducing the dependence of the test data on the code and the original data, and greatly improving the work efficiency of testers.

[0128] The test data generation device, medium and electronic device provided in the above embodiments can execute the test data generation method provided in any embodiment of the present application, and have corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in the above embodiments can be found in the test data generation method provided in any embodiment of the present application.

[0129] Note that the above is only the preferred embodiment of the present invention and the applied technical principle. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, re-adjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments. Without departing from the concept of the present invention, more other equivalent embodiments can be included, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A method for generating test data, characterized in that, The method includes: Obtaining the business requirement information of the project to be delivered; Determining at least two levels of features of the project to be delivered according to the business requirement information; wherein, each level of features includes at least one feature unit; Determining the refinement relationship between feature units at each level and the constraint relationship between each feature unit; Constructing a tree-structured feature model of the project to be delivered according to the refinement relationship and the constraint relationship; Determining the test data of the project to be delivered according to the tree-structured feature model; Among them, constructing the tree-structured feature model of the project to be delivered according to the refinement relationship includes: If the refinement relationship is a mandatory relationship, in the tree-structured feature model, connect the mandatory lower-level feature units of the current upper-level feature unit through a mandatory relationship structure line; If the refinement relationship is an optional relationship, in the tree-structured feature model, connect the optional lower-level feature units of the current upper-level feature unit through an optional relationship structure line; Constructing the tree-structured feature model of the project to be delivered according to the constraint relationship includes: If the constraint relationship between two feature units is the first relationship, in the tree-structured feature model, connect the two feature units through a mandatory relationship structure line; wherein, the two feature units are feature units in the same level; the first relationship is the relationship that the two feature units exist simultaneously; If the constraint relationship between two feature units is the second relationship, in the tree-structured feature model, connect the two feature units through a mutually exclusive relationship structure line; wherein, the two feature units are feature units in the same level; the second relationship is the relationship that the two feature units do not exist simultaneously; If the constraint relationship between at least two feature units is the third relationship, in the tree-structured feature model, connect from the upper-level feature unit to the at least two feature units through a third relationship structure line; wherein, the at least two feature units are feature units in the same level; the third relationship is the relationship that only one of the at least two feature units is retained; If the constraint relationship between at least two feature units is the fourth relationship, in the tree-structured feature model, connect from the upper-level feature unit to the at least two feature units through a fourth relationship structure line; wherein, the at least two feature units are feature units in the same level; the fourth relationship is the relationship that at least one of the at least two feature units is retained.

2. The method according to claim 1, wherein The determining the test data of the project to be delivered according to the tree-structured feature model includes: Taking the feature units without lower-level feature units in the tree-structured feature model as test data entrances; and taking the feature units without upper-level feature units in the tree-structured feature model as test data exits; Generating data paths from each test data entrance to each test data exit according to the refinement relationship and the constraint relationship; Generating the test data of the project to be delivered according to the data paths; 3. The method according to claim 2, wherein The generating the test data of the project to be delivered according to the data paths includes: Generating a test data selection range that satisfies the refinement relationship and the constraint relationship according to the data definition sets of each feature unit in the data paths; Generate test data for the project to be delivered within the selected range of the test data.

4. A test data generation device, characterized in that, The device includes: A business requirement information acquisition module for acquiring the business requirement information of the project to be delivered; A tree-structured feature model construction module for determining at least two levels of features of the project to be delivered according to the business requirement information; wherein, each level of features includes at least one feature unit; determining the refinement relationship between feature units at each level, and the constraint relationship between each feature unit; constructing a tree-structured feature model of the project to be delivered according to the refinement relationship and the constraint relationship; A test data generation module for determining the test data of the project to be delivered according to the tree-structured feature model; Among them, constructing the tree-structured feature model of the project to be delivered according to the refinement relationship includes: If the refinement relationship is a mandatory relationship, in the tree-structured feature model, connect the mandatory lower-level feature units of the current upper-level feature unit through a mandatory relationship structure line; If the refinement relationship is an optional relationship, in the tree-structured feature model, connect the optional lower-level feature units of the current upper-level feature unit through an optional relationship structure line; Constructing the tree-structured feature model of the project to be delivered according to the constraint relationship includes: If the constraint relationship between two feature units is a first relationship, in the tree-structured feature model, connect the two feature units through a mandatory relationship structure line; wherein, the two feature units are feature units at the same level; the first relationship is a relationship in which the two feature units exist simultaneously; If the constraint relationship between two feature units is a second relationship, in the tree-structured feature model, connect the two feature units through a mutually exclusive relationship structure line; wherein, the two feature units are feature units at the same level; the second relationship is a relationship in which the two feature units do not exist simultaneously; If the constraint relationship of at least two feature units is a third relationship, in the tree-structured feature model, connect from the upper-level feature unit to the at least two feature units through a third relationship structure line; wherein, the at least two feature units are feature units at the same level; the third relationship is a relationship in which only one of the at least two feature units is retained; If the constraint relationship of at least two feature units is a fourth relationship, in the tree-structured feature model, connect from the upper-level feature unit to the at least two feature units through a fourth relationship structure line; wherein, the at least two feature units are feature units at the same level; the fourth relationship is a relationship in which at least one of the at least two feature units is retained.

5. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method for generating test data as described in any one of claims 1-3.

6. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method for generating test data as described in any one of claims 1-3.

Citation Information

Patent Citations

  • Automatic generation method and device of test data, electronic equipment and storage medium

    CN113656295A