Software testing method, computer device and computer-readable storage medium

By combining and retesting the software's preset test case groups, ensuring overall coverage and fault point detection accuracy, solving the problem of inaccurate test results in existing test methods and improving the reliability of the software.

CN115185827BActive Publication Date: 2025-06-24PING AN BANK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210730531.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-24
Publication Date
2025-06-24
Estimated Expiration
2042-06-24

AI Technical Summary

Technical Problem

When the existing software testing methods are not executed properly, the test results will be inaccurate, which will affect the reliability of the software.

Method used

By obtaining the historical test data of the target software for each preset test case, combining the test cases to ensure the overall coverage is within the preset range, and determining the target test case group based on the number of failure points, retesting is performed to improve the accuracy of the test results.

Benefits of technology

It improves the accuracy of test results and the reliability of the software, ensuring that the software can more comprehensively detect potential failure points before it is launched.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115185827B_ABST
    Figure CN115185827B_ABST
Patent Text Reader

Abstract

The present application discloses a software testing method, a computer device, and a computer-readable storage medium. The method includes: obtaining the historical coverage rate and the number of fault points of each preset test case for the target software; combining multiple preset test cases to obtain multiple test case groups, where the overall coverage rate corresponding to each test case group is within a preset coverage rate range; determining a target test case group among the multiple test case groups according to the total number of fault points corresponding to the test case group; and retesting using multiple preset test cases in the target test case group. By combining multiple test cases into multiple test case groups with similar overall coverage rates, screening out the target test case group with inaccurate test results according to the total number of fault points of each test case group, and retesting, the accuracy of the test results and the reliability of the software are improved in the embodiments of the present application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of software testing, and particularly relates to a software testing method, a computer device, and a computer-readable storage medium. Background Art

[0002] After the testing of software is completed, the software is often directly launched for use. However, the testing process may have situations where test cases are not fully executed, resulting in inaccurate test results. For example, some faults of the software are not detected. In this way, after the software is launched, the reliability of the software is also relatively low. Summary of the Invention

[0003] Embodiments of this application provide a software testing method, a computer device, and a computer-readable storage medium, aiming to improve the accuracy of test results and the reliability of software.

[0004] On the one hand, this application provides a software testing method, including:

[0005] Obtain historical test data of each preset test case for the target software, where the historical test data includes historical coverage rate and the number of detected fault points;

[0006] According to the historical coverage rate of the preset test cases, combine multiple preset test cases to obtain multiple test case groups, where the overall coverage rate corresponding to each test case group is within a preset coverage rate range;

[0007] Determine the total number of fault points corresponding to the test case group according to the number of fault points corresponding to multiple preset test cases in the test case group;

[0008] Determine the target test case group among multiple test case groups according to the total number of fault points;

[0009] Use multiple preset test cases in the target test case group to retest the target software, and obtain the retest result of the target test case group for the target software.

[0010] In some embodiments, the step of determining the target test case group among multiple test case groups according to the total number of fault points includes:

[0011] Obtain the average value of the total number of fault points among the total number of fault points corresponding to multiple test case groups;

[0012] Among multiple test case groups, determine the first test case group corresponding to the total number of fault points that is less than the average value of the total number of fault points;

[0013] Determine the target test case group among the multiple first test case groups.

[0014] In some embodiments, the step of determining the target test case group among the multiple first test case groups includes:

[0015] Obtain a first difference between the average number of fault points and the total number of fault points corresponding to the first test case group;

[0016] Determine the target test case group among the multiple first test case groups according to the first difference.

[0017] In some embodiments, the step of determining the target test case group among the multiple first test case groups according to the first difference includes:

[0018] Obtain an average coverage rate among the overall coverage rates corresponding to the multiple test case groups;

[0019] Determine a second difference between the overall coverage rate corresponding to the first test case group and the average coverage rate;

[0020] Use the second difference to correct the first difference;

[0021] When the corrected first difference is greater than a first preset threshold, use the first test case group corresponding to the corrected first difference as the target test case group.

[0022] In some embodiments, after the step of obtaining the average number of fault points among the total numbers of fault points corresponding to the multiple test case groups, the following is further included:

[0023] Among the multiple test case groups, determine a second test case group corresponding to the total number of fault points that is greater than or equal to the average number of fault points;

[0024] Obtain a third difference between the total number of fault points corresponding to the second test case group and the average number of fault points;

[0025] When the third difference is greater than a second preset threshold, use the second test case group corresponding to the third difference as the target test case group, where the second preset threshold is greater than the first preset threshold.

[0026] In some embodiments, after the step of obtaining the average number of fault points among the total numbers of fault points corresponding to the multiple test case groups, the following is further included:

[0027] Obtain an average coverage rate among the overall coverage rates corresponding to the multiple test case groups;

