Test data generation method and device, electronic equipment and program product

By traversing and processing combinations of test scenario types, test data is automatically generated, solving the problem of the explosive growth in the number of scenario combinations in business automation programs and improving the compilation efficiency and coverage of test data.

CN115114136BActive Publication Date: 2025-11-21JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110286511.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-17
Publication Date
2025-11-21
Estimated Expiration
2041-03-17

AI Technical Summary

Technical Problem

In interface testing of business automation programs, as business complexity increases, the number of parameter variables increases, leading to an exponential increase in the number of scenario combinations. This reduces the compilation efficiency of testers and makes it easy to miss test data.

Method used

By obtaining the parameter configuration list, iterating through and processing combinations of test scenario types, and generating test data, including the test scenario type corresponding to each parameter variable, the test data is automatically generated using a generation script.

Benefits of technology

It enables automated generation of test data, improves data compilation efficiency and scenario coverage, and enhances test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115114136B_ABST
    Figure CN115114136B_ABST
Patent Text Reader

Abstract

The method and device for generating test data, the electronic device and the program product provided by the embodiments of the present application obtain a parameter configuration list of test data, the parameter configuration list includes at least one test scene type corresponding to each parameter variable; a combination of test scene types in the parameter configuration list is processed iteratively to obtain a plurality of test scene type combinations; each test scene type combination includes one of the test scene types corresponding to each parameter variable; and test data for testing a test target is generated according to the obtained test scene type combinations, thereby realizing the automatic generation of test data including all test scene type combinations, and the test data generated by the above method has high data compiling efficiency and high scene coverage of test data, which is beneficial to improving the test effect.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, and particularly relates to a test data generation method and device, electronic equipment and program product. BACKGROUND

[0002] With the development of computer technology, more and more businesses are implemented by automatic programs. In order to ensure the normal operation of the business automatic program, interface testing of the business program is an essential link.

[0003] In the existing testing process, a tester often compiles test data under each scene combination according to different scene combinations of a business. Then, the tester uses the test data to test the business program.

[0004] However, with the complication of the business, the number of parameter variables of the business will increase, and the increase in the number of parameter variables will cause the number of scene combinations to increase exponentially. When the tester compiles test data under each scene combination, the compiling efficiency of the tester will decrease with the increase in the number of scene combinations, and the tester is also likely to miss some test data of some scene combinations. SUMMARY

[0005] Embodiments of the present application provide a test data generation method, device, electronic equipment and program product to provide a method for automatically generating test data.

[0006] In one aspect, the present application provides a test data generation method, comprising:

[0007] obtaining a parameter configuration list of test data, wherein the parameter configuration list includes at least one test scene type corresponding to each parameter variable;

[0008] performing traversal processing on combinations of test scene types in the parameter configuration list to obtain a plurality of test scene type combinations, wherein each test scene type combination includes one of the test scene types corresponding to each parameter variable;

[0009] generating test data for testing a test target according to the obtained test scene type combinations.

[0010] In an optional embodiment, the traversal processing on the combinations of test scene types in the parameter configuration list to obtain a plurality of test scene type combinations comprises:

[0011] determining the number of combinations of test scene type combinations according to the number of types of test scene types corresponding to each parameter variable;

[0012] The combination of the test scene types in the parameter configuration list is iterated to obtain a same number of test scene type combinations as the number of the combinations.

[0013] In an optional embodiment, the iteration of the combination of the test scene types in the parameter configuration list to obtain a plurality of test scene type combinations comprises:

[0014] For any parameter variable in the parameter variables, the at least one test scene type corresponding to the parameter variable is sorted to obtain a type sequence set corresponding to the parameter variable.

[0015] The process of selecting a test scene type from the type sequence set of each parameter variable to construct a test scene type combination of this selection is repeatedly executed until all test scene type combinations are iterated.

[0016] In an optional embodiment, the generation of the test data for testing the test target according to the obtained test scene type combinations comprises:

[0017] The generated script of the test data is called, and the values of the parameter variables corresponding to the test scene type combinations are input into the generated script to obtain the test data.

[0018] In an optional embodiment, the method further comprises:

[0019] The test case template of the test target is called.

