Test case selection method and apparatus, device, and storage medium

By analyzing test execution data, determining the impact of test cases and selecting appropriate test cases, we solve the problem of excessive workload caused by the diversity of test equipment and use cases, improve testing efficiency and effectiveness, and ensure the comprehensiveness of testing. .

WO2024183510A1PCT designated stage expired Publication Date: 2024-09-12HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD

Patent Information

Application Number
PCT/CN2024/074720
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-06
Filing Date
2024-01-30
Publication Date
2024-09-12

AI Technical Summary

Technical Problem

In the field of information and communication technology, due to the diversity of test equipment and test cases during software testing, the testing workload explodes. Manual selection of test cases easily affects the comprehensiveness of the test, making it difficult to complete the test efficiently.

Method used

By obtaining the test execution data of the target program, determine the impact of different operating environment types on the test case results. Based on the data of the benchmark test equipment, select test cases that meet the result impact conditions to test the target program and save the work of the test equipment. duration, and determine the relationship between component models and test cases through the BOM information database and initial test execution data to improve testing efficiency.

Benefits of technology

It realizes the selection of appropriate test cases on different test equipment, improves test efficiency and effectiveness, shortens test time, and ensures comprehensive testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024074720_12092024_PF_FP_ABST
    Figure CN2024074720_12092024_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application relate to the technical field of information and communications, and disclosed are a test case selection method and apparatus, a device, and a storage medium. According to the method, result influence degrees of different runtime environment types on test cases are determined by means of historical test execution data of a target program. Furthermore, some corresponding test cases can be selected for different test devices according to the determined result influence degrees, so as to test the target program. In this way, the objective of accurately selecting the test cases can be achieved by determining some test cases having strong correlation with a target runtime environment type. Additionally, a target runtime environment type corresponding to any test device is determined, and for the test case having a small result influence degree under the target runtime environment type, the test comprehensiveness is not affected even if the test case does not run on the test device. Therefore, by using the test cases selected in the present solution, related software can be tested more effectively and comprehensively.
Need to check novelty before this filing date? Find Prior Art

Description

Method, device, equipment and storage medium for selecting test cases

[0001] This application claims priority to Chinese patent application No. 202310207443.7 filed on March 6, 2023, entitled “Method, device, equipment and storage medium for selecting test cases”, the entire contents of which are incorporated herein by reference. Technical Field

[0002] The present application relates to the field of information and communication technology, and in particular to a method, apparatus, device and storage medium for selecting a test case. Background Art

[0003] In the field of information and communications technology (ICT), various software and hardware are frequently updated. To discover potential problems with a piece of software, it is necessary to test the software on different test equipment.

[0004] Typically, testing software using all possible test cases on all possible test equipment would result in an explosive workload and would be impossible. Therefore, technicians often rely on experience to select a subset of test equipment and test cases for testing the software.

[0005] However, manual selection of test cases can easily affect the comprehensiveness of the test.

[0006] Summary of the Invention

[0007] To solve the related technical problems, the embodiments of the present application provide a method, apparatus, device, and storage medium for selecting test cases. The technical solution is as follows:

[0008] In a first aspect, a method for selecting test cases is provided, the method comprising: first, obtaining test execution data for a target program; and further, based on the obtained test execution data, determining the degree of impact of different operating environment types on the results of different test cases. When testing the target program on a benchmark test device, all test cases involved in the test execution data can be used. For other test devices, the target operating environment type to which the operating environment parameters that differ between the test device and the benchmark test device belong can be determined. Furthermore, target test cases that meet the result impact criteria can be identified and used to test the target program.

[0009] Each operating environment type includes multiple operating environment parameters.

[0010] The solution shown in the embodiment of the present application, after obtaining the test execution data, can be used to perform statistics on the test results corresponding to each test case in the test execution data to obtain the success rate and failure rate of each test case. The test results corresponding to each operating environment type in the test execution data can be performed to obtain the success rate and failure rate of each test case under each operating environment type. More specifically, the test results corresponding to each operating environment parameter in the test execution data can be performed to obtain the success rate and failure rate of each test case under each operating environment parameter. Further, the result impact of different operating environment types on different test cases can be calculated. When determining the target test cases that meet the result impact condition, the result impact corresponding to the target environment type can be sorted from large to small or from small to large, and the test cases corresponding to the result impact sorted before or after the specified order are determined as target test cases.

[0011] In this way, for different test devices, some test cases can be selected based on specified rules to test the target program, which can save the working time of the test equipment.

[0012] Furthermore, for any test device, the target operating environment type is determined based on the operating environment parameters that differ between the test device and the benchmark test device, and target test cases are then selected that meet a certain degree of impact on the results of the target operating environment type. Because the operating environment parameters that differ between the test device and the benchmark test device belong to the target operating environment type, for test cases with a low degree of impact on the results of the target operating environment type, the difference in test results between the test device and the benchmark test device will be minimal. Therefore, not running the test case on the test device will not affect the comprehensiveness of the test.

[0013] For example, the operating environment type that differs between test device A and test device B is the CPU, and the CPU determined based on the test execution data has a very small impact on the result of test case TC1. For test device A and test device B, the results obtained by testing the target program using test case TC1 are similar.

[0014] In one possible implementation, the operating environment parameter includes a test equipment component model. If the operating environment parameter is a test equipment component model, a correspondence between the test case, the test equipment component model, and the test result can be determined based on the BOM information library and initial test execution data of the target program during historical testing.