[0028] Associate and store the average coverage rate with the average number of fault points to determine the corresponding relationship between the coverage rate and the number of fault points;

[0029] When receiving a control instruction including the target number of fault points, based on the corresponding relationship, determine the target coverage rate corresponding to the target number of fault points;

[0030] According to the historical coverage rate of the preset test cases, combine multiple preset test cases to obtain a test case group with the overall coverage rate being the target coverage rate;

[0031] Use the test case group with the overall coverage rate being the target coverage rate to retest the target software.

[0032] In some embodiments, the step of associating and storing the average coverage rate with the average number of fault points to determine the corresponding relationship between the coverage rate and the number of fault points includes:

[0033] Associate and store the average coverage rate with the average number of fault points;

[0034] After obtaining multiple groups of associated and stored average coverage rates and average numbers of fault points, fit a curve according to the multiple groups of associated and stored average coverage rates and average numbers of fault points to obtain a change curve between the coverage rate and the number of fault points, where the corresponding relationship includes the change curve.

[0035] In some embodiments, the step of combining multiple preset test cases according to the historical coverage rate of the preset test cases to obtain multiple test case groups includes:

[0036] Obtain the covered code corresponding to the historical coverage rate of multiple preset test cases;

[0037] Deduplicate the covered code corresponding to multiple preset test cases to obtain the sum of the covered code corresponding to multiple preset test cases;

[0038] According to the sum of the covered code corresponding to multiple preset test cases, determine the overall coverage rate corresponding to multiple preset test cases to obtain the test case group.

[0039] On the other hand, an embodiment of the present application provides a software testing device, and the software testing device includes:

[0040] An acquisition module, configured to acquire historical test data of each preset test case for the target software, where the historical test data includes the historical coverage rate and the number of detected fault points;

[0041] A combination module, configured to combine a plurality of the preset test cases according to the historical coverage rate of the preset test cases, so as to obtain a plurality of test case groups, wherein the overall coverage rate corresponding to each of the test case groups is within a preset coverage rate range;

[0042] A determination module, configured to determine the total number of fault points corresponding to a test case group according to the number of fault points corresponding to a plurality of preset test cases in the test case group; and determine a target test case group from the plurality of test case groups according to the total number of fault points;

[0043] A test module, configured to retest the target software by using a plurality of preset test cases in the target test case group, so as to obtain a retest result of the target test case group for the target software.

[0044] In some embodiments, the determination module is specifically configured to:

[0045] Obtain an average value of fault points among the total numbers of fault points corresponding to the plurality of test case groups;

[0046] In the plurality of test case groups, determine a first test case group corresponding to the total number of fault points that is less than the average value of fault points;

[0047] Determine a target test case group from the plurality of first test case groups.

[0048] In some embodiments, the determination module is specifically configured to:

[0049] Obtain a first difference between the average value of fault points and the total number of fault points corresponding to the first test case group;

[0050] Determine a target test case group from the plurality of first test case groups according to the first difference.

[0051] In some embodiments, the determination module is specifically configured to:

[0052] Obtain an average value of coverage rates among the overall coverage rates corresponding to the plurality of test case groups;

[0053] Determine a second difference between the overall coverage rate corresponding to the first test case group and the average value of coverage rates;

[0054] Use the second difference to correct the first difference;

[0055] When the corrected first difference is greater than a first preset threshold, use the first test case group corresponding to the corrected first difference as the target test case group.

[0056] In some embodiments, the determination module is specifically configured to:

[0057] Among the multiple test case groups, determine a second test case group corresponding to the total number of fault points greater than or equal to the average value of the fault points;

[0058] Obtain a third difference between the total number of fault points corresponding to the second test case group and the average value of the fault points;

[0059] When the third difference is greater than a second preset threshold, use the second test case group corresponding to the third difference as the target test case group, where the second preset threshold is greater than the first preset threshold.

[0060] In some embodiments, the determining module is specifically configured to:

[0061] Obtain an average coverage rate among the overall coverage rates corresponding to the multiple test case groups;

[0062] Associate and store the average coverage rate and the average value of the fault points to determine the corresponding relationship between the coverage rate and the number of fault points;

[0063] When receiving a control instruction including a target number of fault points, based on the corresponding relationship, determine a target coverage rate corresponding to the target number of fault points;

[0064] According to the historical coverage rate of the preset test cases, combine the multiple preset test cases to obtain a test case group with an overall coverage rate of the target coverage rate;

[0065] Use the test case group with an overall coverage rate of the target coverage rate to retest the target software.

[0066] In some embodiments, the determining module is specifically configured to:

[0067] Associate and store the average coverage rate and the average value of the fault points;

