A test data set generation method, device, equipment and storage medium
By performing heterogeneous processing on the input parameter information of the tested object, a full-coverage test dataset is generated, which solves the problems of long time consumption and low accuracy in test case data orchestration, and improves the efficiency and accuracy of software testing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JINGDONG TECH HLDG CO LTD
- Filing Date
- 2021-05-21
- Publication Date
- 2026-04-17
AI Technical Summary
In existing software testing processes, the compilation of test case data is time-consuming, costly, and difficult to be comprehensive and accurate, resulting in low accuracy of test results.
By determining the input parameter information of the object under test, the target parameters are processed using the rules in the data heterogeneity rule base to generate heterogeneous data, and a full-coverage test dataset is generated based on the heterogeneous data and the parameter data of other input parameters.
It enables the rapid and accurate generation of full-coverage test datasets, improving software testing efficiency and the accuracy of test results.
Smart Images

Figure CN115373975B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer application technology, and in particular to a method, apparatus, device and storage medium for generating test datasets. Background Technology
[0002] With the rapid development of computer and internet technologies, software development processes are accelerating, and software testing technologies are constantly adapting to the need for rapid response.
[0003] In the software testing phase, test cases are typically written manually by testers, who also manually create the execution environment, execution logic, test data, and test scripts. Obtaining test data is a crucial step in executing test cases for software testing. Testers strive to ensure that the test data comprehensively covers various business scenarios when writing test cases. However, due to varying levels of understanding of the business logic and different application of testing methodologies among testers, manually compiling test data often takes a considerable amount of time, resulting in high labor costs, low software testing efficiency, and difficulty in obtaining comprehensive and accurate test data. This leads to a small volume of test data and reduces the accuracy of the software testing results. Summary of the Invention
[0004] The purpose of this application is to provide a method, apparatus, device, and storage medium for generating test datasets, so as to quickly and accurately generate test datasets and improve the efficiency and accuracy of software testing results.
[0005] To solve the above-mentioned technical problems, this application provides the following technical solution:
[0006] A method for generating a test dataset, comprising:
[0007] Identify the object to be tested;
[0008] Obtain the input parameter information of the object under test, the input parameter information including the input parameters of the object under test and the target parameters to be heterogeneous in the input parameters of the object under test;
[0009] Based on the data heterogeneity rules in the data heterogeneity rule base, each of the target parameters is subjected to data heterogeneity processing to generate heterogeneous data;
[0010] Based on the heterogeneous data and the parameter data of other input parameters besides the target parameter, a full-coverage test dataset is generated.
[0011] In one specific embodiment of this application, the step of performing data heterogeneous processing on each target parameter according to the data heterogeneous rules in the data heterogeneous rule base includes:
[0012] Determine the priority of heterogeneous rules in the heterogeneous rule base;
[0013] According to the priority order of the data heterogeneity rules, each data heterogeneity rule is used in turn to perform data heterogeneity processing on each target parameter.
[0014] In one specific embodiment of this application,
[0015] The data heterogeneity rules in the data heterogeneity rule base include data type rules. The step of performing data heterogeneity processing on each target parameter according to the data heterogeneity rules in the data heterogeneity rule base includes:
[0016] Determine the data type of each of the target parameters;
[0017] Based on the data type rules in the data heterogeneity rule base, each target parameter is subjected to data heterogeneity processing according to the reference value of the corresponding data type;
[0018] Alternatively, the data heterogeneous rules in the data heterogeneous rule base include business rules, and the step of performing data heterogeneous processing on each target parameter according to the data heterogeneous rules in the data heterogeneous rule base includes:
[0019] Based on the business rules in the heterogeneous data rule base, determine the business constraints for each target parameter, including data range division and data association relationships;
[0020] Based on the business constraints of each target parameter, perform data heterogeneous processing on each target parameter;
[0021] Alternatively, the data heterogeneous rules in the data heterogeneous rule base include experience base rules, and the step of performing data heterogeneous processing on each target parameter according to the data heterogeneous rules in the data heterogeneous rule base includes:
[0022] Determine the data category for each of the target parameters;
[0023] Based on the rules in the data heterogeneity rule base, each target parameter is subjected to data heterogeneity processing according to the data format of the corresponding data category.
[0024] In one specific embodiment of this application, generating heterogeneous data includes:
[0025] The Cartesian product is calculated for the changes in the value of each target parameter to obtain heterogeneous data.
[0026] In one specific embodiment of this application, after generating the full-coverage test dataset, the method further includes:
[0027] Based on the set input parameters and the parameter data of the set input parameters, determine the evaluation score of each test data in the full coverage test dataset;
[0028] The set of test data in the full-coverage test dataset whose evaluation scores are greater than a set score threshold is determined as the optimal test dataset.
[0029] In one specific embodiment of this application, after determining the evaluation score of each test data point in the full coverage test dataset, the method further includes:
[0030] The set of the top N test data with the highest evaluation scores in the full coverage test dataset is determined as the limited number of test datasets, where N is the set number.
[0031] In one specific embodiment of this application, after determining the evaluation score of each test data point in the full coverage test dataset, the method further includes:
[0032] Based on the total number of test data items in the full coverage test dataset and the set coverage rate, the set of the top M test data items with the highest evaluation scores in the full coverage test dataset is determined as the limited coverage test dataset, where M is the quotient of the total number of test data items in the full coverage test dataset and the set coverage rate.
[0033] A test dataset generation apparatus, comprising:
[0034] The test object determination module is used to determine the test object;
[0035] The input parameter information acquisition module is used to obtain the input parameter information of the object under test, the input parameter information including the input parameters of the object under test and the target parameters to be heterogeneous in the input parameters of the object under test;
[0036] The heterogeneous data generation module is used to perform data heterogeneous processing on each of the target parameters according to the data heterogeneous rules in the data heterogeneous rule base to generate heterogeneous data;
[0037] The test dataset generation module is used to generate a full-coverage test dataset based on the heterogeneous data and parameter data of other input parameters besides the target parameter.
[0038] A test dataset generation device, comprising:
[0039] Memory, used to store computer programs;
[0040] A processor, configured to implement the steps of the test dataset generation method described above when executing the computer program.
[0041] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the test dataset generation method described in any of the preceding claims.
[0042] By applying the technical solution provided in the embodiments of this application, after determining the object under test and obtaining its input parameter information, data heterogeneity processing can be performed on each target parameter in the input parameter information to be heterogeneously processed according to the data heterogeneity rules in the data heterogeneity rule base, generating heterogeneous data. Based on the heterogeneous data and the parameter data of other input parameters besides the target parameters, a full-coverage test dataset can be generated. By performing data heterogeneity processing on the target parameters in the input parameters of the object under test using the data heterogeneity rules in the heterogeneity rule base, heterogeneous data can be generated quickly and accurately, thereby quickly and accurately obtaining a full-coverage test dataset, which can improve software testing efficiency and the accuracy of software testing results. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 This is a flowchart illustrating the implementation of a test dataset generation method in this application.
[0045] Figure 2 This is a schematic diagram of the structure of a test dataset generation device according to an embodiment of this application;
[0046] Figure 3 This is a schematic diagram of the structure of a test dataset generation device in an embodiment of this application. Detailed Implementation
[0047] The core of this application is to provide a method for generating test datasets. This method can be applied to devices such as terminals and servers with data processing capabilities. After determining the object under test and obtaining its input parameter information, data heterogeneity processing can be performed on each target parameter in the input parameter information to be heterogeneously processed according to the data heterogeneity rule base, generating heterogeneous data. Based on the heterogeneous data and the parameter data of other input parameters besides the target parameters, a full-coverage test dataset is generated. The generated full-coverage test dataset can be provided to users, allowing them to perform various functional and performance tests on the object under test. By using the data heterogeneity rules in the heterogeneity rule base to perform data heterogeneity processing on the target parameters in the input parameters of the object under test, heterogeneous data can be generated quickly and accurately, thereby quickly and accurately obtaining a full-coverage test dataset, which can improve software testing efficiency and the accuracy of software testing results.
[0048] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are merely some embodiments of the present application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0049] See Figure 1 The diagram shown is an implementation flowchart of a test dataset generation method provided in this application embodiment. The method may include the following steps:
[0050] S110: Determine the object to be tested.
[0051] In this embodiment of the application, the object under test may be a REST (Representational State Transfer) interface path, a JSF (Java Server Faces, a standard framework for building Java Web applications) interface fully qualified class name, a function definition, etc.
[0052] The test object can be determined based on the user's actual testing needs. Specifically, a human-computer interaction interface can be provided, where the user can input or select the test object, and the input or selected test object will be designated as the current test object.
[0053] S120: Obtain the input parameter information of the object under test.
[0054] The input parameter information includes the input parameters of the object under test and the target parameters of the input parameters of the object under test that need to be heterogeneous.
[0055] After identifying the object to be tested, the input parameter information of the object to be tested can be obtained.
[0056] The object under test may have multiple input parameters. Some input parameters require data heterogeneity processing and can have multiple values, while others have fixed values. The obtained input parameter information of the object under test can include the input parameters of the object under test and the target parameters of the input parameters to be heterogeneously processed. There can be multiple target parameters to be heterogeneously processed.
[0057] Specifically, the input parameter information of the tested object can be obtained through the human-computer interaction interface. Alternatively, the association between each tested object and the corresponding input parameter information can be established in the database in advance. After the tested object is determined, the input parameter information corresponding to the current tested object can be obtained by querying the database.
[0058] S130: Based on the data heterogeneity rules in the data heterogeneity rule base, perform data heterogeneity processing on each target parameter to generate heterogeneous data.
[0059] In this embodiment, a data heterogeneity rule base can be pre-established. This base can include various data heterogeneity rules, such as data type rules, business rules, and experience base rules. The user-specified heterogeneity rules for the target parameters of the data to be heterogeneously modified can also be obtained through a human-computer interaction interface and added to the data heterogeneity rule base.
[0060] Based on the data heterogeneity rules in the data heterogeneity rule base, each target parameter can be processed to generate heterogeneous data. If the data heterogeneity rule base includes multiple data heterogeneity rules, each target parameter can be processed sequentially based on each data heterogeneity rule to generate heterogeneous data.
[0061] For example, the defined test object is the function `getPerson(Integer age, Long id, String address, Integer vip)`, which has four input parameters: `age`, `id`, `address`, and `vip`. The `age` and `address` parameters are the target parameters for data heterogeneity processing. The specific heterogeneity rule for the target parameter `age` is that it is divided into three data ranges: 0-18, 18-60, and 60-100. This is because the test object will process different logical branches for people under 18 and over 60. When performing data heterogeneity processing on the target parameter `age`, the value of `age` can be 0-18, 18-60, or 60-100.
[0062] S140: Generate a full-coverage test dataset based on heterogeneous data and parameter data of other input parameters besides the target parameter.
[0063] The values of the input parameters other than the target parameter are fixed. According to the data heterogeneity rules in the data heterogeneity rule base, each target parameter is processed for data heterogeneity. After generating heterogeneous data, a full-coverage test dataset can be generated based on the heterogeneous data and the parameter data of the input parameters other than the target parameter.
[0064] For example, the object under test has four input parameters: A, B, C, and D. A and B are the target parameters to be heterogeneous, while the values of input parameters C and D are fixed, namely c and d, respectively. Based on the data heterogeneity rules in the data heterogeneity rule base, data heterogeneity processing is performed on each target parameter, generating the following heterogeneous data:
[0065]
[0066] After generating heterogeneous data, the full-coverage test dataset generated based on the heterogeneous data and the parameter data of input parameters C and D is as follows:
[0067]
[0068] The generated full-coverage test dataset can be provided to users so that they can use it to perform various functional and performance tests on the object under test.
[0069] By applying the method provided in the embodiments of this application, after determining the object under test and obtaining its input parameter information, data heterogeneity processing can be performed on each target parameter in the input parameter information to be heterogeneously processed according to the data heterogeneity rules in the data heterogeneity rule base, generating heterogeneous data. Based on the heterogeneous data and the parameter data of other input parameters besides the target parameters, a full-coverage test dataset is generated. By performing data heterogeneity processing on the target parameters in the input parameters of the object under test using the data heterogeneity rules in the heterogeneity rule base, heterogeneous data can be generated quickly and accurately, thereby quickly and accurately obtaining a full-coverage test dataset, which can improve software testing efficiency and the accuracy of software testing results.
[0070] In one embodiment of this application, step S130 may include the following steps:
[0071] Step 1: Determine the priority of heterogeneous rules in the heterogeneous rule base;
[0072] Step 2: Apply each data heterogeneity rule sequentially according to its priority to perform data heterogeneity processing on each target parameter.
[0073] For ease of description, the two steps above will be explained together.
[0074] The data heterogeneity rule base can include various data heterogeneity rules, each with different priorities. The priority of each data heterogeneity rule can be determined based on the user-specified priority obtained through a human-computer interaction interface, or it can be determined according to pre-set priorities.
[0075] After determining the priorities of the heterogeneous rules in the data heterogeneous rule base, each heterogeneous rule can be applied sequentially according to its priority to perform data heterogeneous processing on each target parameter. This ensures that test data that satisfies the higher-priority heterogeneous rules is generated first.
[0076] In one embodiment of this application, the data heterogeneity rules in the data heterogeneity rule base include data type rules, and step S130 may include the following steps:
[0077] Determine the data type of each target parameter, and perform data heterogeneity processing on each target parameter according to the reference value of the corresponding data type based on the data heterogeneity rule library.
[0078] In this embodiment of the application, the data heterogeneity rules in the data heterogeneity rule base include data type rules. The target parameters of the object to be heterogeneously modified have their own corresponding data types, such as integer type, double-precision floating-point type, single-precision floating-point type, string type, etc.
[0079] Data type rules can include reference values for parameters of different data types.
[0080] For example, data type rules specifically include the following:
[0081] For integer type parameters, the reference values are the largest integer, the smallest integer, -1, 0, and 1.
[0082] For parameters of double-precision floating-point type (double type), the reference values are standardized maximum value, standardized minimum value, unstandardized minimum value, positive infinity, negative infinity, NaN (Not a Number), 0.0, etc.
[0083] For string type parameters, the reference values are empty character (string), single whitespace (blank) string, multiple whitespace (blank) string, etc.;
[0084] For floating-point (float) parameters, the reference values are standardized maximum value, standardized minimum value, unstandardized minimum value, positive infinity, negative infinity, NaN, etc.
[0085] For parameters of the long integer type, the reference values are the maximum value, minimum value, 0, etc.
[0086] The data types of each target parameter specified by the user can be obtained through a user-interactive interface, or the data types of each target parameter can be queried through the parameter library.
[0087] Once the data type of each target parameter is determined, data heterogeneity processing can be performed on each target parameter according to the reference values of the corresponding data type, based on the data type rules in the data heterogeneity rule library. This ensures that the values of each target parameter in the generated heterogeneous data conform to the data type rules.
[0088] In one embodiment of this application, the data heterogeneous rules in the data heterogeneous rule base may include business rules, and step S130 may include the following steps:
[0089] The first step: Based on the business rules in the heterogeneous data rule base, determine the business constraints for each target parameter. The business constraints include data range division and data association relationships.
[0090] The second step: Based on the business constraints of each target parameter, perform data heterogeneous processing on each target parameter.
[0091] For ease of description, the two steps above will be explained together.
[0092] In this embodiment of the application, the data heterogeneity rules in the data heterogeneity rule base may include business rules. Based on the business rules in the data heterogeneity rule base, business constraints on each target parameter can be determined. These business constraints may include data range division and data association relationships.
[0093] For example, the business rule for a target parameter might be a data range of 0-18, 18-60, or 60-100, thus limiting the data range division for that target parameter. Another example is when the tested object is the function `getPerson(Integer age, Longid, String address, Integer vip)`, the business rule for the target parameters `age` and `vip` is that only users 18 years and older can obtain a VIP level. That is, the target parameter `vip` is only meaningful when `age` is greater than 18, thus limiting the data association between `age` and `vip`.
[0094] After determining the business constraints for each target parameter based on the business rules in the data heterogeneity rule base, data heterogeneity processing can be performed on each target parameter according to these constraints. This ensures that the values of each target parameter in the generated heterogeneous data conform to the business rules.
[0095] In one embodiment of this application, the heterogeneous rules in the heterogeneous rule base may include experience base rules, and step S130 may include the following steps:
[0096] Step 1: Determine the data category for each target parameter;
[0097] Step 2: Based on the experience base rules in the data heterogeneity rule base, perform data heterogeneity processing on each target parameter according to the data format of the corresponding data category.
[0098] For ease of description, the two steps above will be explained together.
[0099] In this embodiment of the application, the data heterogeneity rules in the data heterogeneity rule base include experience base rules. The target parameters of the object to be heterogeneously modified have their own corresponding data categories, such as string categories, date categories, email categories, name categories, etc.
[0100] The experience base rules can include the data format corresponding to parameters for different data categories.
[0101] For example, experience base rules specifically include the following:
[0102] For parameters of the String category, the data format can be a string containing special characters in the middle / at the beginning / end, such as percent sign, asterisk, backslash, double backslash, etc., or a string containing different encoded characters in the middle / at the beginning / end.
[0103] For parameters related to the date category, the data format can be several forward date data, such as February 28, 2020, or reverse date data, such as February 31, 2020.
[0104] The data categories of each target parameter can be obtained through a user-defined interactive interface, or the data categories of each target parameter can be queried through the parameter library.
[0105] After determining the data category for each target parameter, data heterogeneity processing can be performed on each target parameter according to the data format of the corresponding data category, based on the empirical rules in the data heterogeneity rule base. This ensures that the value of each target parameter in the generated heterogeneous data conforms to the empirical rules.
[0106] It should be noted that the above are only specific examples of various data heterogeneity rules and do not constitute a limitation on the data heterogeneity rules in the embodiments of this application. More data heterogeneity rules can be set according to actual test scenarios and / or business needs.
[0107] In one embodiment of this application, step S130 may include the following steps:
[0108] The Cartesian product is calculated for the changes in the values of each target parameter to obtain heterogeneous data.
[0109] In this embodiment, after determining the object under test and obtaining its input parameter information, data heterogeneity processing is performed on each target parameter in the input parameters of the object under test according to the data heterogeneity rule base. This yields a complete set of data combinations for all possible scenarios generated along the entire path. By calculating the Cartesian product of the values of each target parameter, heterogeneous data can be obtained. Based on this heterogeneous data and the parameter data of other input parameters besides the target parameters, a full-coverage test dataset can be generated.
[0110] In one embodiment of this application, after generating the full-coverage test dataset, the method may further include the following steps:
[0111] The first step: Based on the set input parameters and the parameter data of the set input parameters, determine the evaluation score of each test data in the full coverage test dataset;
[0112] The second step is to determine the set of test data in the full-coverage test dataset whose evaluation scores are greater than the set score threshold as the optimal test dataset.
[0113] For ease of description, the two steps above will be explained together.
[0114] In this embodiment of the application, after generating a full-coverage test dataset based on heterogeneous data and parameter data of other input parameters besides the target parameter, the generated full-coverage test dataset can be output to the user so that the user can use the full-coverage test dataset to perform corresponding functional and performance tests on the object under test.
[0115] However, because a full-coverage test dataset contains a large number of test data entries, testing the object under test using a full-coverage test dataset will require a long testing time and a significant amount of testing effort. Therefore, in practical applications, users can issue commands to generate different test datasets based on the actual testing scenario or testing requirements.
[0116] Upon receiving a user's instruction to generate the optimal dataset, the system can determine the evaluation score for each test data point in the full-coverage test dataset based on the set input parameters and their parameter data. Input parameters can be specified by the user through a human-computer interaction interface or set using historical test data. These input parameters are considered to have a significant impact on the test results of the tested object; different values of these parameters will have varying degrees of influence on the test results. Following the same evaluation rules, each test data point in the full-coverage test dataset is evaluated to obtain an evaluation score.
[0117] For each test data point, the higher the evaluation score, the greater the impact of that test data point on the test results of the tested object. Using that test data to test the tested object makes it easier to obtain accurate test results.
[0118] A score threshold can be preset, and test data with scores greater than the preset score threshold can be selected from the full coverage test dataset. The combination of the selected test data is then determined as the optimal test dataset.
[0119] The optimal test dataset can be output to users, enabling them to perform functional and performance tests on the object under test. Because the optimal test dataset is selected from the full-coverage test dataset with higher evaluation scores, it has a smaller data volume compared to the full-coverage test dataset, allowing for faster and higher-quality testing of the object under test.
[0120] In one embodiment of this application, after determining the evaluation score for each test data point in the full coverage test dataset, the method may further include the following steps:
[0121] The set of the top N test data with the highest evaluation scores in the full-coverage test dataset is determined as the limited-quantity test dataset, where N is the set quantity.
[0122] In this embodiment, when a user sends a command to generate a limited number of test datasets, after determining the evaluation score of each test data point in the full-coverage test dataset, the top N test data points with the highest evaluation scores are selected from the full-coverage test dataset, and the set of selected test data points is determined as the limited-number test dataset. N is a set quantity, which can be input by the user through a human-computer interaction interface.
[0123] Specifically, the optimal test dataset can be determined first from the full-coverage test dataset, and then a limited number of test datasets can be determined based on the number of test data in the optimal test dataset and the set number.
[0124] Suppose the full coverage test dataset contains 100 test data entries, and the optimal test dataset contains 65. If the required number is 30 (meaning the user needs 30 test data entries), then the 35 lower-scoring test data entries can be subtracted from the optimal test dataset. Similarly, if the required number is 80 (meaning the user needs 80 test data entries), then 15 test data entries can be added to the optimal test dataset. These 15 entries are the higher-scoring test data entries from the full coverage test dataset excluding those from the optimal test dataset.
[0125] A limited number of test datasets can be output to users, allowing them to perform functional and performance tests on the object under test. The total number of test data entries in the limited number of test datasets meets the user's requirements for the number of test data entries. Moreover, the limited number of test datasets are selected from the full-coverage test dataset, resulting in higher evaluation scores. Compared to the full-coverage test dataset, the limited number of test datasets has a smaller data volume, enabling faster and higher-quality testing of the object under test.
[0126] In one embodiment of this application, after determining the evaluation score for each test data point in the full coverage test dataset, the method may further include the following steps:
[0127] Based on the total number of test data items in the full coverage test dataset and the set coverage rate, the set of the top M test data items with the highest evaluation scores in the full coverage test dataset is determined as the limited coverage test dataset, where M is the quotient of the total number of test data items in the full coverage test dataset and the set coverage rate.
[0128] In this embodiment, when a user sends a command to generate a test dataset with a defined coverage rate, after determining the evaluation score of each test data point in the full coverage test dataset, the total number of test data points M to be selected is determined based on the total number of test data points in the full coverage test dataset and the set coverage rate. M is the quotient of the total number of test data points in the full coverage test dataset and the set coverage rate, which can be input by the user through a human-computer interaction interface.
[0129] Select the top M test data with the highest evaluation scores from the full coverage test dataset, and define the set of selected test data as the limited coverage test dataset.
[0130] Specifically, the optimal test dataset can be determined first from the full coverage test dataset, and then the limited coverage test dataset can be determined based on the number of test data in the optimal test dataset and M.
[0131] Assuming the full coverage test dataset contains 100 test data entries and the optimal test dataset contains 65 test data entries, and the coverage rate is set to 90%, then the total number of test data entries to be selected is M = 100 * 90% = 90. 25 test data entries can be added to the optimal test dataset. These 25 test data entries are the higher-scoring test data entries from the full coverage test dataset, excluding those from the optimal test dataset.
[0132] A limited coverage test dataset can be provided to users, enabling them to perform functional and performance tests on the object under test. The test data in the limited coverage test dataset meets the user's coverage requirements, and it also selects test data with higher evaluation scores from the full coverage test dataset. Compared to the full coverage test dataset, the limited coverage test dataset has a smaller data volume, allowing for faster and higher-quality testing of the object under test.
[0133] It's important to note that the optimal test dataset isn't necessarily a dataset with high coverage. The optimal test dataset aims to achieve the maximum test coverage with the minimum amount of test data. If testing time allows, more test cases can be added to minimize missing test data and reduce the likelihood of defects. Finally, the full-coverage test dataset, optimal test dataset, limited-quantity test dataset, or limited-coverage test dataset output to the user can be displayed in JSON (JavaScript Object Notation) format. This method is more flexible, simpler, and facilitates cross-system communication.
[0134] This application embodiment performs data heterogeneity processing on the target parameters of each tested object according to the data heterogeneity rules in the data heterogeneity rule base, so that the final generated full-coverage test dataset has good integrity and completeness.
[0135] Corresponding to the above method embodiments, this application also provides a test dataset generation apparatus. The test dataset generation apparatus described below can be referred to in correspondence with the test dataset generation method described above.
[0136] See Figure 2 As shown, the device may include the following modules:
[0137] The test object determination module 210 is used to determine the test object;
[0138] The input parameter information acquisition module 220 is used to obtain the input parameter information of the object under test. The input parameter information includes the input parameters of the object under test and the target parameters to be heterogeneously processed in the input parameters of the object under test.
[0139] The heterogeneous data generation module 230 is used to perform heterogeneous data processing on each target parameter according to the heterogeneous rules in the heterogeneous data rule base to generate heterogeneous data;
[0140] The test dataset generation module 240 is used to generate a full-coverage test dataset based on heterogeneous data and parameter data of other input parameters besides the target parameter.
[0141] By applying the apparatus provided in this application embodiment, after determining the object under test and obtaining its input parameter information, data heterogeneity processing can be performed on each target parameter in the input parameter information to be heterogeneously processed according to the data heterogeneity rules in the data heterogeneity rule base, generating heterogeneous data. Based on the heterogeneous data and the parameter data of other input parameters besides the target parameters, a full-coverage test dataset is generated. By performing data heterogeneity processing on the target parameters to be heterogeneously processed in the input parameters of the object under test through the data heterogeneity rules in the heterogeneity rule base, heterogeneous data can be generated quickly and accurately, thereby obtaining a full-coverage test dataset quickly and accurately, which can improve software testing efficiency and the accuracy of software testing results.
[0142] In one specific embodiment of this application, the heterogeneous data generation module 230 is used for:
[0143] Determine the priority of heterogeneous rules in the heterogeneous rule base;
[0144] According to the priority of the data heterogeneity rules, each data heterogeneity rule is used in turn to perform data heterogeneity processing on each target parameter.
[0145] In one specific embodiment of this application, the data heterogeneity rules in the data heterogeneity rule base include data type rules, and the heterogeneous data generation module 230 is used for:
[0146] Determine the data type of each target parameter;
[0147] Based on the data type rules in the data heterogeneity rule base, each target parameter is processed for data heterogeneity according to the reference value of the corresponding data type;
[0148] Alternatively, the heterogeneous rules in the heterogeneous rules base include business rules, and the heterogeneous data generation module 230 is used for:
[0149] Based on the business rules in the heterogeneous data rule base, determine the business constraints for each target parameter. The business constraints include data range division and data association relationships.
[0150] Based on the business constraints of each target parameter, perform data heterogeneous processing on each target parameter;
[0151] Alternatively, the heterogeneous rules in the heterogeneous rule base include experience base rules, and the heterogeneous data generation module 230 is used for:
[0152] Determine the data category for each target parameter;
[0153] Based on the rules in the data heterogeneity rule base, each target parameter is processed according to the data format of the corresponding data category.
[0154] In one specific embodiment of this application, the heterogeneous data generation module 230:
[0155] The Cartesian product is calculated for the changes in the values of each target parameter to obtain heterogeneous data.
[0156] In one specific embodiment of this application, the test dataset generation module 240 is further configured to:
[0157] After generating the full coverage test dataset, the evaluation score of each test data in the full coverage test dataset is determined based on the set input parameters and the parameter data of the set input parameters.
[0158] The set of test data in the full-coverage test dataset whose evaluation scores are greater than a set score threshold is determined as the optimal test dataset.
[0159] In one specific embodiment of this application, the test dataset generation module 240 is further configured to:
[0160] After determining the evaluation score of each test data in the full coverage test dataset, the set of the top N test data with the highest evaluation scores in the full coverage test dataset is determined as the limited number of test datasets, where N is the set number.
[0161] In one specific embodiment of this application, the test dataset generation module 240 is further configured to:
[0162] After determining the evaluation score of each test data in the full coverage test dataset, based on the total number of test data in the full coverage test dataset and the set coverage rate, the set of the top M test data with the highest evaluation scores in the full coverage test dataset is determined as the limited coverage test dataset, where M is the quotient of the total number of test data in the full coverage test dataset and the set coverage rate.
[0163] Corresponding to the above method embodiments, this application embodiment also provides a test dataset generation device, including:
[0164] Memory, used to store computer programs;
[0165] A processor is used to implement the steps of the above-described test dataset generation method when executing a computer program.
[0166] like Figure 3 The diagram shows the structural composition of a test dataset generation device. The device may include a processor 10, a memory 11, a communication interface 12, and a communication bus 13. The processor 10, memory 11, and communication interface 12 all communicate with each other via the communication bus 13.
[0167] In this embodiment, the processor 10 may be a central processing unit (CPU), an application-specific integrated circuit, a digital signal processor, a field-programmable gate array, or other programmable logic devices.
[0168] The processor 10 can call the program stored in the memory 11. Specifically, the processor 10 can execute the operations in the embodiment of the test dataset generation method.
[0169] The memory 11 is used to store one or more programs. The programs may include program code, which includes computer operation instructions. In this embodiment, the memory 11 stores at least a program for implementing the following functions:
[0170] Identify the object to be tested;
[0171] Obtain the input parameter information of the object under test, which includes the input parameters of the object under test and the target parameters of the input parameters of the object under test that need to be heterogeneous;
[0172] Based on the data heterogeneity rules in the data heterogeneity rule base, perform data heterogeneity processing on each target parameter to generate heterogeneous data;
[0173] A full-coverage test dataset is generated based on heterogeneous data and parameter data of other input parameters besides the target parameter.
[0174] In one possible implementation, the memory 11 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function (such as human-computer interaction function or data processing function). The data storage area may store data created during use, such as heterogeneous data or parameter data.
[0175] In addition, memory 11 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device.
[0176] Communication interface 12 can be an interface for the communication module, used to connect with other devices or systems.
[0177] Of course, it should be noted that, Figure 3 The structure shown does not constitute a limitation on the test dataset generation device in the embodiments of this application. In practical applications, the test dataset generation device may include devices such as... Figure 3 More or fewer components as shown, or combinations of certain components.
[0178] Corresponding to the above method embodiments, this application embodiment also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described test dataset generation method.
[0179] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0180] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0181] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0182] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the technical solutions and core ideas of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A test data set generation method, characterized by, include: Identify the object to be tested; Obtain the input parameter information of the object under test, the input parameter information including the input parameters of the object under test and the target parameter to be heterogeneous in the input parameters of the object under test; the target parameter is an input parameter with multiple values; Based on the data heterogeneity rules in the data heterogeneity rule base, each of the target parameters is subjected to data heterogeneity processing to generate heterogeneous data; Based on the heterogeneous data and the parameter data of other input parameters besides the target parameter, a full coverage test dataset is generated. The top M test data with the highest evaluation scores are selected from the full coverage test dataset. The set of selected test data is determined as the limited coverage test dataset, where M is the product of the total number of test data in the full coverage test dataset and the set coverage. The data heterogeneity rules in the data heterogeneity rule base include business rules, data type rules, and experience base rules. The data heterogeneity processing for each target parameter includes: Based on the priority of business rules, data type rules, and experience base rules, data heterogeneity processing is performed on each target parameter in sequence: The process of heterogeneous data processing of target parameters based on data type rules is as follows: determine the data type of each target parameter; perform heterogeneous data processing on each target parameter according to the reference value of the corresponding data type based on the data type rules in the data heterogeneous rule library; The process of heterogeneous data processing for target parameters based on business rules is as follows: According to the business rules in the heterogeneous data rule base, the business constraints for each target parameter are determined. The business constraints include data range division and data association relationship. According to the business constraints of each target parameter, the data heterogeneous processing is performed on each target parameter. The process of heterogeneous data processing for target parameters based on experience base rules is as follows: the data category of each target parameter is determined; according to the experience base rules in the data heterogeneous rule base, which include the data forms corresponding to parameters of different data categories, each target parameter is heterogeneously processed according to the data form of the corresponding data category. The process of generating heterogeneous data includes: calculating the Cartesian product of the changes in the values of each of the target parameters to obtain heterogeneous data.
2. The test data set generation method of claim 1, wherein, The step of performing data heterogeneous processing on each target parameter according to the data heterogeneous rule base includes: Determine the priority of heterogeneous rules in the heterogeneous rule base; According to the priority order of the data heterogeneity rules, each data heterogeneity rule is used in turn to perform data heterogeneity processing on each target parameter.
3. The test data set generation method of claim 1 or 2, wherein, Following the generation of the full-coverage test dataset, the following is also included: Based on the set input parameters and the parameter data of the set input parameters, determine the evaluation score of each test data in the full coverage test dataset; The set of test data in the full-coverage test dataset whose evaluation scores are greater than a set score threshold is determined as the optimal test dataset.
4. The test data set generation method of claim 3, wherein, After determining the evaluation score for each test data point in the full-coverage test dataset, the method further includes: The set of the top N test data with the highest evaluation scores in the full coverage test dataset is determined as the limited number of test datasets, where N is the set number.
5. The test data set generation method of claim 3, wherein, After determining the evaluation score for each test data point in the full-coverage test dataset, the method further includes: Based on the total number of test data entries in the full coverage test dataset and the set coverage rate, the set of the top M test data entries with the highest evaluation scores in the full coverage test dataset is determined as the limited coverage test dataset.
6. A test data set generation apparatus characterized by comprising: include: The test object determination module is used to determine the test object; The input parameter information acquisition module is used to obtain the input parameter information of the object under test. The input parameter information includes the input parameters of the object under test and the target parameter to be heterogeneous in the input parameters of the object under test; the target parameter is an input parameter with multiple values. The heterogeneous data generation module is used to perform data heterogeneous processing on each of the target parameters according to the data heterogeneous rules in the data heterogeneous rule base to generate heterogeneous data; The test dataset generation module is used to generate a full-coverage test dataset based on the heterogeneous data and parameter data of other input parameters besides the target parameter. The module selects the top M test data with the highest evaluation scores from the full-coverage test dataset and determines the set of selected test data as the limited coverage test dataset, where M is the product of the total number of test data in the full-coverage test dataset and the set coverage. The heterogeneous data generation module is further configured to: The heterogeneous data rules in the heterogeneous data rule base include business rules, data type rules, and experience base rules; and, based on the business rules, data type rules, and experience base rules, perform heterogeneous data processing on each target parameter in sequence. The process of heterogeneous data processing of target parameters based on data type rules is as follows: determine the data type of each target parameter; according to the data type rules in the data heterogeneous rule library, perform data heterogeneous processing on each target parameter according to the reference value of the corresponding data type; The process of heterogeneous data processing for target parameters based on business rules is as follows: According to the business rules in the heterogeneous data rule base, the business constraints for each target parameter are determined. The business constraints include data range division and data association relationship. According to the business constraints of each target parameter, the data heterogeneous processing is performed on each target parameter. The process of heterogeneous data processing for target parameters based on experience base rules is as follows: the data category of each target parameter is determined; according to the experience base rules in the data heterogeneous rule base, which include the data forms corresponding to parameters of different data categories, each target parameter is heterogeneously processed according to the data form of the corresponding data category. The heterogeneous data generation module is further used to: calculate the Cartesian product of the value changes of each target parameter to obtain heterogeneous data.
7. A test data set generation device, characterized by, include: Memory, used to store computer programs; A processor, configured to implement the steps of the test dataset generation method as described in any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the steps of the test data set generation method in any one of claims 1 to 5.
Citation Information
Patent Citations
Interface input parameter function test method, device, equipment and storage medium
CN110362495A
Automatic testing method and device
CN111984522A