[0015] The BOM information library includes the correspondence between the component models of the test equipment and the component models of the components on the components, and the initial test execution data includes the correspondence between the test cases, the component models of the test equipment and the test results.

[0016] The solution shown in the embodiment of the present application can extract the component models in the BOM information library. Further, the test cases and test results corresponding to the extracted component models can be determined in the test execution data, and the test cases and test results corresponding to the component models can be used as the test cases and test results of multiple component models corresponding to the component model to obtain the test execution data of the target program.

[0017] In this way, the correspondence between component models, test results and test cases can be effectively determined, providing a basis for subsequent selection of test cases and effectively improving test efficiency.

[0018] In one possible implementation, the total failure rate of each test case in the test execution data and the failure rate of each test case under different operating environment parameters can be determined. For each test case, based on the calculated failure rate and total failure rate, the dispersion of the failure rate for each operating environment parameter of the test case under the same operating environment type relative to the total failure rate is determined, which serves as the degree of impact of the operating environment type on the test case's results.

[0019] Among them, dispersion can be expressed by mean absolute deviation, variance and standard deviation.

[0020] In the scheme shown in the embodiment of the present application, when determining the discreteness, the failure rate of each operating environment parameter included in the test case in the same operating environment type and the total failure rate of the test case can be subtracted. Further, the calculated differences can be summed to obtain the discreteness, or the calculated differences can be weightedly summed to obtain the discreteness.

[0021] In this way, a simple and quick method for determining the impact of results is provided, which can improve the efficiency of selecting test cases.

[0022] In one possible implementation, the absolute value of the difference between the failure rate of the test case under each operating environment parameter included in the same operating environment type and the total failure rate can be determined. Further, the dispersion can be determined based on the absolute value of the difference corresponding to each operating environment parameter included in the same operating environment type.

[0023] In the solution shown in the embodiment of the present application, the determined absolute values ​​of the differences can be summed, or the determined absolute values ​​of the differences can be weighted and summed to obtain the dispersion.

[0024] In this way, a simple and quick method for determining the impact of results is provided, which can improve the efficiency of selecting test cases.

[0025] In one possible implementation, the number of times a test case is tested under each operating environment parameter included in the same operating environment type can be determined as a weight value corresponding to each operating environment parameter. Based on the determined weight value, a weighted average of multiple absolute values ​​of differences corresponding to each operating environment parameter included in the same operating environment type is performed to obtain the dispersion.

[0026] In this way, by taking a weighted average of the operating environment parameters according to the number of tests, a more accurate dispersion can be obtained.

[0027] In one possible implementation, the impact of different operating environment types on the result of the same test case can be ranked to obtain a first ranking value of the result impact. Furthermore, the target test case can be selected based on the result impact of the target operating environment type on each test case and the corresponding first ranking value.

[0028] The solution shown in the embodiment of the present application can sort the results of the same test case by different operating environment types from large to small, or can sort the results of the same test case by different operating environment types from small to large. The test case corresponding to the result influence of the target operating environment type corresponding to each test case whose first ranking value is less than or equal to (greater than or equal to) the specified ranking value can be used as a spare test case, and further, the test case whose result influence is greater than a preset threshold value in the spare test case is determined as the target test case. The test case whose result influence is greater than a preset threshold value in the target operating environment type corresponding to each test case can also be determined as a spare test case, and further, the test case corresponding to the result influence of the first ranking value is less than or equal to (greater than or equal to) the specified ranking value in the spare test case is determined as the target test case.

[0029] In this way, multiple test cases that have a greater impact on the target operating environment type can be identified. Using these test cases to test the target program on the test device corresponding to the target operating environment type can improve the effectiveness of the test and shorten the testing time on the test device.

[0030] In one possible implementation, the impact of the target operating environment type on the result of each test case can be ranked to obtain a second ranking value of the result impact. Further, the target test case can be selected based on the first ranking value and the second ranking value corresponding to the impact of the target operating environment type on the result of each test case.

[0031] In the solution shown in the embodiment of the present application, when selecting the target test case, the first ranking value and the second ranking value corresponding to the target operating environment type's impact on the result of each test case can be summed to obtain a third ranking value. Alternatively, the first ranking value and the second ranking value corresponding to the target operating environment type's impact on the result of each test case can be weighted and summed to obtain a third ranking value. The weight of the second ranking value can be greater than the weight of the first ranking value. Then, the test case corresponding to the result impact of the third ranking value being less than or equal to (greater than or equal to) the specified ranking value is determined as the target test case.

[0032] In this way, multiple test cases that have a greater impact on the target operating environment type can be determined, and these test cases can be used to perform tests on the test device, thereby shortening the testing time on the test device.

[0033] In a possible implementation, a target test case is selected based on a non-dominant sorting algorithm, an impact of the target operating environment type on the result of each test case, and a corresponding first sorting value.

[0034] The solution shown in the embodiment of the present application can group the result impact of test cases under the target operating environment type, and based on the non-dominant sorting algorithm, use the result impact, the first sorting value and the group as correlation indicators to determine the correlation between each test case and the target operating environment type. The test cases can be sorted based on the correlation, and the test cases sorted before or after the specified sorting can be determined as target test cases.

[0035] In this way, by selecting some test cases that are most relevant to the target operating environment types corresponding to the different test devices, effective testing can be performed and the time for testing on the test devices can be shortened.