[0068] After obtaining multiple groups of associated and stored average coverage rates and average values of fault points, fit a curve according to the multiple groups of associated and stored average coverage rates and average values of fault points to obtain a change curve between the coverage rate and the number of fault points, where the corresponding relationship includes the change curve.

[0069] In some embodiments, the combining module is specifically configured to:

[0070] Obtain the covered code corresponding to the historical coverage rates of the multiple preset test cases;

[0071] Deduplicate the covered code corresponding to the multiple preset test cases to obtain the sum of the covered code corresponding to the multiple preset test cases;

[0072] Determine the overall coverage rate corresponding to multiple preset test cases based on the sum of the covered codes corresponding to the multiple preset test cases, so as to obtain the test case group.

[0073] On the other hand, the present application also provides a computer device, which includes:

[0074] One or more processors;

[0075] A memory; and

[0076] One or more applications, wherein the one or more applications are stored in the memory and are configured to be executed by the processor to implement the steps in the test method of any one of the above-mentioned software.

[0077] On the other hand, the present application also provides a computer-readable storage medium, on which a computer program is stored, and the computer program is loaded by a processor to execute the steps in the test method of any one of the above-mentioned software.

[0078] The test method, computer device and computer-readable storage medium for software provided by the embodiments of the present application. The method includes: obtaining historical test data of each preset test case for the target software, where the historical test data includes historical coverage rate and the number of fault points detected; combining multiple preset test cases according to the historical coverage rate of the preset test cases to obtain multiple test case groups, where the overall coverage rate corresponding to each test case group is within a preset coverage rate range; determining the total number of fault points corresponding to the test case group according to the number of fault points corresponding to the multiple preset test cases in the test case group; determining the target test case group among the multiple test case groups according to the total number of fault points; and retesting the target software with the multiple preset test cases in the target test case group to obtain the retest result of the target test case group for the target software. By combining multiple test cases into multiple test case groups with similar overall coverage rates, screening out the target test case group with inaccurate test results according to the total number of fault points of each test case group, and retesting, the present application improves the accuracy of the test result and the reliability of the software. Description of the Drawings

[0079] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can be obtained according to these drawings.

[0080] Figure 1It is a schematic flowchart of an embodiment of the software testing method provided in the embodiments of the present application;

[0081] Figure 2 It is another schematic flowchart of an embodiment of the software testing method provided in the embodiments of the present application;

[0082] Figure 3 It is yet another schematic flowchart of an embodiment of the software testing method provided in the embodiments of the present application;

[0083] Figure 4 It is still another schematic flowchart of an embodiment of the software testing method provided in the embodiments of the present application;

[0084] Figure 5 It is a schematic structural diagram of an embodiment of the software testing device provided in the embodiments of the present application;

[0085] Figure 6 It is a schematic terminal structure diagram of an embodiment of the computer device provided in the embodiments of the present application. Detailed implementation manners

[0086] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present application.

[0087] In the description of the present application, it should be understood that the terms "center", "longitudinal", "transverse", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus cannot be understood as a limitation to the present application. In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of the described features. In the description of the present application, "a plurality" means two or more, unless otherwise specifically defined.

[0088] In this application, the term "exemplary" is used to mean "serving as an example, illustration, or instance". Any embodiment described as "exemplary" in this application is not necessarily to be construed as more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use this application. In the following description, details are set forth for the purpose of explanation. It should be understood that the ordinary skilled person in the art can recognize that this application can be implemented without the use of these specific details. In other instances, well-known structures and processes are not elaborated in detail to avoid obscuring the description of this application with unnecessary details. Therefore, this application is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.

[0089] It should be noted that since the method of the embodiment of this application is executed in a computer device, the processing objects of each computer device exist in the form of data or information. For example, time, which is actually time information. It can be understood that in subsequent embodiments, if dimensions, quantities, positions, etc. are mentioned, they are all corresponding data existences for the computer device to process, and specific details are not elaborated here.

[0090] The embodiment of this application provides a method for allocating materials, a computer device, and a computer-readable storage medium, which will be described in detail below respectively.

[0091] Refer to Figure 1 , in one embodiment, the software testing method includes:

[0092] 101. Obtain the historical test data of each preset test case for the target software, where the historical test data includes historical coverage rate and the number of fault points detected.

[0093] In this embodiment, the target software is the unlaunched software to be tested. Multiple preset test cases are generated in advance for each function and business of the target software. By executing each preset test case on the target software, it is detected whether there are fault points in the corresponding functions and businesses of the target software. After testing the target software with each preset test case, the obtained test results are used as historical test data. The historical test data includes at least the historical coverage rate of each preset test case for the target software and the number of fault points obtained by testing the target software with each preset test case. Among them, the fault point data can be zero, which means that no fault occurs when the target software is tested with this preset test case. The historical test data can be obtained through the output of a coverage tool. It can be understood that the function points of the target software tested by each preset test user are different, and the corresponding coverage rate and fault point data may also be different. The coverage rate refers to the coverage range of the designed test cases relative to the requirements. The coverage rate of the test cases is calculated according to the tested function points. At the code level, this indicator is reflected by the execution ratio and execution frequency of the executed code after execution.