[0020] The test case is generated according to the test data and the test case template.

[0021] The test case is executed to obtain a test result, wherein the test result includes a result corresponding to each test scene type combination in the test data.

[0022] In a second aspect, the present application provides a test data generation device, comprising:

[0023] An obtaining module is configured to obtain a parameter configuration list of test data, wherein the parameter configuration list includes at least one test scene type corresponding to each parameter variable.

[0024] A processing module is configured to iterate the combination of the test scene types in the parameter configuration list to obtain a plurality of test scene type combinations, wherein each test scene type combination includes one of the test scene types corresponding to each parameter variable.

[0025] A generation module is configured to generate test data for testing a test target according to the obtained test scene type combinations.

[0026] In an optional embodiment, the processing module is specifically configured to:

[0027] determine a combination number of the test scene type combinations according to a type number of the test scene type types corresponding to each parameter variable;

[0028] perform traversal processing on the combinations of the test scene types in the parameter configuration list to obtain the same number of test scene type combinations as the combination number.

[0029] In an optional embodiment, the processing module is specifically configured to:

[0030] sort the at least one test scene type corresponding to any parameter variable in the parameter variables to obtain a type sequence set corresponding to the parameter variable;

[0031] repeat the processing of selecting a test scene type from the type sequence set of each parameter variable to construct a test scene type combination of this selection until all test scene type combinations are obtained through traversal.

[0032] In an optional embodiment, the generation module is specifically configured to:

[0033] call a generation script of test data, input the values of the parameter variables corresponding to the test scene type combinations into the generation script, and obtain the test data.

[0034] In an optional embodiment, the apparatus further includes a test module.

[0035] The generation module is further configured to call a test case template of a test target and generate a test case according to the test data and the test case template.

[0036] The test module is configured to execute the test case to obtain a test result, wherein the test result includes a result corresponding to each test scene type combination in the test data.

[0037] In a third aspect, the present application provides an electronic device, including at least one processor and a memory.

[0038] The memory stores computer execution instructions.

[0039] The at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the test data generation method in the first aspect.

[0040] In a fourth aspect, the present application provides a computer readable storage medium, wherein the computer readable storage medium stores computer execution instructions, and when a processor executes the computer execution instructions, the computer execution instructions implement the method for generating test data according to the first aspect.

[0041] In a fifth aspect, the present application provides a computer program product, comprising a computer program, and when a processor executes the computer program, the computer program implements the method for generating test data according to the first aspect.

[0042] The embodiments of the present application provide a method and device for generating test data, an electronic device and a program product. The method comprises the following steps: obtaining a parameter configuration list of test data, wherein the parameter configuration list comprises at least one test scene type corresponding to each parameter variable; performing traversal processing on combinations of test scene types in the parameter configuration list to obtain a plurality of test scene type combinations, wherein each test scene type combination comprises one test scene type corresponding to each parameter variable; and generating test data for testing a test target according to the obtained test scene type combinations. The method can automatically generate test data comprising all test scene type combinations, and the test data generated by the method has high data compiling efficiency and high scene coverage, which can improve the testing effect. BRIEF DESCRIPTION OF DRAWINGS

[0043] The accompanying drawings, which are incorporated herein and form a part of the specification, illustrate embodiments consistent with the present application and, together with the description, further serve to explain the principles of the present application.

[0044] Figure 1 A schematic diagram of a network architecture based on the present application;

[0045] Figure 2 A flowchart of a method for generating test data according to the present application;

[0046] Figure 3 An interface diagram of a method for generating test data according to the present application;

[0047] Figure 4 A structural diagram of a device for generating test data according to an embodiment of the present application;

[0048] Figure 5 A structural diagram of an electronic device according to an embodiment of the present application.

[0049] The above drawings have shown the specific embodiments of the present application, and the following will have a more detailed description. The drawings and the written description are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0050] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The description herein relates to the drawings, which show by way of illustration various

[0051] With the development of computer technology, more and more businesses are implemented by automatic programs. In order to ensure the normal operation of the business automatic program, it is necessary to interface test the business program.

[0052] In the existing test process, the test personnel often compiles the test data under each scene combination according to different scene combinations of the business, and then uses the test data to test the business program.