[0036] In a second aspect, a device for selecting test cases is provided, the device comprising at least one module, the at least one module being used to implement the method for displaying function cards provided by the first aspect and its possible implementation methods.

[0037] In a third aspect, a computer device is provided, comprising a memory and a processor, wherein the memory is used to store computer instructions; the processor executes the computer instructions stored in the memory so that the computer device executes the method of the first aspect and its possible implementation methods.

[0038] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer program code. In response to the computer program code being executed by a computer device, the computer device executes the method of the first aspect and possible implementations thereof.

[0039] In a fifth aspect, a computer program product is provided, the computer program product comprising computer program code. In response to the computer program code being executed by a computer device, the computer device executes the method of the first aspect and possible implementations thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] FIG1 is a flow chart of a method for selecting a test case provided in an embodiment of the present application;

[0041] FIG2 is a schematic diagram of a result impact result provided by an embodiment of the present application;

[0042] FIG3 is a schematic diagram of grouping of test cases provided in an embodiment of the present application;

[0043] FIG4 is a scatter plot of a test case provided in an embodiment of the present application;

[0044] FIG5 is a schematic diagram of the structure of a device for selecting a test case provided in an embodiment of the present application;

[0045] FIG6 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0046] The following are some terms used in this embodiment:

[0047] Test case (TC): A description of a test task for a specific software product. The main contents include number, name, test content, test steps, test script, expected results, etc., for example, Table 1. Test cases are used to test whether a software product meets a certain functional requirement.

[0048] Table 1

[0049] Operating environment parameters: including the component models and operating system of the test equipment. For example, the CPU model of test equipment A is HiXXX1, the memory model is 6G, and the operating system is Android.

[0050] Operating environment type: includes component type and operating system type. Component types can include various chips such as CPU, memory, and flash memory. Each operating environment type includes multiple operating environment parameters. For example, CPU types include HiXXX1, HiXXX2, and HiXXX3. Operating system types include Hongmeng, Android, iOS, Windows, and Linux. More specifically, it can also be a specific version of an operating system, such as Windows 2013.

[0051] Test Result: This is the result of testing the target program using the corresponding test case in the corresponding operating environment. It can be either a success or a failure. For example, this could be the result of testing the target program in an operating environment with a HiXXX1 CPU, 6GB of memory, and an Android operating system.

[0052] Result impact: The impact of the operating environment type on the test case result is the difference in the test results of the test case under each operating environment parameter included in the operating environment type. For the same operating environment type and the same test case, different operating environment parameters may affect the test results. For example, for the CPU type, when the target program is tested using the test case TC1, 80% of the test results corresponding to the HiXXX1 model CPU are successful, 20% are failed, and 40% of the test results corresponding to the HiXXX2 model CPU are successful, and 60% are failed. When the test case TC1 is used to test the target program, the difference in the test results corresponding to different CPU models is relatively large, indicating that the CPU type has a greater impact on the test results of the test case TC1, that is, the result impact is relatively large.

[0053] Discreteness: refers to the degree of difference between the values ​​of a variable. In this embodiment, the failure rate of a test case under the operating environment parameters is used as a variable. The degree of difference between the variables can be represented by the difference between the failure rate of the test case under the operating environment parameters and the total failure rate of the test case.

[0054] In the field of information and communications technology, after modifications are made to developed software (such as system programs or applications), the software needs to be tested using different test cases on test devices with different hardware configurations. Generally, all test cases can be selected to test the software on each test device with different hardware configurations. Alternatively, pre-specified rules can be used to select a subset of test cases to test the software on test devices with different configurations.

[0055] The present application embodiment provides a method for selecting test cases for the above application scenarios, and selects corresponding test cases for different test devices. The processing flow of the method can be shown in Figure 1, including the following processing steps:

[0056] 101, obtaining test execution data based on a historical test process of a target program.

[0057] The target program can be a system program or any type of application program. The test execution data includes the correspondence between the test cases, operating environment parameters, and test results. The test execution data can also include the version information of the target program.

[0058] In the case where the operating environment parameter is the component model of the test equipment, when obtaining the test execution data, the correspondence between the test case, the component model of the test equipment and the test result can be determined based on the BOM information library and the initial test execution data of the target program in the historical test process.

[0059] The BOM information library includes the correspondence between the component model of the test equipment and the part model of the components on the component. For example, in Table 2, the component can be a board, and the component model can be the board model. The components on the component can be components such as the CPU and memory that make up the board, and the part model can be the part model of the CPU, memory, and other components.

[0060] Table 2

[0061] The initial test execution data includes the correspondence between test cases, component models of test equipment, and test results, for example, Table 3.

[0062] Table 3

[0063] Through Table 2 and Table 3, the corresponding relationship between the test cases, the component models of the test equipment and the test results can be obtained, for example, Table 4.

[0064] Table 4

[0065] 102. Based on the test execution data, determine the impact of different operating environment types on the results of different test cases.

[0066] In implementation, for each test case in the test execution data, it is necessary to calculate the result impact of the test case under different operating environment types. The result impact can be expressed by dispersion, which can be expressed by mean absolute difference. The specific calculation process can be as follows:

[0067] Step 1: Determine the total failure rate of each test case in the test execution data and the failure rate of each test case under different operating environment parameters.