[0094] 102. Combine multiple preset test cases according to the historical coverage rate of the preset test cases to obtain multiple test case groups, where the overall coverage rate corresponding to each test case group is within the preset coverage rate range;

[0095] In this embodiment, after obtaining the historical coverage rate of each preset test case, multiple preset test cases can be combined according to the coverage range corresponding to the historical coverage rate to obtain multiple test case groups with similar overall coverage rates. Among them, each test case group can include multiple preset test cases, and the overall coverage rate corresponding to each test case group corresponds to the comprehensive coverage range corresponding to the historical coverage rates of the multiple preset test cases in the test case group.

[0096] In some embodiments, when combining multiple preset test cases, since the coverage ranges corresponding to the historical coverage rates of different preset test cases are different, multiple preset test cases can be selected for combination according to the preset coverage rate range to obtain a test case group whose overall coverage rate is within the preset coverage rate range. For example, combine the preset test case with a historical coverage rate of 85%, the preset test case with a historical coverage rate of 88%, and the preset test case with a historical coverage rate of 83% to obtain a test case group with an overall coverage rate of 90%. Among them, the preset coverage rate range can be obtained according to the preset coverage rate. For example, when the preset coverage rate is 90%, the preset coverage rate range can be [88, 92]%. By setting the preset coverage rate range, the overall coverage rates corresponding to each test case group are made similar.

[0097] 103. Determine the total number of fault points corresponding to the test case group according to the number of fault points corresponding to multiple preset test cases in the test case group;

[0098] In this embodiment, after obtaining multiple test case groups, since the overall coverage rates corresponding to each test case group are close, the total number of fault points corresponding to each test case group is generally also close. Therefore, for each test case group, obtain the number of fault points corresponding to all test cases in this test case group, remove duplicates for the fault points corresponding to the number of fault points to eliminate duplicate faults among them. After deduplication, count the number of all fault points to obtain the total number of fault points corresponding to the test case group.

[0099] 104. Determine the target test case group among multiple test case groups according to the total number of fault points;

[0100] 105. Retest the target software using multiple preset test cases in the target test case group to obtain the retest result of the target test case group for the target software.

[0101] In this embodiment, after obtaining the total number of fault points corresponding to each test case group, according to the differences between the total numbers of fault points corresponding to different test case groups, the target test case group among multiple test case groups can be determined, and it is determined that the test result corresponding to the target test case group is inaccurate. For the target test case group with inaccurate test results, use all preset test cases in this target test case group to retest the target software in sequence to determine whether the test result is indeed incorrect and improve the accuracy of the test result.

[0102] In the technical solution disclosed in this embodiment, by combining multiple test cases into multiple test case groups with similar overall coverage rates, screening out the target test case group with inaccurate test results according to the total number of fault points of each test case group, and performing retesting, the accuracy of the test result and the reliability of the software are improved.

[0103] In another embodiment, as Figure 2 shown, based on the embodiment shown in Figure 1 the step 104 includes:

[0104] 201. Obtain the average value of fault points among the total numbers of fault points corresponding to multiple test case groups;

[0105] In this embodiment, when determining the target test case group according to the differences between the total numbers of fault points corresponding to different test case groups, the average value of the fault points between the total numbers of fault points corresponding to multiple test case groups can be calculated, and it is determined whether the total number of fault points corresponding to each test case group is too high or too low according to the average value of the fault points. Specifically, the total numbers of fault points corresponding to all test case groups are summed up and then divided by the total number of test case groups to obtain the average value of the fault points.

[0106] 202. Among the multiple test case groups, determine the first test case group corresponding to the total number of fault points that is less than the average value of the fault points.

[0107] 203. Determine the target test case group among the multiple first test case groups.

[0108] In this embodiment, the total number of fault points corresponding to each test case group is compared with the average value of the fault points respectively to screen out the total number of fault points that is less than the average value of the fault points, and the test case group corresponding to the total number of fault points that is less than the average value of the fault points is used as the first test case group. It can be understood that since the total number of fault points corresponding to the first test case group is less than the average value of the fault points, there may be preset test cases that are not executed in place in the first test case group. Therefore, the target test case group can be further determined in the first test case group.

[0109] In some embodiments, after determining the first test case group, the first test case group can also be directly used as the target test case group for retesting.

