Test data verification and purification method, device, system and medium in test case
By establishing an input and output mapping table and data supplement mechanism, we can solve the problem of insufficient coverage of test cases, realize multi-scene coverage and quality improvement of test cases, and reduce application exceptions.
Patent Information
- Application Number
- CN202211137120.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-19
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2042-09-19
AI Technical Summary
The lack of coverage data scenarios and too small number of test cases in the prior art lead to insufficient program robustness, affecting user experience and production problems.
By obtaining the input value data set and preset output value data set of the current test case, establishing an input and output mapping table, judging the missing data and supplementing the missing data, calculating the proportion and similarity, filtering data with low similarity, and realizing multi-scene coverage and data purification of the test case.
Automatically obtain input and output items of the test case, fill in missing data areas, improve the coverage and quality of the test case, reduce the probability of application abnormalities, and improve user experience.
Smart Images

Figure CN115454859B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, system and medium for verifying and purifying test data in a test case. Background Art
[0002] A test case is a description of the testing tasks for a specific software product, embodying the test plan, methods, techniques, and strategies. The quantity and quality of test cases have a significant impact on application testing. Failure to cover data scenarios or a small number of test cases can lead to insufficient program robustness, potentially causing customer experience issues or even serious production problems. Therefore, verifying and refining test cases is crucial.
[0003] Therefore, how to verify and purify test cases, improve the quality of test cases, reduce the probability of application exceptions, and enhance the user experience is a technical problem that needs to be solved in this field. Summary of the Invention
[0004] In view of this, this Summary of the Invention section is provided to briefly introduce the concepts that will be described in detail in the Detailed Description of the Invention section below. This Summary of the Invention section is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0005] The purpose of this application is to provide a method, device, system and medium for verifying and purifying test data in test cases, which can verify and purify test cases, improve the quality of test cases, reduce the probability of application exceptions, and enhance the user experience.
[0006] To achieve the above objectives, this application has the following technical solutions:
[0007] In a first aspect, an embodiment of the present application provides a method for verifying and purifying test data in a test case, comprising:
[0008] Obtaining an input value data set and a preset output value data set of a current test case; wherein the preset output value data set corresponds to a plurality of the input value data sets;
[0009] Establishing an input-output mapping table between the input value data set and the preset output value data set;
[0010] extracting preset function data of the preset output value data set;
[0011] Intersecting the input prompt rule of the preset function data with the input rule to obtain a character string rule;
[0012] Determine whether the input value data set is missing data according to a string rule;
[0013] When data is missing, the missing data of the input value data set is supplemented to obtain input value expansion data; the input-output mapping table is queried to obtain the preset input data corresponding to the preset function data;
[0014] Inputting the input value expansion data into the current test case a preset number of times to obtain each first output data set, and calculating the ratio of the number of identical data in each first output data to the total number of each first output data as a first ratio;
[0015] Inputting the preset input data into the current test case a preset number of times to obtain respective second output data sets, and calculating the ratio of the number of identical data in each second output data to the total number of each second output data as a second ratio;
[0016] When the first ratio is greater than the second ratio, the input value expansion data is compared with the existing input data for similarity, and the input value expansion data with similarity less than a preset threshold is filtered to obtain final expansion data to supplement the current test case;
[0017] When the second ratio is greater than the first ratio, the preset input data is compared with the existing input data for similarity, and the preset input data with similarity less than a preset threshold is filtered to obtain final expanded data to supplement the input value data set of the current test case.
[0018] In a possible implementation, querying the input-output mapping table to obtain the preset input data corresponding to the preset function data includes:
[0019] Querying the input-output mapping table to obtain each initial input data corresponding to the preset function data;
[0020] The input data log of the current test case is queried and accessed, and the data that appears the most times in the input data log among the various initial input data is used as the preset input data.
[0021] In a possible implementation, determining whether data in the input value data set is missing according to a string rule includes:
[0022] Get the character length of the string rule;
[0023] Obtaining the character length of the input value data set;
[0024] If the character length of the input value data set is less than the character length of the character string rule, the input value data set is missing.
[0025] In a possible implementation, the method further includes:
[0026] When it is determined according to the character string rule that the input value data set data is not missing, the current test case is executed.
[0027] In a second aspect, an embodiment of the present application provides a device for verifying and purifying test data in a test case, comprising:
[0028] An acquisition unit, configured to acquire an input value data set and a preset output value data set of a current test case; the preset output value data set corresponds to a plurality of the input value data sets;
[0029] an establishing unit, configured to establish an input-output mapping table between the input value data set and the preset output value data set;
[0030] an extraction unit, configured to extract the preset function data of the preset output value data set;
[0031] An intersection unit, configured to obtain a character string rule by intersecting the input prompt rule of the preset function data with the input rule;
[0032] A checking unit, configured to determine whether the input value data set is missing data according to a string rule;
[0033] An expansion unit, configured to, when data is missing, supplement the missing data of the input value data set to obtain input value expansion data; and query the input-output mapping table to obtain preset input data corresponding to the preset function data;
[0034] a first proportion unit, configured to input the input value expansion data into the current test case a preset number of times to obtain respective first output data sets, and calculate a ratio of the number of identical data in the respective first output data to the total number of the respective first output data as a first ratio;
[0035] a second proportion unit, configured to input the preset input data into the current test case a preset number of times to obtain respective second output data sets, and calculate a ratio of the number of identical data in each second output data to the total number of each second output data as a second ratio;
[0036] a first purification unit, configured to compare the input value expansion data with the existing input data for similarity when the first ratio is greater than the second ratio, filter the input value expansion data with a similarity less than a preset threshold, and obtain final expansion data to supplement the current test case;
[0037] The second purification unit is used to compare the preset input data with the existing input data for similarity when the second ratio is greater than the first ratio, filter the preset input data with a similarity less than a preset threshold, and obtain the final expanded data to supplement the input value data set of the current test case.
[0038] In a possible implementation, the expansion unit is specifically configured to:
[0039] Querying the input-output mapping table to obtain each initial input data corresponding to the preset function data;
[0040] The input data log of the current test case is queried and accessed, and the data that appears the most times in the input data log among the various initial input data is used as the preset input data.
[0041] In a possible implementation, the inspection unit is specifically configured to:
[0042] Get the character length of the string rule;
[0043] Obtaining the character length of the input value data set;
[0044] If the character length of the input value data set is less than the character length of the character string rule, the input value data set is missing.
[0045] In a possible implementation, the method further includes:
[0046] The execution unit is configured to execute the current test case when it is determined according to the string rule that the input value data set data is not missing.
[0047] In a third aspect, an embodiment of the present application provides a system for verifying and purifying test data in a test case, comprising:
[0048] memory for storing computer programs;
[0049] A processor is configured to implement the steps of the test data verification and purification method in the test case described above when executing the computer program.
[0050] In a fourth aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, which, when processed and executed, implements the steps of the test data verification and purification method in the test case described above.
[0051] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0052] The embodiment of the present application provides a method, device, system and medium for verifying and purifying test data in a test case, the method comprising: obtaining an input value data set and a preset output value data set of a current test case, wherein the preset output value data set corresponds to a plurality of input value data sets; establishing an input-output mapping table between the input value data set and the preset output value data set; extracting preset function data of the preset output value data set; intersecting the input prompt rule of the preset function data with the input rule to obtain a string rule; judging whether the input value data set is missing data according to the string rule; when data is missing, supplementing the missing data of the input value data set to obtain input value expansion data; querying the input-output mapping table to obtain preset input data corresponding to the preset function data; inputting the input value expansion data into the current test case according to a preset number of times to obtain each A first output data set is obtained, and the ratio of the number of identical data in each first output data to the total number of each first output data is calculated as the first ratio; the preset input data is input into the current test case according to the preset number of times to obtain each second output data set, and the ratio of the number of identical data in each second output data to the total number of each second output data is calculated as the second ratio; when the first ratio is greater than the second ratio, the input value expansion data is compared with the existing input data for similarity, and the input value expansion data with similarity less than a preset threshold is filtered to obtain the final expansion data to supplement the current test case; when the second ratio is greater than the first ratio, the preset input data is compared with the existing input data for similarity, and the preset input data with similarity less than a preset threshold is filtered to obtain the final expansion data to supplement the input value data set of the current test case. In this way, the input items and output items of the test case can be automatically obtained, and the areas with missing data can be filled and purified after verification, so as to achieve multi-scenario coverage of the input item values of the test case, improve the coverage of the test case, and enhance the quality of the test. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0054] The above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale.
[0055] Figure 1 A flowchart of a method for verifying and purifying test data in a test case provided by an embodiment of the present application is shown;
[0056] Figure 2 A schematic diagram of a test data verification and purification device in a test case provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0057] It should be noted that the test data verification and purification method, device, system, and medium provided by the present invention can be applied to the big data or financial fields. The above is merely illustrative and does not limit the application areas of the test data verification and purification method, device, system, and medium provided by the present invention.
[0058] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0059] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Other terms are defined in the following description.
[0060] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0061] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".
[0062] As described in the background, the applicant's research reveals that a test case is a description of a test task for a specific software product, embodying the test plan, method, technique, and strategy. The quantity and quality of test cases significantly impact application testing. Insufficient test case coverage and a small number of test cases can lead to insufficient program robustness, potentially causing customer experience issues or even serious production problems. Therefore, verifying and refining test cases is crucial.
[0063] Therefore, how to verify and purify test cases, improve the quality of test cases, reduce the probability of application exceptions, and enhance the user experience is a technical problem that needs to be solved in this field.
[0064] In order to solve the above technical problems, the embodiments of the present application provide a method, device, system and medium for verifying and purifying test data in a test case, the method comprising: obtaining an input value data set and a preset output value data set of a current test case, wherein the preset output value data set corresponds to a plurality of input value data sets; establishing an input-output mapping table between the input value data set and the preset output value data set; extracting the preset function data of the preset output value data set; taking the intersection of the input prompt rule of the preset function data and the input rule to obtain a string rule; judging whether the input value data set is missing data according to the string rule; when the data is missing, supplementing the missing data of the input value data set to obtain input value expansion data; querying the input-output mapping table to obtain the preset input data corresponding to the preset function data; and inputting the input value expansion data into the current test case according to a preset number of times. The case obtains each first output data set, calculates the ratio of the number of identical data in each first output data to the total number of each first output data, and uses this ratio as the first ratio; inputs the preset input data into the current test case a preset number of times to obtain each second output data set, and calculates the ratio of the number of identical data in each second output data to the total number of each second output data, and uses this ratio as the second ratio; when the first ratio is greater than the second ratio, the input value expansion data is compared with the existing input data for similarity, and the input value expansion data with similarity less than a preset threshold is filtered to obtain the final expansion data to supplement the current test case; when the second ratio is greater than the first ratio, the preset input data is compared with the existing input data for similarity, and the preset input data with similarity less than a preset threshold is filtered to obtain the final expansion data to supplement the input value data set of the current test case. In this way, the input items and output items of the test case can be automatically obtained, and the areas with missing data can be filled and purified after verification, so as to achieve coverage of multiple scenarios such as the input item values of the test case, improve the coverage of the test case, and enhance the quality of the test.
[0065] Exemplary Methods
[0066] See also Figure 1 FIG. 1 is a flow chart of a method for verifying and purifying test data in a test case provided in an embodiment of the present application, including:
[0067] S101: Acquire an input value data set and a preset output value data set of a current test case; the preset output value data set corresponds to a plurality of the input value data sets.
[0068] In an embodiment of the present application, you can first obtain the test cases imported into the test case library, read the "Operation Instructions Column" and "Input Value" options, and obtain the input data according to the template method, such as "Manually enter XXX", "Enter XXX in the input box", "Fill in XXX", etc., to obtain the input value data set A.
[0069] In addition, you can also obtain a preset output value data set, which corresponds to multiple input value data sets. That is, you can read the "expected output result" option to obtain output value set B.
[0070] S102: Establishing an input-output mapping table between the input value data set and the preset output value data set.
[0071] In an embodiment of the present application, an input-output mapping table may be established between an input value data set and a preset output value data set.
[0072] Specifically, all input value data sets A can be summarized according to the preset output value data set, and the summary results can be stored in the result set C, where the key of C is the set B and the value is the combination of A. For the same output B, the value is summarized and stored in the form of a list, that is, an input-output mapping table between A and B is established.
[0073] S103: extracting preset function data of the preset output value data set.
[0074] In the embodiment of the present application, the preset output value data set may be traversed to obtain the preset function data in the preset output value data set.
[0075] For example, you can traverse the keys of result set C, obtain the keys of the same function, and merge the values; that is, the preset function data can include B1, B1 can correspond to the values A1, A2 and A3, and the corresponding A1, A2 and A3 can be merged.
[0076] S104: Intersecting the input prompt rule of the preset function data with the input rule to obtain a character string rule.
[0077] In the embodiment of the present application, the input prompt rule of the preset function data and the input rule may be intersected to obtain the character string rule.
[0078] For example, the input rule may be "Please enter an English nickname", the input prompt rule may be "Please enter an 8-character nickname", and the resulting transaction string rule may be "Please enter an 8-character English nickname".
[0079] Specifically, for the input prompt rules of the preset function data, a prompt rule library of the preset function data can be established so that it can be directly called from the prompt rule library later to improve efficiency. For the obtained string rules, a final matching rule library can be obtained so that it can be directly called from the matching rule library later to improve efficiency.
[0080] S105: Determine whether the input value data set is missing data according to a character string rule.
[0081] In the embodiment of the present application, in order to determine whether data needs to be expanded, it is possible to first determine whether the input value data set is missing data based on the string rule. That is, the interval coverage rate of the input value data set can be counted.
[0082] Specifically, the character length of the string rule may be obtained, and the character length of the input value data set may be obtained. If the character length of the input value data set is less than the character length of the string rule, data in the input value data set is missing.
[0083] For example, you can calculate other types in set A to get a missing item list m, match and record the value range of specific values in set A for string rules, and obtain the interval coverage statistics n. If m is empty and the number of n is the length of the interval, execute the current test case; otherwise, perform subsequent expansion and purification operations.
[0084] S106: When data is missing, supplement the missing data of the input value data set to obtain input value expansion data; query the input-output mapping table to obtain the preset input data corresponding to the preset function data.
[0085] In the embodiment of the present application, expansion and purification operations are performed only when data is missing. When data is not missing, expansion and purification operations are not required, thereby saving costs.
[0086] Specifically, when data is missing, the missing data of the input value data set can be supplemented to obtain input value expansion data; and the input-output mapping table can be queried to obtain preset input data corresponding to the preset function data.
[0087] For example, the coverage in result n can be calculated for non-compliant items. For example, if the test case coverage does not include the critical value or median, the case data can be expanded by using log acquisition + automatic rule base generation. Log acquisition is to query the log record items of the function or similar functions to obtain the string input value with the highest access frequency, that is, the input-output mapping table can be queried to obtain the preset input data corresponding to the preset function data.
[0088] Specifically, the input-output mapping table can be queried to obtain each initial input data corresponding to the preset functional data; the input data log of the current test case can be queried to take the data that appears most frequently in the input data log among each initial input data as the preset input data.
[0089] The rule base is automatically generated to automatically assemble common characters or dictionaries according to the length limit of the string, and randomly generate a string of a specific length. The randomly generated string of a specific length can include missing data of the input value data set so that the missing data of the input value data set can be supplemented to obtain input value expansion data.
[0090] Therefore, the data set of input values is expanded to cover the data missing scenarios of the test cases, or to supplement the insufficient number of test cases.
[0091] S107: Inputting the input value expansion data into the current test case a preset number of times to obtain each first output data set, and calculating the ratio of the number of identical data in each first output data to the total number of each first output data as a first ratio;
[0092] S108: Inputting the preset input data into the current test case a preset number of times to obtain respective second output data sets, and calculating a ratio of the number of identical data in each second output data to the total number of each second output data as a second ratio;
[0093] In an embodiment of the present application, in order to calculate the stability of the case results, the input value expansion data can be input into the current test case according to a preset number of times to obtain each first output data set, and the ratio of the number of identical data in each first output data to the total number of each first output data is calculated as the first ratio.
[0094] Input the preset input data into the current test case a preset number of times to obtain each second output data set, and calculate the ratio of the number of identical data in each second output data to the total number of each second output data as the second ratio.
[0095] That is, in order to obtain accurate and stable test results, the expanded data can be purified so that the most stable expanded data can be used to finally supplement the test case.
[0096] For example, if A1 is input into the test case 100 times and the same result is output 99 times, then the first ratio can be 99%. If A2 is input into the test case 100 times and the same result is output 98 times, then the second ratio can be 98%. In this case, the stability of A1 is greater than that of A2, and data with higher stability is preferentially used for expansion.
[0097] S109: When the first ratio is greater than the second ratio, the input value expansion data is compared with the existing input data for similarity, and the input value expansion data with similarity less than a preset threshold is filtered to obtain final expansion data to supplement the current test case.
[0098] S110: When the second ratio is greater than the first ratio, the preset input data is compared with the existing input data for similarity, and the preset input data with similarity less than a preset threshold is filtered to obtain final expanded data to supplement the input value data set of the current test case.
[0099] In this embodiment of the present application, after initial stability testing, the input data can be further purified. When the first ratio is greater than the second ratio, the input value expansion data is compared with the existing input data for similarity, and the input value expansion data with similarity less than a preset threshold is filtered out to obtain the final expansion data to supplement the current test case.
[0100] When the second ratio is greater than the first ratio, the preset input data is compared with the existing input data for similarity, and the preset input data with similarity less than a preset threshold is filtered to obtain the final expanded data to supplement the input value data set of the current test case.
[0101] That is, the similarity comparison between the input character and the existing input can be weighted, and the results with low similarity can be filtered out to finally obtain incremental test case input, thereby improving the quality of the final supplementary data, reducing the probability of application exceptions, and improving the user experience.
[0102] The embodiment of the present application provides a method for verifying and purifying test data in a test case, the method comprising: obtaining an input value data set and a preset output value data set of a current test case, wherein the preset output value data set corresponds to a plurality of input value data sets; establishing an input-output mapping table between the input value data set and the preset output value data set; extracting preset function data of the preset output value data set; intersecting the input prompt rule of the preset function data with the input rule to obtain a string rule; judging whether the input value data set is missing data according to the string rule; when data is missing, supplementing the missing data of the input value data set to obtain input value expansion data; querying the input-output mapping table to obtain preset input data corresponding to the preset function data; inputting the input value expansion data into the current test case according to a preset number of times to obtain each first output The method comprises the following steps: first, calculating the ratio of the number of identical data in each first output data to the total number of each first output data; inputting the preset input data into the current test case a preset number of times to obtain each second output data set; calculating the ratio of the number of identical data in each second output data to the total number of each second output data set as the second ratio; when the first ratio is greater than the second ratio, performing a similarity comparison between the input value expansion data and the existing input data, filtering the input value expansion data with a similarity less than a preset threshold, and obtaining the final expansion data to supplement the current test case; when the second ratio is greater than the first ratio, performing a similarity comparison between the preset input data and the existing input data, filtering the preset input data with a similarity less than a preset threshold, and obtaining the final expansion data to supplement the input value data set of the current test case. In this way, the input items and output items of the test case can be automatically obtained, and after verification, the areas with missing data can be filled and purified to achieve coverage of multiple scenarios such as the input item values of the test case, thereby improving the coverage of the test case and enhancing the quality of the test.
[0103] Exemplary devices
[0104] See also Figure 2 FIG. 1 is a schematic diagram of a test data inspection and purification device in a test case provided in an embodiment of the present application, comprising:
[0105] The acquisition unit 201 is configured to acquire an input value data set and a preset output value data set of a current test case; the preset output value data set corresponds to a plurality of the input value data sets;
[0106] An establishing unit 202 is configured to establish an input-output mapping table between the input value data set and the preset output value data set;
[0107] An extraction unit 203 is configured to extract the preset function data of the preset output value data set;
[0108] An intersection unit 204 is configured to obtain a character string rule by intersecting the input prompt rule of the preset function data with the input rule;
[0109] A checking unit 205 is configured to determine whether the input value data set is missing data according to a string rule;
[0110] The expansion unit 206 is configured to supplement the missing data of the input value data set to obtain input value expansion data when data is missing; query the input-output mapping table to obtain the preset input data corresponding to the preset function data;
[0111] A first proportion unit 207 is configured to input the input value expansion data into the current test case a preset number of times to obtain each first output data set, and calculate the ratio of the number of identical data in each first output data to the total number of each first output data as a first ratio;
[0112] A second proportion unit 208 is configured to input the preset input data into the current test case a preset number of times to obtain respective second output data sets, and calculate a ratio of the number of identical data in each second output data to the total number of each second output data as a second ratio;
[0113] A first purification unit 209 is configured to compare the input value expansion data with the existing input data for similarity when the first ratio is greater than the second ratio, filter the input value expansion data with similarity less than a preset threshold, and obtain final expansion data to supplement the current test case;
[0114] The second purification unit 210 is used to compare the preset input data with the existing input data for similarity when the second ratio is greater than the first ratio, filter the preset input data with a similarity less than a preset threshold, and obtain the final expanded data to supplement the input value data set of the current test case.
[0115] In a possible implementation, the expansion unit is specifically configured to:
[0116] Querying the input-output mapping table to obtain each initial input data corresponding to the preset function data;
[0117] The input data log of the current test case is queried and accessed, and the data that appears the most times in the input data log among the various initial input data is used as the preset input data.
[0118] In a possible implementation, the inspection unit is specifically configured to:
[0119] Get the character length of the string rule;
[0120] Obtaining the character length of the input value data set;
[0121] If the character length of the input value data set is less than the character length of the character string rule, the input value data set is missing.
[0122] In a possible implementation, the method further includes:
[0123] The execution unit is configured to execute the current test case when it is determined according to the string rule that the input value data set data is not missing.
[0124] The embodiment of the present application provides a device for verifying and purifying test data in a test case, and a method applied to the device includes: obtaining an input value data set and a preset output value data set of a current test case, wherein the preset output value data set corresponds to a plurality of input value data sets; establishing an input-output mapping table between the input value data set and the preset output value data set; extracting preset function data of the preset output value data set; intersecting the input prompt rule of the preset function data with the input rule to obtain a string rule; judging whether the input value data set is missing data according to the string rule; when data is missing, supplementing the missing data of the input value data set to obtain input value expansion data; querying the input-output mapping table to obtain preset input data corresponding to the preset function data; inputting the input value expansion data into the current test case according to a preset number of times to obtain each An output data set is generated, and the ratio of the number of identical data in each first output data to the total number of each first output data is calculated as a first ratio; preset input data is input into the current test case a preset number of times to obtain each second output data set, and the ratio of the number of identical data in each second output data to the total number of each second output data is calculated as a second ratio; when the first ratio is greater than the second ratio, the input value expansion data is compared with the existing input data for similarity, and the input value expansion data with similarity less than a preset threshold is filtered to obtain the final expansion data to supplement the current test case; when the second ratio is greater than the first ratio, the preset input data is compared with the existing input data for similarity, and the preset input data with similarity less than a preset threshold is filtered to obtain the final expansion data to supplement the input value data set of the current test case. In this way, the input and output items of the test case can be automatically obtained, and after verification, the missing data areas are filled and purified, so as to achieve multi-scenario coverage of the test case input item values, improve the coverage of the test case, and enhance the quality of the test.
[0125] Based on the above embodiments, the present application provides a system for verifying and purifying test data in a test case, including:
[0126] memory for storing computer programs;
[0127] A processor is configured to implement the steps of the test data verification and purification method in the above-mentioned test case when executing the computer program.
[0128] Based on the above embodiments, an embodiment of the present application further provides a computer-readable medium having a computer program stored thereon, which, when processed and executed, implements the steps of the test data verification and purification method in the above test case.
[0129] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0130] The computer-readable medium may be included in the system, or may exist independently without being incorporated into the system.
[0131] In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program including program code for executing the methods shown in the flowcharts.
[0132] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences from the other embodiments. In particular, the device embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.
[0133] The above is only a preferred embodiment of the present application. Although the present application has been disclosed as a preferred embodiment, it is not intended to limit the present application. Any technician familiar with the art can use the above-disclosed methods and technical contents to make many possible changes and modifications to the technical solution of the present application without departing from the scope of the technical solution of the present application, or modify it into an equivalent embodiment with equivalent changes. Therefore, any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present application without departing from the content of the technical solution of the present application are still within the scope of protection of the technical solution of the present application.
Claims
1. A method for verifying and purifying test data in a test case, characterized in that: include: Obtain the input value data set and the preset output value data set of the current test case; The preset output value data set corresponds to a plurality of the input value data sets; Establishing an input-output mapping table between the input value data set and the preset output value data set; extracting preset function data of the preset output value data set; Intersecting the input prompt rule of the preset function data with the input rule to obtain a character string rule; Determine whether the input value data set is missing data according to a string rule; When data is missing, the missing data of the input value data set is supplemented to obtain input value expansion data; the input-output mapping table is queried to obtain the preset input data corresponding to the preset function data; Inputting the input value expansion data into the current test case a preset number of times to obtain each first output data set, and calculating the ratio of the number of identical data in each first output data to the total number of each first output data as a first ratio; Inputting the preset input data into the current test case a preset number of times to obtain respective second output data sets, and calculating the ratio of the number of identical data in each second output data to the total number of each second output data as a second ratio; When the first ratio is greater than the second ratio, the input value expansion data is compared with the existing input data for similarity, and the input value expansion data with similarity less than a preset threshold is filtered to obtain final expansion data to supplement the current test case; When the second ratio is greater than the first ratio, the preset input data is compared with the existing input data for similarity, and the preset input data with similarity less than a preset threshold is filtered to obtain final expanded data to supplement the input value data set of the current test case.
2. The method according to claim 1, characterized in that The querying the input-output mapping table to obtain the preset input data corresponding to the preset function data includes: Querying the input-output mapping table to obtain each initial input data corresponding to the preset function data; The input data log of the current test case is queried and accessed, and the data that appears the most times in the input data log among the various initial input data is used as the preset input data.
3. The method according to claim 1, characterized in that The determining, based on a string rule, that data in the input value data set is missing includes: Get the character length of the string rule; Obtaining the character length of the input value data set; If the character length of the input value data set is less than the character length of the character string rule, the input value data set is missing.
4. The method according to claim 1, wherein Also includes: When it is determined according to the character string rule that the input value data set data is not missing, the current test case is executed.
5. A device for checking and purifying test data in a test case, characterized in that: include: An acquisition unit, used to acquire an input value data set and a preset output value data set of a current test case; The preset output value data set corresponds to a plurality of the input value data sets; an establishing unit, configured to establish an input-output mapping table between the input value data set and the preset output value data set; an extraction unit, configured to extract the preset function data of the preset output value data set; An intersection unit, configured to obtain a character string rule by intersecting the input prompt rule of the preset function data with the input rule; A checking unit, configured to determine whether the input value data set is missing data according to a string rule; An expansion unit, configured to, when data is missing, supplement the missing data of the input value data set to obtain input value expansion data; and query the input-output mapping table to obtain preset input data corresponding to the preset function data; a first proportion unit, configured to input the input value expansion data into the current test case a preset number of times to obtain respective first output data sets, and calculate a ratio of the number of identical data in the respective first output data to the total number of the respective first output data as a first ratio; a second proportion unit, configured to input the preset input data into the current test case a preset number of times to obtain respective second output data sets, and calculate a ratio of the number of identical data in each second output data to the total number of each second output data as a second ratio; a first purification unit, configured to compare the input value expansion data with the existing input data for similarity when the first ratio is greater than the second ratio, filter the input value expansion data with a similarity less than a preset threshold, and obtain final expansion data to supplement the current test case; The second purification unit is used to compare the preset input data with the existing input data for similarity when the second ratio is greater than the first ratio, filter the preset input data with a similarity less than a preset threshold, and obtain the final expanded data to supplement the input value data set of the current test case.
6. The device according to claim 5, characterized in that The expansion unit is specifically used for: Querying the input-output mapping table to obtain each initial input data corresponding to the preset function data; The input data log of the current test case is queried and accessed, and the data that appears the most times in the input data log among the various initial input data is used as the preset input data.
7. The device according to claim 5, characterized in that The inspection unit is specifically used for: Get the character length of the string rule; Obtaining the character length of the input value data set; If the character length of the input value data set is less than the character length of the character string rule, the input value data set is missing.
8. The device according to claim 5, characterized in that Also includes: The execution unit is configured to execute the current test case when it is determined according to the string rule that the input value data set data is not missing.
9. A test data verification and purification system in a test case, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the test data verification and purification method in the test case according to any one of claims 1 to 4 when executing the computer program.
10. A computer-readable medium, characterized in that The computer readable medium stores a computer program, which, when processed and executed, implements the steps of the test data verification and purification method in the test case according to any one of claims 1 to 4.
Citation Information
Patent Citations
Big data test case generation method and device
CN112988603A
Test case generation method and device
CN113360405A