[0068] In implementation, statistics can be first collected for the number of failures (e.g., Table 5) and the total number of tests for each test case involved in the test execution data. For each test case, the total failure rate of each test case can be further calculated (e.g., Table 6). Similarly, statistics can be collected for the number of failures (e.g., Table 5) and the total number of tests for each test case under different operating environment parameters to obtain the failure rate of each test case under different operating environment parameters (e.g., Table 6).

[0069] Table 5

[0070] Table 6

[0071] Step 2: For each test case, determine the dispersion of the failure rate of the test case under each operating environment parameter included in the same operating environment type relative to the total failure rate, as the impact of the operating environment type on the test case result.

[0072] In implementation, after calculating the total failure rate of each test case and the failure rate of each test case under different operating environment parameters, further, the absolute value of the difference between the failure rate of each test case under multiple operating environment parameters included in the same operating environment type and the total failure rate can be calculated. In addition, it is also necessary to determine the number of tests of the test case under each operating environment parameter included in the same operating environment type as the weight value corresponding to each operating environment parameter. Based on the weight value corresponding to each operating environment parameter, the absolute value of the difference corresponding to the multiple operating environment parameters included in the same operating environment type is weighted averaged to obtain the discreteness. In this way, the discreteness of each test case under different operating environment types can be obtained, and further, the discreteness is used as the result influence. For example, in Figure 2, HWC represents the operating environment type, WMAD represents the discreteness (result influence), the value in the circle represents the first sort value, and the value in the box represents the second sort value.

[0073] The mathematical expression corresponding to the above discreteness calculation process is: WMAD(TCi, HWCj) = (ExecNum(C1) × |PF(TCi, C1)-PF(TCi)| + ... + ExecNum(Cn) × |PF(TCi, Cn)-PF(TCi)|) / (ExecNum(C1) + ... + ExecNum(Cn))

[0074] Among them, WMAD(TCi, HWCj) represents the mean absolute difference (i.e., dispersion) of the failure rate of test case TCi under the operating parameter type HWCj. i is the number of the test case in the test execution data. j is the number of the operating environment type. Operating environment parameters C1-Cn are multiple operating environment parameters included in the operating environment type HWCj. ExecNum(C1) represents the number of times the test is executed using the test case TCi under the operating environment parameter C1, that is, the weight value corresponding to the operating environment parameter C1. PF(TCi, C1) represents the failure rate of test case TCi under the operating environment parameter C1. PF(TCi) is the total failure rate of test case TCi.

[0075] For example, WMAD(TC1, CPU) represents the mean absolute difference in failure rates for test case TC1 under the CPU component type. ExecNum(CPU(HiXXX1)) represents the number of times test case TC1 was executed under the HiXXX1 operating environment parameter model, which is also the weight value corresponding to the operating environment parameter C1. PF(TC1, CPU(HiXXX1)) is the failure rate of test case TC1 when executed on the HiXXX1 CPU model. PF(TC1) is the total failure rate of test case TC1.

[0076] In actual operation, dispersion can also be expressed in other ways, such as standard deviation, variance, etc.

[0077] 103 , determining each test case in the corresponding relationship as a test case used to test the target program on the benchmark test device.

[0078] The benchmark test device may be one or more test devices selected from all the test devices to be used, and may be selected manually, randomly by a computer, or based on specified rules (such as the smallest number, the strongest overall performance, etc.).

[0079] In practice, all test cases involved in the test execution data can be determined as test cases for testing the target program on the benchmark device. Alternatively, a subset of test cases can be selected based on specified rules, for example, by randomly selecting a subset of test cases or selecting test cases corresponding to frequently used functions in the target program.

[0080] 104. For each test device other than the benchmark test device, determine the target operating environment type to which the operating environment parameters that differ between the test device and the benchmark test device belong, and determine the target test cases that meet the result impact conditions with the target operating environment type as the test cases used to test the target program on the test device.

[0081] During implementation, while testing the target program, the operating environment parameters of test devices other than the benchmark test device can be compared with those of the benchmark test device to identify any discrepancies. Furthermore, the operating environment type to which the discrepancies belong is determined as the target operating environment type. The target operating environment type can be one or more. The following describes in detail the specific process for selecting test cases, assuming there is only one target operating environment type.

[0082] When determining target test cases, the test cases corresponding to the target operating environment type may be sorted based on the calculated result impact of each test case in each operating environment type, and further, the test cases may be selected based on the sorting results.

[0083] The specific processing steps for selecting target test cases based on the sorting results can be:

[0084] Step 1: sort the impacts of different operating environment types on the result of the same test case to obtain a first sort value of the impact of the target operating environment type on the result of each test case.

[0085] In implementation, for each test case, its result impact under different operating environment types can be sorted, that is, the discreteness of each column in Figure 2 is sorted separately. When sorting, it can be sorted from large to small (for example, Figure 2) or from small to large. Further, a first ranking value of each result impact is obtained. The embodiment of the present application is explained by taking sorting from large to small as an example.

[0086] For example, the operating environment types include HWC1, HWC2, HWC3, HWC4, and HWC5. For TC1, WMAD(TC1, HWC1), WMAD(TC1, HWC2), WMAD(TC1, HWC3), WMAD(TC1, HWC4), and WMAD(TC1, HWC5) can be sorted from largest to smallest. The sorting result is WMAD(TC1, HWC3) > WMAD(TC1, HWC5) > WMAD(TC1, HWC2) > WMAD(TC1, HWC1) > WMAD(TC1, HWC4), that is, the first sorting value shown in each circle in the second column of Figure 2 can be obtained.