[0110] In some embodiments, in the step of determining the target test case group among the multiple first test case groups, the difference between the average value of the fault points and the total number of fault points corresponding to the first test case group can be obtained and used as the first difference. According to the magnitude of the first difference, it is determined whether the corresponding first test case group is the target test case group. For example, when the first difference is greater than the first preset threshold, it is considered that the difference between the corresponding first test case group and other test case groups is relatively large, so the first test case can be used as the target test case group. When the first difference is less than or equal to the first preset threshold, it is considered that the difference between the corresponding first test case group and other test case groups is relatively small, so the first test case is not used as the target test case group.

[0111] In some embodiments, since the overall coverage of different test case groups is not exactly the same, it may affect the determination of the target test case. Therefore, when determining the target test case group among multiple first test case groups based on the first difference, the overall coverage corresponding to all test case groups can also be summed and averaged to obtain the average coverage, or the overall coverage corresponding to all first test case groups can be summed and averaged to obtain the average coverage. For a single first test case group, the second difference between the overall coverage corresponding to the first test case group and the average coverage is calculated, and the first difference is corrected using the second difference. If the corrected first difference is greater than the first preset threshold, the first test case group corresponding to the corrected first difference is used as the target test case group. If the corrected first difference is less than or equal to the first preset threshold, the first test case group corresponding to the corrected first difference is not used as the target test case group. In this way, the determination of the target test case group can be made more accurate.

[0112] In some embodiments, when the second difference is used to modify the first difference, the second difference may be multiplied by a preset conversion coefficient to obtain a correction amount corresponding to the second difference, and the sum of the first difference and the correction amount is used as the modified first difference. The preset conversion coefficient may be set according to actual needs and is not limited here.

[0113] In some embodiments, in the step of determining the target test case group among the multiple first test case groups according to the first difference, a first score corresponding to the first difference can also be obtained, and a second score of the first test case group in the software function or software business dimension can be obtained, and the first score and the second score are weighted and summed to obtain a third score corresponding to the first test case group, and the target test case group among the multiple first test case groups is determined according to the third score, so as to take into account the difference in the total number of fault points and the importance of the software function or software business tested by the test case. Among them, the first score is positively correlated with the first difference.

[0114] In some embodiments, when determining a target test case group among multiple first test case groups based on a third score, the multiple first test case groups can be sorted from high to low according to the third score, and at least one first test case group with a high ranking can be used as the target test case group.

[0115] In some embodiments, when obtaining the second score of the first test case group in terms of software functions or software services, since different preset test cases test different functions or services of the target software, the target software can be divided in advance according to software functions or services to obtain multiple software functions or services, and corresponding fourth scores are set according to the importance of the software functions or services. The higher the importance, the higher the corresponding fourth score. In this way, the fourth score corresponding to the software function or service tested by the preset test case can be used as the fourth score corresponding to the preset test case, and the sum of the fourth scores corresponding to all the preset test cases in the first test case group is used as the second score of the first test case group in terms of software functions or software services.

[0116] In some embodiments, after step 201, the total number of fault points corresponding to each test case group can be compared with the average number of fault points respectively to filter out the total number of fault points that is greater than or equal to the average number of fault points, and the test case group corresponding to the total number of fault points that is greater than or equal to the average number of fault points is used as the second test case group. It can be understood that since the total number of fault points corresponding to the second test case group is greater than or equal to the average number of fault points, there may be preset test cases with abnormal tests in the second test case group. Therefore, the target test case group can be further determined in the second test case group.

[0117] In some embodiments, in the step of determining the target test case group in the second test case group, for a single second test case group, the third difference between the total number of fault points corresponding to the second test case group and the average number of fault points can be obtained. When the third difference is greater than the second preset threshold, the second test case group corresponding to the third difference is used as the target test case group. When the third difference is less than or equal to the second preset threshold, the second test case group corresponding to the third difference is not used as the target test case group. The second preset threshold is greater than the first preset threshold to filter out the second test cases with too high total number of fault points and the first test cases with too low total number of fault points.

[0118] In the technical solution disclosed in this embodiment, the average number of fault points among the total numbers of fault points corresponding to multiple test case groups is obtained, the first test case group corresponding to the total number of fault points less than the average number of fault points is determined among the multiple test case groups, and the target test case group is determined among the multiple first test case groups, realizing the screening of the target test case group whose test results may be inaccurate.

[0119] In yet another embodiment, as Figure 3 shown, on the basis of any of the embodiments shown in Figures 1 to 2 , after step 201, it further includes:

[0120] 301. Obtain the average coverage rate among the overall coverage rates corresponding to multiple test case groups;

[0121] 302. Associatively store the average coverage rate and the average number of fault points to determine the corresponding relationship between the coverage rate and the number of fault points;