[0053] Specifically, taking the test of querying the interface in the interface test as an example, a plurality of query methods are generally used to test the interface. For any query method, the number of query conditions is not fixed, and the same query condition can correspond to different query parameters. This makes the number of query condition combinations more when the number of query conditions is more, and the number of query parameter combinations corresponding to each query condition combination is also more. At this time, if the test personnel manually exhausts all parameter combinations under the query condition combinations, it is not only time-consuming and laborious, but also easy to miss.

[0054] Taking a query method as an example, if the query method has 2 query conditions, which are query condition A and query condition B, and query condition A corresponds to 4 scenarios, which are "no parameter", "random number", "type correct, data too long", and "data correct"; and query condition B corresponds to 3 scenarios, which are "no parameter", "random number", and "data correct".

[0055] When compiling the test data, the situation of each query condition under different scenarios needs to be considered, and through the combination of query condition A and query condition B under different scenarios, 12 scene combination situations shown in Table 1 can be obtained.

[0056] Table 1

[0057]

[0058] When the test personnel compiles the test data, the test data corresponding to the scene combinations shown in Table 2 is obtained based on the foregoing Table 1, and then the corresponding test cases are obtained.

[0059] Table 2

[0060]

[0061] As can be seen from the above example, when the query condition A in the query method corresponds to 4 scenarios and the query condition B corresponds to 3 scenarios, 12 scenario combinations can be obtained. In other query methods, there can be more than two query conditions, and each query condition can correspond to a larger number of scenarios, which makes the compilation efficiency of the test personnel in compiling the test data under each scenario combination decrease on the one hand, and it is easy to miss some scenario combination test data on the other hand.

[0062] To solve the above problems, in the scheme based on the present application, a parameter configuration list of test data is obtained, the parameter configuration list including at least one test scenario type corresponding to each parameter variable; the combination of test scenario types in the parameter configuration list is iterated to obtain a plurality of test scenario type combinations; each test scenario type combination includes one of the test scenario types corresponding to each parameter variable; according to the obtained test scenario type combinations, test data for testing the test target is generated, thereby realizing the automatic generation of test data including all test scenario type combinations, and the test data generated in the above manner has high data compilation efficiency and high scenario coverage of test data, which is beneficial to improve the test effect.

[0063] The method provided by the present application will be described below in combination with different implementation manners.

[0064] Reference Figure 1 , Figure 1 is a schematic diagram of a network architecture based on the present application, which Figure 1 The network architecture shown in the figure can specifically include a test server 1 and a device to be tested 2.

[0065] The test server 1 specifically refers to a service system carrying various test-related businesses, and the test data generation device provided by the present application is integrated in the server. The test server 1 can be specifically built in a server cluster in the cloud. In the implementation manner of the present application, the test server 1 can specifically realize the functions of test data automatic generation, test case generation, test execution, test result acquisition, and other test-related businesses.

[0066] The device to be tested 2 can be specifically a user's mobile phone, tablet computer, desktop computer, single-chip computer, etc. hardware device, and the device to be tested 2 can be specifically provided with an interface to be tested or a unit to be tested. Through interaction with the test server 1, the device to be tested 2 can obtain test cases and perform corresponding tests.

[0067] The interaction between the test server 1 and the device to be tested 2 can be achieved through wireless communication technology, and the communication mode and communication standard adopted by the test server 1 and the device to be tested 2 will not be limited in the present application.

[0068] Embodiment one

[0069] Figure 2 is a flowchart of a test data generation method provided by the present application, as shown in Figure 2 The method comprises the following steps:

[0070] Step 101, obtaining a parameter configuration list of test data, wherein the parameter configuration list comprises at least one test scene type corresponding to each parameter variable.

[0071] Step 102, performing traversal processing on the combination of test scene types in the parameter configuration list to obtain a plurality of test scene type combinations; wherein each test scene type combination comprises one of the test scene types corresponding to each parameter variable.

[0072] Step 103, generating test data for testing a test target according to the obtained test scene type combinations.

[0073] It should be noted that the test data generation method provided by the present application can be applied to a test data generation device, and the processing device can be specifically arranged in Figure 1 The test can be based on JUnit architecture or TestNG architecture, and the test data generation method provided by the present application can be used to generate test data for the test architecture.