[0087] Step 2: Select a target test case based on the impact of the target operating environment type on the result of each test case and the corresponding first ranking value.

[0088] For each test case, its result impact under different operating environment types can be grouped. Specifically, the grouping can be based on the difference in the impact of adjacent first ranking values, and the result impact under different operating environment types can be divided into two groups of high and low, for example, Figure 3. The processing steps are as follows:

[0089] First, the impact of two adjacent results with the first ranking value is calculated to obtain multiple difference values. For example, if the impact of the test case results in different operating environment types are WMAD(TC1, HWC3), WMAD(TC1, HWC5), WMAD(TC1, HWC2), WMAD(TC1, HWC1), and WMAD(TC1, HWC4), multiple difference values ​​can be obtained: WMAD(TC1, HWC3)-WMAD(TC1, HWC5), WMAD(TC1, HWC5)-WMAD(TC1, HWC2), WMAD(TC1, HWC2)-WMAD(TC1, HWC1), and WMAD(TC1, HWC1)-WMAD(TC1, HWC4).

[0090] Second, determine the influence of the two results corresponding to the difference with the largest absolute value, for example, WMAD(TC1, HWC5) and WMAD(TC1, HWC2) in FIG3 .

[0091] Third, of the two determined result influences, the smaller first ranking value is determined as a reference ranking value. For example, the reference ranking value in FIG3 is 2.

[0092] Fourth, the result influences whose corresponding first ranking values ​​are less than or equal to the reference ranking value are divided into a high discreteness group, for example, WMAD (TC1, HWC3) and WMAD (TC1, HWC5) in FIG3 , and the result influences whose first ranking values ​​are greater than the target ranking value are divided into a low discreteness group, for example, WMAD (TC1, HWC2), WMAD (TC1, HWC1) and WMAD (TC1, HWC4) in FIG3 .

[0093] After determining the groups, you can select target test cases in the following ways.

[0094] Method 1: Dominant hierarchical sorting algorithm.

[0095] First, the impact of the target operating environment type on the result of each test case is sorted to obtain a second ranking value corresponding to the impact of the target operating environment type on the result of each test case. For example, if the target operating environment type is HWC1, the impact of the results in the first row of Figure 2 can be sorted to obtain a second ranking value, i.e., the second ranking value shown in each box in the second row of Figure 2.

[0096] Second, based on the first ranking value and the second ranking value corresponding to the impact of the target operating environment type on the result of each test case, a target test case is selected.

[0097] The specific processing can be: for the result influence with the same second ranking value (for example, TC1 and TC2 and TC3 and TC4 in Table 7), the result influence with the same second ranking value is sorted from small to large according to the first ranking value. If the first ranking value is still the same (for example, TC1 and TC2 in Table 7), the result influence belonging to the high discreteness group can be further ranked higher. In this way, the final ranking of the result influence of the target operating environment type on each test case can be obtained. Finally, the target test case can be selected based on the final ranking based on the number or proportion of target test cases selected by the technician. For example, the number of target test cases selected by the technician is 2, and the test cases with the final ranking of 1 and 2 are selected as the target test cases, that is, TC1 and TC2 are selected as the target test cases.

[0098] For method 1, the above grouping operation can be omitted. If the second ranking values ​​are the same, the second ranking values ​​are compared. If the second ranking values ​​are also the same, selection is made based on the sequence number of the test case. The test cases with higher sequence numbers can be ranked higher, and the test cases with higher result impacts can be ranked higher. This results in a final ranking of the target operating environment type's impact on the result of each test case. Finally, the target test cases can be selected based on the final ranking, based on the number or proportion of target test cases selected by the technician.

[0099] Table 7

[0100] Method 2: Non-dominant sorting algorithm: Select target test cases based on the non-dominant sorting algorithm, the impact of the target operating environment type on the result of each test case, and the corresponding first sorting value.

[0101] In implementation, the result impact, the first ranking value, and the group are used as three types of indicators and input into the non-dominant ranking algorithm. In this algorithm, the same weight value is assigned to these three types of indicators. For each type of indicator, a corresponding relevance is assigned to each indicator based on the specific value of the corresponding indicator. Among them, the result impact and the relevance are positively correlated, that is, the greater the result impact, the higher the relevance of the corresponding test case; the first ranking value and the relevance are negatively correlated, that is, the smaller the first ranking value, the higher the relevance of the corresponding test case; the test case relevance corresponding to the result impact in the high dispersion group is higher. Further, for each test case, the relevance of the test case can be determined based on the relevance of the three corresponding indicators and the weight value corresponding to the indicator, and further, the ranking sequence of the test cases can be obtained, and the ranking sequence can be obtained by sorting from large to small according to the relevance. Finally, based on the number or proportion of target test cases selected by the technician, the test cases are selected from large to small according to the relevance.

[0102] For the second method, the above-mentioned grouping operation can also be omitted. The result impact and the first ranking value are input into the non-dominant ranking algorithm as two types of indicators to determine the relevance of each test case corresponding to the target environment type, and further, the ranking sequence of the test cases is obtained. In addition, the metrics scatter plot shown in Figure 4 can also be output. In Figure 4, the closer the curve is to the upper left of the figure, the higher the correlation corresponds to. The points on each curve have the same correlation for the test cases. Finally, based on the number or proportion of target test cases selected by the technician, the test cases are selected from large to small according to the relevance.