[0122] In this embodiment, since the overall coverage rates of different test case groups are not exactly the same, the average coverage rate among the overall coverage rates corresponding to multiple test case groups can be obtained, and the average coverage rate and the average number of fault points are stored associatively as a set of data. After obtaining multiple sets of associatively stored average coverage rates and average number of fault points, the corresponding relationship between the coverage rate and the number of fault points can be summarized based on these multiple sets.

[0123] In some embodiments, the average coverage rate can be used as the independent variable and the average number of fault points as the dependent variable. In a two-dimensional plane rectangular coordinate system, multiple coordinate points can be determined based on multiple sets of associatively stored average coverage rates and average number of fault points. By fitting a curve to the multiple coordinate points, the change curve between the coverage rate and the number of fault points can be obtained, where the coverage rate is the independent variable and the failure rate is the dependent variable. The corresponding relationship between the coverage rate and the number of fault points includes this change curve.

[0124] 303. When receiving a control instruction containing the target number of fault points, based on the corresponding relationship, determine the target coverage rate corresponding to the target number of fault points;

[0125] In this embodiment, the target number of fault points is the expected value of the number of fault points, and software testers can trigger a control instruction containing the target number of fault points. Based on the change curve in the above corresponding relationship, the coordinate point corresponding to the target number of fault points can be determined on the change curve, and the coverage rate corresponding to this coordinate point is used as the target coverage rate.

[0126] 304. Combine multiple preset test cases according to the historical coverage rate of the preset test cases to obtain a test case group with an overall coverage rate of the target coverage rate;

[0127] 305. Retest the target software using the test case group with an overall coverage rate of the target coverage rate.

[0128] In this embodiment, after determining the target coverage rate, multiple preset test cases can be combined according to the target coverage rate to obtain at least one test case group. Among them, the overall coverage rate of the test case group is the target coverage rate. After retesting the target software in sequence with all the preset test cases in the test case group with the overall coverage rate as the target coverage rate, the total number of fault points included in the test results will approach the target number of fault points. In this way, the total number of fault points included in the test results can be controlled by a control instruction containing the target number of fault points, so that the total number of fault points included in the test results approaches the expected value. During the software testing process, the target number of fault points can be determined according to the actual progress requirements to adjust the total number of fault points included in the test results. When the testing and optimization progress of multiple test project groups is inconsistent, the total number of fault points included in the test results can be reduced or increased to slow down or speed up the testing and optimization progress, so that the testing and optimization progress of multiple test project groups is kept consistent, facilitating the arrangement of test optimization work.

[0129] In the technical solution disclosed in this embodiment, the corresponding relationship between the coverage rate and the number of fault points is determined. According to the specified target number of fault points, the corresponding target coverage rate is determined, and a test case group with the overall coverage rate as the target coverage rate is generated. In this way, the test results based on the test case group with the overall coverage rate as the target coverage rate can approach the target number of fault points, facilitating the control of the testing and optimization progress.

[0130] In another embodiment, as Figure 4 shown, on the basis of any of the embodiments shown, step 102 includes: Figures 1 to 3

[0131] 401. Obtain the covered code corresponding to the historical coverage rate of multiple said preset test cases;

[0132] In this embodiment, the test data output by the coverage tool may include the coverage rate and the covered code corresponding to the coverage rate. Therefore, the covered code corresponding to the historical coverage rate of multiple preset test cases can be determined according to the output of the coverage tool. Among them, the covered code is the code that has been tested in the target software when testing the target software with the preset test cases. The covered code represents the coverage range of the preset test cases for the target software.

[0133] 402. Remove duplicates from the covered code corresponding to multiple said preset test cases to obtain the sum of the covered code corresponding to multiple said preset test cases;

[0134] 403. Determine the overall coverage rate corresponding to multiple said preset test cases according to the sum of the covered code corresponding to multiple said preset test cases to obtain the test case group.​

[0135] In this embodiment, since there may be overlapping parts in the covered code corresponding to different preset test cases, when calculating the overall coverage rate corresponding to multiple preset test cases, the covered code corresponding to multiple preset test cases can be de-duplicated to remove the overlapping parts therein, so as to obtain the sum of the covered code corresponding to multiple preset test cases. Calculating the percentage of the sum of the covered code corresponding to multiple preset test cases in the total number of codes of the target software can obtain the overall coverage rate corresponding to multiple preset test cases. By setting the preset coverage rate range, a test case group with the overall coverage rate within the preset coverage rate range can be obtained through the combination of multiple preset test cases.

[0136] In the technical solution disclosed in this embodiment, when calculating the overall coverage rate of a test case group, the covered code corresponding to multiple preset test cases can be de-duplicated, so that the overall coverage rate of the test case group is closer to the real coverage rate.