[0074] The test data generation method provided by the present application is completely different from the prior art. The test data generation method provided by the present application can traverse the test scene of different parameter variables to obtain all test scene type combinations corresponding to the parameter variables, and then generate corresponding test data.

[0075] Specifically, the test data generation device first needs to obtain a parameter configuration list of test data.

[0076] Table 3

[0077]

[0078] Table 3 shows the combination of test scenarios corresponding to a test method, in which there are parameter variables A, B and C, each of which can be used to represent the test conditions. Each parameter variable corresponds to multiple scenarios, such as parameter variable A corresponding to no parameter and random number, etc.

[0079] Each row in Table 3 represents a combination of test scenario types, such as the combination of parameter variable A test scenario type being no parameter, parameter variable B test scenario type being no parameter and parameter variable C test scenario type being no parameter, as shown in the first row of Table 3.

[0080] In this application, in order to facilitate the traversal combination of test scenario types, the combination list shown in Table 3 will not be used, but a parameter configuration list shown in Table 4 will be used.

[0081] Table 4

[0082]

[0083] As shown in Table 4, parameter variables A, B and C are used to represent different test conditions in different test methods, and the test scenario types corresponding to the parameter variables are used to represent the types of scenarios involved in the test conditions. In Table 4, there will be no coupling relationship between each row and each column of the list.

[0084] In an optional embodiment, the parameter configuration list is pre-constructed and stored in the test data generation device (test server). That is, before the tester first tests a certain test method on a test device, the parameter configuration list corresponding to the test method can be first established according to the test method, and the parameter variables and test scenario types of the test method are entered into the parameter configuration list according to the association between the test conditions and test scenarios involved in the test method, for storage by the generation device (test server). Of course, for different test methods of different test devices, the generation device should have the corresponding parameter configuration list of the test device under the test method.

[0085] Subsequently, the generation device will use the parameter configuration list to traverse the test scenario types therein to obtain multiple test scenario type combinations. In each scenario type combination, at least one test scenario type corresponding to each parameter variable should be included.

[0086] Specifically, in the traversal processing, the generating device sorts, for any one of the parameter variables, the at least one test scenario type corresponding to the parameter variable, to obtain a type sequence set corresponding to the parameter variable; then, repeatedly executes the processing of selecting one test scenario type from the type sequence set of each parameter variable to construct the test scenario type combination of this selection, until all the test scenario type combinations are obtained through traversal.

[0087] Taking the parameter configuration list shown in Table 4 above as an example:

[0088] Since the table 4 involves three parameter variables: parameter variable A, parameter variable B and parameter variable C.

[0089] The test scenario types M involving the parameter variable A are sorted to obtain the sequence of “no parameter”, “random number”, “type correct, data too long” and “data correct”, and the sequence start can be marked as M1 and the sequence end can be marked as M4. Based on this, [M1, M2, M3, M4] can represent the type sequence set corresponding to the parameter variable A.

[0090] Similarly, the test scenario types N involving the parameter variable B are sorted to obtain the sequence of “no parameter”, “random number” and “data correct”, and the sequence start can be marked as N1 and the sequence end can be marked as N3. Based on this, [N1, N2, N3] can represent the type sequence set corresponding to the parameter variable B.

[0091] The test scenario types O involving the parameter variable C are sorted to obtain the sequence of “no parameter”, “random number” and “data correct”, and the sequence start can be marked as O1 and the sequence end can be marked as O3. Based on this, [O1, O2, O3] can represent the type sequence set corresponding to the parameter variable C.

[0092] Then, the generating device selects one test scenario type from each type sequence set to form different test scenario type combinations.

[0093] In the process of repeatedly selecting test scenario type combinations from each type sequence set, traversal selection can be performed in a certain order: for example, starting from M1 in [M1, M2, M3, M4], all scenario type combinations including M1 are selected, and in this process, N1 is selected first from [N1, N2, N3], and all scenario type combinations including [M1, N1] are selected, then all scenario type combinations including [M1, N2] are selected, and so on, until all scenario type combinations including [M1, N3] are selected; then, all scenario type combinations including M2 are selected, and so on, until all scenario type combinations including M4 are selected.