[0103] Accordingly, relevant information of the selected test case may be displayed, as shown in Table 8.

[0104] Table 8

[0105] Method three: sort the impact of the target operating environment type on the result of each test case to obtain a second ranking value corresponding to the impact of the target operating environment type on the result of each test case. For the impact of the target operating environment type on the result of each test case, the weighted average of the first ranking value and the second ranking value can be calculated, and the obtained weighted average value can be sorted from small to large. The weight value of the second ranking value can be greater than the weight value of the first ranking value. Furthermore, based on the number or proportion of target test cases selected by the technician, test cases are selected from small to large according to the weighted average value.

[0106] Based on the various methods described above, multiple target test cases that are relatively relevant to the target environment type corresponding to the current test device can be determined. For test cases other than the target test cases, the test results of these test cases on the benchmark test device and the current test device can be the same, eliminating the need to retest the target program on the current test device using these test cases, thereby shortening the operating time of the current test device.

[0107] Additionally, if multiple target operating environment types are identified, a specified number of target test cases can be selected for each target operating environment type. The specified number for each target operating environment type can be the same or different. The specified number for each target operating environment can be determined by a technician based on their experience.

[0108] Additionally, technicians can determine which target program function is most affected by a particular runtime environment. For example, if they want to test which target program function is most affected by CPU performance, they can select the target runtime environment type as CPU to obtain a final ranking of test cases. The technician can then analyze the test functions and final rankings corresponding to the test cases and use the analysis results to determine which target program function is most affected by CPU performance.

[0109] In an embodiment of the present application, the degree of influence of different operating environment types on the results of test cases can be determined through the historical test execution data of the target program. Further, based on the determined result influence, the test case most relevant to the target operating environment type can be selected, and the target program can be tested on the test device corresponding to the target operating environment type. By determining some test cases that have a strong correlation with the target operating environment type, the purpose of accurately selecting test cases is achieved. Moreover, after determining the target operating environment type corresponding to any test device, for test cases with a smaller degree of influence on the results under the target operating environment type, not running the test case on the test device will not affect the comprehensiveness of the test. Therefore, the test cases selected using this solution can be used to conduct more effective and comprehensive testing of related software.

[0110] Based on the same technical concept, the embodiment of the present application also provides a device for selecting a test case, as shown in FIG5 , the device includes:

[0111] Acquisition module 510 is configured to acquire test execution data based on the historical testing process of the target program. The test execution data includes the correspondence between test cases, operating environment parameters, and test results. The test results are obtained by testing the target program using the corresponding test cases under the corresponding operating environment. Specifically, this module implements the acquisition function described in step 101 above, as well as other implicit steps.

[0112] The determination module 520 is configured to:

[0113] Based on the test execution data, determine the impact of different operating environment types on the results of different test cases, wherein each operating environment type includes multiple operating environment parameters, and the impact of the operating environment type on the test case results is the difference in the test results of the test case under each operating environment parameter included in the operating environment type; determine each test case in the corresponding relationship as the test case used to test the target program on the benchmark test device; for each test device other than the benchmark test device, determine the target operating environment type to which the operating environment parameters that differ between the test device and the benchmark test device belong, and determine the target test case that meets the result impact condition with the target operating environment type as the test case used to test the target program on the test device. Specifically, the determination functions in steps 102 to 104 above, as well as other implicit steps, can be implemented.

[0114] In a possible implementation, the operating environment parameter includes a component model of the test equipment, and the acquisition module 510 is configured to:

[0115] Based on the bill of materials (BOM) information library and the initial test execution data of the target program during historical testing, the correspondence between the test cases, the component models of the test equipment and the test results is determined. The BOM information library includes the correspondence between the component models of the test equipment and the component models of the components on the components, and the initial test execution data includes the correspondence between the test cases, the component models of the test equipment and the test results.

[0116] In a possible implementation, the determining module 520 is configured to:

[0117] Determine the total failure rate of each test case in the test execution data and the failure rate of each test case under different operating environment parameters;

[0118] For each test case, the dispersion of the failure rate of the test case under each operating environment parameter included in the same operating environment type relative to the total failure rate is determined as the impact of the operating environment type on the test case result.

[0119] In a possible implementation, the determining module 520 is configured to:

[0120] Determine the absolute value of the difference between the failure rate of each operating environment parameter included in the same operating environment type and the total failure rate;

[0121] The dispersion is determined based on the absolute value of the difference corresponding to each operating environment parameter included in the same operating environment type.

[0122] In a possible implementation, the determining module 520 is configured to:

[0123] Determine the number of times a test case is tested under each operating environment parameter included in the same operating environment type as a weight value corresponding to each operating environment parameter;

[0124] Based on the weight value corresponding to each operating environment parameter, the absolute value of the difference corresponding to each operating environment parameter included in the same operating environment type is weighted averaged to obtain the dispersion.

[0125] In a possible implementation, the determining module 520 is configured to:

[0126] Sort the impact of different operating environment types on the result of the same test case to obtain a first ranking value of the impact of the target operating environment type on the result of each test case;

[0127] A target test case is selected based on the impact of the target operating environment type on the result of each test case and the corresponding first ranking value.

[0128] In a possible implementation, the determining module 520 includes:

[0129] Sort the impact of the target operating environment type on the result of each test case to obtain a second ranking value corresponding to the impact of the target operating environment type on the result of each test case;