[0137] To better implement the software testing method in the embodiments of the present application, on the basis of the software testing method, the embodiments of the present application also provide a software testing device, as Figure 5 shown. The software testing device 500 includes an acquisition module 501, a combination module 502, a determination module 503, and a testing module 504, specifically as follows:

[0138] The acquisition module 501 is configured to acquire historical test data of each preset test case for the target software, where the historical test data includes historical coverage rate and the number of fault points detected;

[0139] The combination module 502 is configured to combine multiple preset test cases according to the historical coverage rate of the preset test cases to obtain multiple test case groups, where the overall coverage rate corresponding to each test case group is within the preset coverage rate range;

[0140] The determination module 503 is configured to determine the total number of fault points corresponding to the test case group according to the number of fault points corresponding to multiple preset test cases in the test case group; and determine the target test case group among multiple test case groups according to the total number of fault points;

[0141] The testing module 504 is configured to re-test the target software by using multiple preset test cases in the target test case group to obtain the re-test result of the target test case group for the target software.

[0142] The embodiments of the present application also provide a computer device, which integrates any software testing device provided in the embodiments of the present application. As Figure 6As shown, it shows a schematic structural diagram of a computer device involved in an embodiment of the present application. Specifically:

[0143] The computer device may include components such as a processor 601 with one or more processing cores, a memory 602 of one or more computer-readable storage media, a power supply 603, and an input unit 604. Those skilled in the art can understand that Figure 6 the structural diagram of the computer device shown in [the figure] does not limit the computer device. It may include more or fewer components than shown, or combine certain components, or have different component arrangements. Among them:

[0144] The processor 601 is the control center of the computer device, connecting various parts of the entire computer device through various interfaces and lines. By running or executing software programs and / or modules stored in the memory 602, and calling data stored in the memory 602, it executes various functions of the computer device and processes data, thereby monitoring the computer device as a whole. Optionally, the processor 601 may include one or more processing cores; preferably, the processor 601 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor may not be integrated into the processor 601.

[0145] The memory 602 can be used to store software programs and modules. The processor 601 executes various functional applications and data processing by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area. Among them, the program storage area can store the operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the computer device. In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices. Correspondingly, the memory 602 may also include a memory controller to provide the processor 601 with access to the memory 602.

[0146] The computer device also includes a power supply 603 that powers each component. Preferably, the power supply 603 can be logically connected to the processor 601 through a power management system, so as to manage functions such as charging, discharging, and power consumption management through the power management system. The power supply 603 may also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.

[0147] The computer device may further include an input unit 604, which may be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.

[0148] Although not shown, the computer device may further include a display unit and the like, which will not be elaborated here. Specifically, in this embodiment, the processor 601 in the computer device will load the executable files corresponding to the processes of one or more application programs into the memory 602 according to the following instructions, and the processor 601 will run the application programs stored in the memory 602 to implement various functions as follows:

[0149] Obtain the historical test data of each preset test case for the target software, where the historical test data includes historical coverage rate and the number of fault points detected;

[0150] Combine multiple preset test cases according to the historical coverage rate of the preset test cases to obtain multiple test case groups, where the overall coverage rate corresponding to each test case group is within the preset coverage rate range;

[0151] Determine the total number of fault points corresponding to the test case group according to the number of fault points corresponding to the multiple preset test cases in the test case group;

[0152] Determine the target test case group among the multiple test case groups according to the total number of fault points;

[0153] Retest the target software using the multiple preset test cases in the target test case group to obtain the retest result of the target test case group for the target software.

[0154] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by controlling related hardware through instructions. The instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0155] Therefore, an embodiment of the present application provides a computer-readable storage medium, which may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc. A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in any software testing method provided by the embodiments of the present application. For example, the computer program loaded by the processor can execute the following steps:

[0156] Obtain the historical test data of each preset test case for the target software, where the historical test data includes historical coverage rate and the number of fault points detected;

[0157] Combine multiple preset test cases according to the historical coverage rate of the preset test cases to obtain multiple test case groups, where the overall coverage rate corresponding to each test case group is within the preset coverage rate range;

[0158] Determine the total number of fault points corresponding to the test case group according to the number of fault points corresponding to the multiple preset test cases in the test case group;

[0159] Determine the target test case group among the multiple test case groups according to the total number of fault points;

[0160] Retest the target software using the multiple preset test cases in the target test case group to obtain the retest result of the target test case group for the target software.

[0161] In the above embodiments, the descriptions of each embodiment have their own focuses. For the parts not detailed in a certain embodiment, reference can be made to the detailed descriptions of other embodiments above, and they will not be elaborated here.

[0162] In specific implementation, the above units or structures can be implemented as independent entities, or can be combined arbitrarily to be implemented as the same or several entities. The specific implementation of the above units or structures can refer to the method embodiments above, and will not be elaborated here.