[0094] By traversing, test scenario type combinations including [M1, N1, O1], [M1, N1, O2], …, [M2, N1, O3], …, [M4, N3, O3] can be obtained.

[0095] In an optional embodiment, in order to facilitate determining whether the currently obtained test scenario type combination is all the test scenario type combinations, i.e., whether the currently obtained test scenario type combination is exhaustive, the number of test scenario type combinations that can be obtained according to the current parameter configuration list can also be calculated in this embodiment. That is, the generation device can determine the number of test scenario type combinations according to the number of types of test scenario types corresponding to each parameter variable; and perform traversal processing on the combination of test scenario types in the parameter configuration list to obtain the same number of test scenario type combinations as the number of combinations. The specific calculation method of the number of test scenario type combinations Number can use the following formula (1), that is:

[0096] Number=A(M)×B(N)×C(O) Formula (1)

[0097] Wherein, A(M) is used to represent the number of test scenario types corresponding to parameter variable A, and M is used to represent the Mth test scenario type under parameter variable A; similarly, B(N) is used to represent the number of test scenario types corresponding to parameter variable B, and N is used to represent the Nth test scenario type under parameter variable B; C(O) is used to represent the number of test scenario types corresponding to parameter variable C, and O is used to represent the Oth test scenario type under parameter variable C.

[0098] Finally, based on obtaining each test scenario type combination, test data for testing the test target is generated.

[0099] Specifically, in order to further improve the generation efficiency of the test data, in this embodiment, the generation device can call a generation script of the test data, input the values of the parameter variables corresponding to each test scenario type combination into the generation script, and obtain the test data.

[0100] As for the generation script for generating the test data, it can be obtained by using the existing script editing method, that is, by analyzing any of the aforementioned obtained measurement scenario type combinations to obtain the corresponding analysis code, and then using the script to compile the obtained analysis code to obtain the corresponding test data.

[0101] At this point, the generation device obtains the test data corresponding to each test scenario combination. In other optional embodiments, test cases for testing can also be continuously generated and executed.

[0102] Specifically, a test case template of a test target is invoked; a test case is generated according to the test data and the test case template; the test case is executed to obtain a test result; wherein the test result includes a result corresponding to each test scenario type combination in the test data.

[0103] Figure 3 is an interface diagram of a test data generation method provided by the present application, as shown in the interface, the test data obtained by the above method is used for testing, and the test result obtained is shown. Figure 3 The test result should include the test result of each test scenario combination.

[0104] By using such a method, an automatic test process from test data generation to test result acquisition can be realized, which improves the efficiency of test data and test result acquisition and guarantees the coverage rate of test scenarios.

[0105] The test data generation method provided by the present application obtains a parameter configuration list of test data, wherein the parameter configuration list includes at least one test scenario type corresponding to each parameter variable; the combination of the test scenario types in the parameter configuration list is processed to obtain a plurality of test scenario type combinations; wherein each test scenario type combination includes one of the test scenario types corresponding to each parameter variable; and the test data for testing a test target is generated according to the obtained test scenario type combinations, thereby realizing the automatic generation of test data including all test scenario type combinations, and the test data generated by the above method has high data compilation efficiency and high test data scenario coverage, which is beneficial to improve the test effect.

[0106] Embodiment Two

[0107] The test data generation method corresponding to the above embodiment, Figure 4 is a structural diagram of a test data generation device provided by the present application, as shown in the figure, the test data generation device includes an acquisition module 10, a processing module 20 and a generation module 30. Figure 4

[0108] Among them,

[0109] The acquisition module 10 is used to obtain a parameter configuration list of test data, wherein the parameter configuration list includes at least one test scenario type corresponding to each parameter variable;

[0110] ​The processing module 20 is configured to perform traversal processing on combinations of test scenario types in the parameter configuration list to obtain a plurality of test scenario type combinations, wherein each test scenario type combination includes one of test scenario types corresponding to each parameter variable.

[0111] The generating module is configured to generate test data for testing the test target according to the obtained test scenario type combinations.

[0112] In an optional embodiment, the processing module 20 is specifically configured to:

[0113] determine a combination number of test scenario type combinations according to a type number of test scenario types corresponding to each parameter variable;

[0114] perform traversal processing on combinations of test scenario types in the parameter configuration list to obtain test scenario type combinations with the same number as the combination number.

[0115] In an optional embodiment, the processing module 20 is specifically configured to:

[0116] sort at least one test scenario type corresponding to any parameter variable in the parameter variables to obtain a type sequence set corresponding to the parameter variable;

[0117] repeat the processing of selecting a test scenario type from the type sequence set of each parameter variable to construct a test scenario type combination of this selection until all test scenario type combinations are obtained through traversal.

[0118] In an optional embodiment, the generating module is specifically configured to:

[0119] call a generation script of the test data, input values of parameter variables corresponding to the test scenario type combinations into the generation script, and obtain the test data.

[0120] In an optional embodiment, the generation apparatus further includes a testing module 30.

[0121] The generating module is further configured to call a test case template of the test target, and generate a test case according to the test data and the test case template.

[0122] The testing module 30 is configured to execute the test case to obtain a test result, wherein the test result includes a result corresponding to each test scenario type combination in the test data.

[0123] The embodiment of the present application provides a test data generation device, a parameter configuration list of test data is obtained, the parameter configuration list includes at least one test scene type corresponding to each parameter variable; the combination of the test scene types in the parameter configuration list is processed iteratively to obtain a plurality of test scene type combinations; wherein each test scene type combination includes one of the test scene types corresponding to each parameter variable; according to the obtained test scene type combinations, test data for testing a test target is generated, so that the automatic generation of test data including all test scene type combinations is realized, and the test data generated in the above manner has high data compiling efficiency and high scene coverage of test data, and the test effect is improved.

[0124] Embodiment three

[0125] Figure 5 The structure schematic diagram of the electronic device provided by the embodiment of the present application is shown in the figure, and the embodiment of the present application further provides an electronic device 1400, which comprises a memory 1401, a processor 1402 and a computer program. Figure 5

[0126] The computer program is stored in the memory 1401 and is configured to be executed by the processor 1402 to realize the test data generation method provided by any one of the embodiments of the present application. The related description and effect corresponding to the steps in the figure can be understood by referring to the related description and effect, and excessive details are not described here.

[0127] In the embodiment, the memory 1401 and the processor 1402 are connected through a bus.

[0128] Embodiment four

[0129] The embodiment of the present application provides a computer readable storage medium, and the computer program is stored on the computer readable storage medium, and the computer program is executed by the processor to realize the test data generation method provided by any one of the embodiments of the present application.

[0130] In several embodiments provided by the present application, it should be understood that the disclosed system and method can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There can be another division manner in actual implementation. For example, a plurality of modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the shown or discussed modules can be indirect coupling or communication connection through some interface, and electrical, mechanical or other forms.

[0131] ​The modules explained as separated components can or can not be physically separated, and the components shown as modules can or can not be physical modules, i.e., can be located in one place, or can be distributed to multiple network modules. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment.

[0132] In addition, each functional module in various embodiments of the present application can be integrated into one processing module, or each module can exist physically alone, or two or more modules can be integrated into one module. The integrated module can be realized in the form of hardware or in the form of hardware plus software functional module.

[0133] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to the processor or controller of a general purpose computer, a special purpose computer, or other programmable data processing system, so that the program codes, when executed by the processor or controller, cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program codes can be executed completely on a machine, partially on a machine, partially on a machine as a separate software package, and partially on a remote machine, or completely on a remote machine or server.

[0134] In the context of the present application, the machine-readable medium can be a tangible medium that can contain or store the program for use by or in connection with an instruction execution system, system, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, system, or device, or any suitable combination of the above. More specific examples of machine-readable storage media can include one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.

[0135] In addition, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the above-mentioned method for generating test data.

[0136] Moreover, while operations are depicted in a particular order, this should not be understood as requiring such an order nor that all illustrated operations be performed to achieve desirable results. In certain circumstances, multitasking and parallel processing can be advantageous. Likewise, while several specific implementation details are contained in the above discussion, these should not be construed as limitations on the scope of the disclosure, but rather as descriptions of particular implementations. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable sub-combination.

[0137] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims

1. A method of generating test data, characterized by, Comprise: obtain a parameter configuration list of pre-stored test data, the parameter configuration list includes each parameter variable and at least one test scene type corresponding to each parameter variable; The parameter variable is used to refer to different test conditions in different test methods, and the test scene type corresponding to the parameter variable is used to represent the type of the scene involved in the test condition; The combination of the test scene types in the parameter configuration list is traversed to obtain a plurality of test scene type combinations; Each test scene type combination includes one of the test scene types corresponding to each parameter variable; The number of combinations of the test scene type combinations is determined according to the number of types of the test scene types corresponding to each parameter variable; The combination of the test scene types in the parameter configuration list is traversed to obtain a plurality of test scene type combinations, comprising: For any parameter variable in the parameter variable, at least one test scene type corresponding to the parameter variable is sorted to obtain a type sequence set corresponding to the parameter variable; Repeat the process of selecting a test scene type from the type sequence set of each parameter variable to construct the test scene type combination of this selection until all test scene type combinations are obtained; According to the obtained test scene type combinations, test data for testing the test target is generated.

2. The generation method of claim 1, wherein, The combination of the test scene types in the parameter configuration list is traversed to obtain a plurality of test scene type combinations, comprising: According to the number of types of the test scene types corresponding to each parameter variable, determine the number of combinations of test scene type combinations; The combination of the test scene types in the parameter configuration list is traversed to obtain a plurality of test scene type combinations, comprising:

3. The generation method of claim 1, wherein, According to the obtained test scene type combinations, test data for testing the test target is generated. The test data is obtained by calling the test data generation script and inputting the values of the parameter variables corresponding to the test scene type combinations into the generation script.

4. The method of generating according to any of claims 1-3, characterized in that, Also include: Call the test case template of the test target; According to the test data and the test case template, generate test cases; Execute the test case to obtain test results; The test results include the results corresponding to each test scene type combination in the test data.

5. An apparatus for generating test data, characterized by Comprise: The acquisition module is used for obtaining a parameter configuration list of pre-stored test data, and the parameter configuration list includes each parameter variable and at least one test scene type corresponding to each parameter variable; The parameter variable is used to refer to different test conditions in different test methods, and the test scene type corresponding to the parameter variable is used to represent the type of the scene involved in the test condition; The processing module is configured to perform traversal processing on combinations of the test scenario types in the parameter configuration list to obtain a plurality of test scenario type combinations, wherein each test scenario type combination includes one of the test scenario types corresponding to each parameter variable, and the number of combinations of the test scenario type combinations is determined according to the number of types of the test scenario types corresponding to each parameter variable. The generating module is configured to generate test data for testing the test target according to the obtained test scenario type combinations. The processing module is specifically configured to: sort the at least one test scenario type corresponding to any parameter variable in the parameter variables to obtain a type sequence set corresponding to the parameter variable; repeat the processing of selecting a test scenario type from the type sequence set of each parameter variable to construct a test scenario type combination of this selection until all test scenario type combinations are obtained.

6. The generating device of claim 5, wherein, The processing module is specifically configured to: determine the number of combinations of the test scenario type combinations according to the number of types of the test scenario types corresponding to each parameter variable; perform traversal processing on combinations of the test scenario types in the parameter configuration list to obtain the same number of test scenario type combinations as the number of combinations.

7. The generating device of claim 5, wherein, The generating module is specifically configured to: call a generation script of the test data, input the values of the parameter variables corresponding to the test scenario type combinations into the generation script, and obtain the test data.

8. The generating device according to any of claims 5-7, characterized in that, Further comprising: a testing module; The generating module is further configured to call a test case template of the test target, and generate a test case according to the test data and the test case template; The testing module is configured to execute the test case to obtain a test result, wherein the test result includes a result corresponding to each test scenario type combination in the test data.

9. An electronic device, comprising: comprising: at least one processor and a memory; The memory stores computer execution instructions; The at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the method of any one of claims 1-4.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and when the processor executes the computer execution instructions, the generation method of any one of claims 1-4 is realized.

11. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to realize the generation method of any one of claims 1-4.

Citation Information

Patent Citations

  • Test method and device

    CN102354297A