[0130] A target test case is selected based on the first ranking value and the second ranking value corresponding to the impact of the target operating environment type on the result of each test case.

[0131] In a possible implementation, the determining module 520 is configured to:

[0132] A target test case is selected based on a non-dominant sorting algorithm, an impact of the target operating environment type on the result of each test case, and a corresponding first sorting value.

[0133] The acquisition module 510 and the determination module 520 can be implemented by software or hardware. For example, the implementation of the acquisition module 510 will be described below using the acquisition module 510 as an example. Similarly, the implementation of the determination module 520 can refer to the implementation of the acquisition module 510.

[0134] As an example of a software functional unit, the acquisition module 510 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the computing instance may be one or more. For example, the acquisition module 510 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple geographically close data centers. Typically, a region may include multiple AZs.

[0135] Similarly, multiple hosts / virtual machines / containers running the code can be distributed within the same virtual private cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Cross-region communication between two VPCs within the same region, or between VPCs in different regions, requires a communication gateway within each VPC to interconnect the VPCs.

[0136] As an example of a hardware functional unit, the acquisition module 510 may include at least one computing device, such as a server. Alternatively, the acquisition module 510 may be implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0137] The multiple computing devices included in acquisition module 510 can be distributed in the same region or in different regions. The multiple computing devices included in acquisition module 510 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in acquisition module 510 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of servers, ASICs, PLDs, CPLDs, FPGAs, GALs, and other computing devices.

[0138] It should be noted that, in other embodiments, the acquisition module can be used to execute any step in the method for selecting a test case, and the determination module can be used to execute any step in the method for selecting a test case. The steps that the acquisition module and the determination module are responsible for implementing can be specified as needed. The full functions of the device for selecting a test case can be realized by respectively implementing different steps in the method for selecting a test case through the acquisition module and the determination module.

[0139] The present embodiment also provides a computing device 600. As shown in Figure 6, computing device 600 includes a bus 602, a processor 604, a memory 606, and a communication interface 608. Processor 604, memory 606, and communication interface 608 communicate with each other via bus 602. Computing device 600 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in computing device 600.

[0140] Bus 602 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, for example. Buses may be classified as address buses, data buses, control buses, and the like. For ease of illustration, FIG6 shows a single bus line, but this does not imply a single bus or type of bus. Bus 602 may be a path for transmitting information between various components of computing device 600 (e.g., memory 606, processor 604, and communication interface 608).

[0141] The processor 604 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0142] The memory 606 may include volatile memory, such as random access memory (RAM). The memory 606 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).

[0143] The memory 606 stores executable program code, and the processor 604 executes the executable program code to implement the functions of the acquisition module 510 and the confirmation module 520, thereby implementing the method for selecting test cases. In other words, the memory 606 stores instructions for executing the method for selecting test cases.

[0144] Alternatively, the memory 606 stores executable code, and the processor 604 executes the executable code to respectively implement the functions of the aforementioned device for selecting test cases, thereby implementing the method for selecting test cases. That is, the memory 606 stores instructions for executing test case selection.

[0145] The communication interface 608 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 600 and other devices or a communication network.

[0146] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center that contains one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute the method for selecting a test case, or instruct the computing device to execute the method for selecting a test case.

[0147] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the protection scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A method for selecting a test case, characterized in that: The method comprises: Acquire test execution data obtained based on a historical test process of the target program, wherein the test execution data includes a correspondence between a test case, an operating environment parameter, and a test result, and the test result is a result obtained by testing the target program using a corresponding test case under a corresponding operating environment; Based on the test execution data, determine the influence of different operating environment types on the results of different test cases, wherein each operating environment type includes multiple operating environment parameters, and the influence of the operating environment type on the result of the test case is the difference between the test results of the test case under each operating environment parameter included in the operating environment type; Determine each test case in the corresponding relationship as a test case used to test the target program on a benchmark test device; For each test device other than the benchmark test device, determine the target operating environment type to which the operating environment parameters that differ between the test device and the benchmark test device belong, and determine a target test case that meets the result impact condition with the target operating environment type as a test case used to test the target program on the test device.

2. The method according to claim 1, characterized in that The operating environment parameters include the component model of the test equipment, and the test execution data obtained based on the historical test process of the target program includes: Based on the bill of materials (BOM) information library and the initial test execution data of the target program during historical testing, the correspondence between the test cases, component models of the test equipment and the test results is determined, wherein the BOM information library includes the correspondence between the component models of the test equipment and the component models of the components on the components, and the initial test execution data includes the correspondence between the test cases, component models of the test equipment and the test results.

3. The method according to claim 1 or 2, characterized in that: The determining, based on the test execution data, the influence of different operating environment types on the results of different test cases includes: Determine the total failure rate of each test case in the test execution data and the failure rate of each test case under different operating environment parameters; For each test case, the dispersion of the failure rate of the test case under each operating environment parameter included in the same operating environment type relative to the total failure rate is determined as the influence of the operating environment type on the result of the test case.

4. The method according to claim 3, characterized in that The determining of the dispersion of the failure rate of the test case under the multiple operating environment parameters included in the same operating environment type relative to the total failure rate includes: Determine the absolute value of the difference between the failure rate of the test case under each operating environment parameter included in the same operating environment type and the total failure rate; The discreteness is determined based on the absolute value of the difference corresponding to each operating environment parameter included in the same operating environment type.