[0163] The specific implementation of the above operations can refer to the previous embodiments, and will not be elaborated here.

[0164] The above has introduced in detail a software testing method, computer device and computer-readable storage medium provided by the embodiments of the present application. Specific examples are used in this article to elaborate the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.

Claims

1. A software testing method, characterized in that Including: Obtain historical test data of each preset test case for the target software, where the historical test data includes historical coverage rate and the number of detected fault points; Combine multiple preset test cases according to the historical coverage rate of the preset test cases to obtain multiple test case groups, where the overall coverage rate corresponding to each test case group is within a preset coverage rate range; Determine the total number of fault points corresponding to the test case group according to the number of fault points corresponding to multiple preset test cases in the test case group; Determine the target test case group among multiple test case groups according to the total number of fault points; Retest the target software using multiple preset test cases in the target test case group to obtain the retest result of the target test case group for the target software; The step of determining the target test case group among multiple test case groups according to the total number of fault points includes: obtaining the average value of the total number of fault points among the total number of fault points corresponding to multiple test case groups; determining, among multiple test case groups, the first test case group corresponding to the total number of fault points less than the average value of the total number of fault points; obtaining the first difference between the average value of the total number of fault points and the total number of fault points corresponding to the first test case group; determining the target test case group among multiple first test case groups according to the first difference.

2. The testing method of the software according to claim 1, characterized in that, The step of determining the target test case group among multiple first test case groups according to the first difference includes: Obtaining the average value of the overall coverage rates among the overall coverage rates corresponding to multiple test case groups; Determining the second difference between the overall coverage rate corresponding to the first test case group and the average value of the coverage rates; Using the second difference to correct the first difference; When the corrected first difference is greater than the first preset threshold, using the first test case group corresponding to the corrected first difference as the target test case group.

3. The software testing method according to claim 1, characterized in that, After the step of obtaining the average value of the total number of fault points among the total number of fault points corresponding to multiple test case groups, it further includes: Determining, among multiple test case groups, the second test case group corresponding to the total number of fault points greater than or equal to the average value of the total number of fault points; Obtaining the third difference between the total number of fault points corresponding to the second test case group and the average value of the total number of fault points; When the third difference is greater than the second preset threshold, using the second test case group corresponding to the third difference as the target test case group, where the second preset threshold is greater than the first preset threshold.

4. The software testing method according to claim 1, characterized in that, After the step of obtaining the average value of the total number of fault points among the total number of fault points corresponding to multiple test case groups, it further includes: Obtaining the average value of the overall coverage rates among the overall coverage rates corresponding to multiple test case groups; Associatively storing the average value of the coverage rates and the average value of the total number of fault points to determine the corresponding relationship between the coverage rate and the number of fault points; When receiving a control instruction including the target number of fault points, determining the target coverage rate corresponding to the target number of fault points based on the corresponding relationship; Combining a plurality of the preset test cases according to the historical coverage rate of the preset test cases to obtain a test case group with an overall coverage rate being the target coverage rate; Retesting the target software by using the test case group with an overall coverage rate being the target coverage rate.

5. The software testing method according to claim 4, characterized in that The step of associatively storing the average coverage rate and the average number of fault points to determine the corresponding relationship between the coverage rate and the number of fault points includes: Associatively storing the average coverage rate and the average number of fault points; After obtaining multiple groups of associatively stored average coverage rates and average numbers of fault points, fitting a curve according to the multiple groups of associatively stored average coverage rates and average numbers of fault points to obtain a change curve between the coverage rate and the number of fault points, wherein the corresponding relationship includes the change curve.

6. The software testing method according to claim 1, characterized in that The step of combining a plurality of the preset test cases according to the historical coverage rate of the preset test cases to obtain a plurality of test case groups includes: Obtaining the covered code corresponding to the historical coverage rate of a plurality of the preset test cases; Performing deduplication processing on the covered code corresponding to a plurality of the preset test cases to obtain the total covered code corresponding to a plurality of the preset test cases; Determining the overall coverage rate corresponding to a plurality of the preset test cases according to the total covered code corresponding to a plurality of the preset test cases to obtain the test case group.

7. A computer device, characterized in that, The computer device includes: One or more processors; A memory; and One or more applications, wherein the one or more applications are stored in the memory and are configured to be executed by the processor to implement the steps in the software testing method according to any one of claims 1 to 6.

8. A computer-readable storage medium, characterized in that, A computer program is stored thereon, and the computer program is loaded by the processor to execute the steps in the software testing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and device for generating test case

    CN101984416A

  • Method and system for testing nuclear power safety level instrument control system priority module and nuclear power equipment

    CN106598025A