5. The method according to claim 4, characterized in that The determining the discreteness based on the absolute value of the difference corresponding to each operating environment parameter included in the same operating environment type comprises: Determine the number of tests of the test case under each operating environment parameter included in the same operating environment type as the weight value corresponding to each operating environment parameter; Based on the weight value corresponding to each operating environment parameter, weighted average is performed on the absolute value of the difference corresponding to each operating environment parameter included in the same operating environment type to obtain the discreteness.

6. The method according to any one of claims 1 to 5, characterized in that: The determining of the target test case that satisfies the result impact condition with the target operating environment type includes: Sort the impacts of different operating environment types on the result of the same test case to obtain a first ranking value of the impact of the target operating environment type on the result of each test case; A target test case is selected based on the impact of the target operating environment type on the result of each test case and the corresponding first ranking value.

7. The method according to claim 6, characterized in that The selecting a target test case based on the impact of the target operating environment type on the result of each test case and the corresponding first ranking value includes: Sort the impact of the target operating environment type on the result of each test case to obtain a second ranking value corresponding to the impact of the target operating environment type on the result of each test case; A target test case is selected based on the first ranking value and the second ranking value corresponding to the impact of the target operating environment type on the result of each test case.

8. The method according to claim 6, characterized in that The selecting a target test case based on the impact of the target operating environment type on the result of each test case and the corresponding first ranking value includes: A target test case is selected based on a non-dominant sorting algorithm, an impact of the target operating environment type on the result of each test case and a corresponding first sorting value.

9. A device for selecting a test case, characterized in that: The device comprises: An acquisition module is used to acquire test execution data obtained based on a historical test process of a target program, wherein the test execution data includes a correspondence between a test case, an operating environment parameter, and a test result, and the test result is a result obtained by testing the target program using a corresponding test case under a corresponding operating environment; Identify modules for: Based on the test execution data, determine the influence of different operating environment types on the results of different test cases, wherein each operating environment type includes multiple operating environment parameters, and the influence of the operating environment type on the result of the test case is the difference between the test results of the test case under each operating environment parameter included in the operating environment type; Determine each test case in the corresponding relationship as a test case used to test the target program on a benchmark test device; For each test device other than the benchmark test device, determine the target operating environment type to which the operating environment parameters that differ between the test device and the benchmark test device belong, and determine a target test case that meets the result impact condition with the target operating environment type as a test case used to test the target program on the test device.

10. The device according to claim 9, characterized in that The operating environment parameters include component models of the test equipment, and the acquisition module is used to: Based on the bill of materials (BOM) information library and the initial test execution data of the target program during historical testing, the correspondence between the test cases, component models of the test equipment and the test results is determined, wherein the BOM information library includes the correspondence between the component models of the test equipment and the component models of the components on the components, and the initial test execution data includes the correspondence between the test cases, component models of the test equipment and the test results.

11. The device according to claim 9 or 10, characterized in that The determining module is used to: Determine the total failure rate of each test case in the test execution data and the failure rate of each test case under different operating environment parameters; For each test case, the dispersion of the failure rate of the test case under each operating environment parameter included in the same operating environment type relative to the total failure rate is determined as the influence of the operating environment type on the result of the test case.

12. The device according to claim 11, characterized in that The determining module is used to: Determine the absolute value of the difference between the failure rate of the test case under each operating environment parameter included in the same operating environment type and the total failure rate; The discreteness is determined based on the absolute value of the difference corresponding to each operating environment parameter included in the same operating environment type.

13. The device according to claim 12, characterized in that The determining module is used to: Determine the number of tests of the test case under each operating environment parameter included in the same operating environment type as the weight value corresponding to each operating environment parameter; Based on the weight value corresponding to each operating environment parameter, weighted average is performed on the absolute value of the difference corresponding to each operating environment parameter included in the same operating environment type to obtain the discreteness.

14. The device according to any one of claims 9 to 13, characterized in that: The determining module is used to: Sort the impacts of different operating environment types on the result of the same test case to obtain a first ranking value of the impact of the target operating environment type on the result of each test case; A target test case is selected based on the impact of the target operating environment type on the result of each test case and the corresponding first ranking value.

15. The device according to claim 14, characterized in that The determining module comprises: Sort the impact of the target operating environment type on the result of each test case to obtain a second ranking value corresponding to the impact of the target operating environment type on the result of each test case; A target test case is selected based on the first ranking value and the second ranking value corresponding to the impact of the target operating environment type on the result of each test case.

16. The device according to claim 14, characterized in that The determining module is used to: A target test case is selected based on a non-dominant sorting algorithm, an impact of the target operating environment type on the result of each test case and a corresponding first sorting value.

17. A computer device, characterized in that: The computer device comprises a memory and a processor, wherein the memory is used to store computer instructions; The processor executes the computer instructions stored in the memory to enable the computer device to perform the method according to any one of claims 1 to 8.

18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program code. In response to the computer program code being executed by a computer device, the computer device executes the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Test case screening method and device, computer equipment and storage medium

    CN110489321A

  • Test case screening method and device and medium

    CN111274126A

  • Unit test method, device, storage medium and computer equipment

    CN112685309A

  • Test case selection method and device, computer equipment and storage medium

    CN114138634A

  • Test case optimization and prioritization

    US20210303450A1

Cited By

  • Satellite batch production test method, satellite batch production test equipment and computer storage medium

    CN120238179A

  • Test method and device, electronic equipment and storage medium

    CN120429238A