A method, system, device and storage medium for sorting test cases

By calculating and updating the functional parameter priorities of test cases and automatically sorting test cases, the problem of low test efficiency of embedded operating systems for intelligent power measurement equipment is solved, and the test efficiency and equipment applicability are improved.

CN114880205BActive Publication Date: 2024-09-27CHINA ELECTRIC POWER RESEARCH INSTITUTE CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111144781.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-28
Publication Date
2024-09-27
Estimated Expiration
2041-09-28

AI Technical Summary

Technical Problem

The functional testing efficiency of embedded operating systems for intelligent power measurement equipment is low, and it is difficult to find a better order of test cases through manual sorting, which affects system performance and online time.

Method used

By collecting use case information of operating system test cases, calculate the priority of functional parameters, select the test case with the highest priority of functional parameters to execute, update the priority according to the test results, and optimize the ordering of test cases.

Benefits of technology

It improves test efficiency, reduces test complexity and device computing and storage requirements, and is suitable for efficient execution on terminal devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114880205B
    Figure CN114880205B
Patent Text Reader

Abstract

The present invention discloses a method, system, device and storage medium for sorting test cases, and belongs to the technical field of power measurement equipment. The method of the present invention comprises: collecting test case information of operating system test cases; determining functional parameters of the test cases according to the test case information, and calculating the priority of the functional parameters; selecting the test cases with the highest functional parameter priority and executing the test cases. The present invention calculates the priority of the test cases, so that the complexity of the test case selection process is low, the requirements on the computing and storage capabilities of the equipment are low, and it is suitable for efficient execution on the terminal equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power measurement equipment, and more specifically, to a test case sorting method and system for operating system function testing. Background Art

[0002] Smart power measurement equipment is an important part of the physical layer of the power Internet of Things. It has functions such as power data collection, calculation, and transmission. These functions are generally realized through application software. With the development of power Internet of Things terminal equipment, smart power measurement equipment has gradually developed in the direction of generalization and intelligence. Embedded operating systems are the basis for supporting smart power measurement equipment to run application software of different sources and different purposes. Although the system scale of embedded operating systems for smart power measurement equipment is significantly smaller than that of desktop operating systems and smartphone operating systems, due to the difficulty of system software development and testing and the need for software and hardware adaptation with smart power measurement equipment terminals, the development and testing cycle of embedded operating systems for smart power measurement equipment is long, the task is heavy, and the difficulty is high. Functional testing is the first stage of embedded operating systems for smart power measurement equipment, and it is also the premise of later performance and security tests. Its test efficiency directly affects the system launch time and terminal equipment shelf time, and affects the economic benefits of power companies. Improving the test efficiency of embedded operating system functional testing for smart power measurement equipment is an important challenge faced by power companies in the development of embedded operating systems.

[0003] Test case sorting is a means to improve test efficiency. At present, the commonly used test case sorting method is mainly based on the tester's experience to manually sort, that is, the tester manually sets the execution order of the test case. This method is suitable for the testing of application software with simple functions, but for embedded operating systems with complex functions, it is difficult to manually select a better test case order, which affects the test performance of the system. Applying test case sorting technology to the functional testing of embedded operating systems for smart power measurement equipment can effectively improve the test efficiency. However, the embedded operating system for smart power measurement equipment has the characteristics of complex system functions, special equipment, limited equipment resources, and high system security requirements. It is difficult to find a better sorting scheme with the manual sorting method, and the priority of the test case is difficult to define. The current priority optimization method cannot carry the calculation process of the complex sorting scheme. Summary of the invention

[0004] In view of the above problems, the present invention provides a method for sorting test cases, comprising:

[0005] Collect use case information for operating system test cases;

[0006] Determine functional parameters of the test case according to the use case information, and calculate the priority of the functional parameters;

[0007] The test case with the highest priority of functional parameters is selected and the test case is executed.

[0008] Optionally, the method further includes: after executing the test case, recording the test result;

[0009] Determine whether the operating system terminates the test based on the test results. If terminated, end the operating system function test. If not terminated, update the functional parameters of the test case based on the test results, calculate the priority of the functional parameters again, and select the test case with the highest functional parameter priority and execute it.

[0010] Optional, functional parameters, including: functional coverage, importance and failure rate of test cases.

[0011] Optionally, the use case information includes: a function set of the operating system, function coverage information of the test case, the function impact of the operating system, and the failure rate of the operating system.

[0012] Optionally, collect test case information for the operating system test case, specifically:

[0013] Obtaining a list of operating system functions, operating system test cases and system functions covered by the test cases, the frequency of use of operating system functions, and the safety impact of operating system functions;

[0014] The use case information is extracted from the function list of the operating system, the test cases of the operating system and the system functions covered by the test cases, the frequency of use of the system functions of the operating system, and the safety impact of the system functions of the operating system.

[0015] Optionally, determining the functional parameters of the test case according to the use case information and calculating the priority of the functional parameters specifically includes:

[0016] Establish a function coverage matrix for the test case, set the elements corresponding to the functions covered by the test case to 1, and set the elements corresponding to the functions not covered by the test case to 0, and calculate the initial function coverage rate of the test case, which is the ratio of the number of functions covered by the test case to the total number of functions;

[0017] Calculate the frequency of use of system functions by application software in the operating system, where the frequency of use of the system functions is the ratio of the system function use frequency to the sum of the function frequencies;

[0018] Calculate the importance of the system function in the operating system according to the frequency of use of the system function, where the importance of the system function is the product of the frequency of use of the function and the security impact;

[0019] Calculate the importance of the test case according to the importance of the system function, where the importance of the test case is the average importance of the system functions covered by the test case but not yet tested;

[0020] Setting a failure rate of a system function and calculating a failure rate of a test case, wherein the failure rate of the test case is an average of failure rates of system functions covered by the test case but not yet tested;

[0021] The priority of the test case is calculated according to the functional coverage, importance and failure rate of the test case, and the priority is the weighted sum of the functional coverage, importance and failure rate.

[0022] Optionally, determine whether the operating system terminates the test according to the test result, and if so, end the operating system function test; if not, update the function parameters of the test case according to the test result, calculate the priority of the function parameters again, and select the test case with the highest function parameter priority and execute the test case, specifically:

[0023] When the operating system is determined to be terminated according to the test results, the failure rate of the function covered by the test case is set to 0. When the operating system is determined to be not terminated according to the test results, the failure rate covered by the test case is updated using the failure increment, and the failure rate of the function not covered remains unchanged;

[0024] Update the current function coverage matrix, remove the impact of the tested test cases and covered functions in the coverage matrix, and set the rows of the tested test cases and the columns of the covered system functions in the function coverage matrix to 0;

[0025] Update the functional coverage of the test cases according to the updated functional coverage matrix;

[0026] According to the updated functional failure rate, update the failure rate of each test case that covers the function that has not been tested;

[0027] Update the importance of test cases;

[0028] Update the priority of test cases based on the updated test case coverage, importance, and failure rate;

[0029] According to the updated priorities of the test cases, the test case with the highest priority is selected to perform functional testing of the operating system.

[0030] The present invention also proposes a system for sorting test cases, the system comprising:

[0031] A collection unit, collecting use case information of operating system test cases;

[0032] A priority calculation unit, which determines the functional parameters of the test case according to the case information and calculates the priority of the functional parameters;

[0033] The sorting unit selects the test case with the highest priority of the functional parameters and executes the test case.

[0034] Optionally, the system further includes: a judgment unit, which records the test result after executing the test case;

[0035] Determine whether the operating system terminates the test based on the test results. If terminated, end the operating system function test. If not terminated, update the functional parameters of the test case based on the test results, calculate the priority of the functional parameters again, and select the test case with the highest functional parameter priority and execute it.

[0036] Optional, functional parameters, including: functional coverage, importance and failure rate of test cases.

[0037] Optionally, the use case information includes: a function set of the operating system, function coverage information of the test case, the function impact of the operating system, and the failure rate of the operating system.

[0038] Optionally, collect test case information for the operating system test case, specifically:

[0039] Obtaining a list of operating system functions, operating system test cases and system functions covered by the test cases, the frequency of use of operating system functions, and the safety impact of operating system functions;

[0040] The use case information is extracted from the function list of the operating system, the test cases of the operating system and the system functions covered by the test cases, the frequency of use of the system functions of the operating system, and the safety impact of the system functions of the operating system.

[0041] Optionally, determining the functional parameters of the test case according to the use case information and calculating the priority of the functional parameters specifically includes:

[0042] Establish a function coverage matrix for the test case, set the elements corresponding to the functions covered by the test case to 1, and set the elements corresponding to the functions not covered by the test case to 0, and calculate the initial function coverage rate of the test case, which is the ratio of the number of functions covered by the test case to the total number of functions;

[0043] Calculate the frequency of use of system functions by application software in the operating system, where the frequency of use of the system functions is the ratio of the system function use frequency to the sum of the function frequencies;

[0044] Calculate the importance of the system function in the operating system according to the frequency of use of the system function, where the importance of the system function is the product of the frequency of use of the function and the security impact;

[0045] Calculate the importance of the test case according to the importance of the system function, where the importance of the test case is the average importance of the system functions covered by the test case but not yet tested;

[0046] Setting a failure rate of a system function and calculating a failure rate of a test case, wherein the failure rate of the test case is an average of failure rates of system functions covered by the test case but not yet tested;

[0047] The priority of the test case is calculated according to the functional coverage, importance and failure rate of the test case, and the priority is the weighted sum of the functional coverage, importance and failure rate.

[0048] Optionally, determine whether the operating system terminates the test according to the test result, and if so, end the operating system function test; if not, update the function parameters of the test case according to the test result, calculate the priority of the function parameters again, and select the test case with the highest function parameter priority and execute the test case, specifically:

[0049] When the operating system is determined to be terminated according to the test results, the failure rate of the function covered by the test case is set to 0. When the operating system is determined to be not terminated according to the test results, the failure rate covered by the test case is updated using the failure increment, and the failure rate of the function not covered remains unchanged;

[0050] Update the current function coverage matrix, remove the impact of the tested test cases and covered functions in the coverage matrix, and set the rows of the tested test cases and the columns of the covered system functions in the function coverage matrix to 0;

[0051] Update the functional coverage of the test cases according to the updated functional coverage matrix;

[0052] According to the updated functional failure rate, update the failure rate of each test case that covers the function that has not been tested;

[0053] Update the importance of test cases;

[0054] Update the priority of test cases based on the updated test case coverage, importance, and failure rate;

[0055] According to the updated priorities of the test cases, the test case with the highest priority is selected to perform functional testing of the operating system.

[0056] The present invention also proposes a computer-readable storage medium, which stores a computer program, and the computer program is used to execute any of the above-mentioned methods for sorting test cases.

[0057] The present invention also provides an electronic device, the electronic device comprising:

[0058] processor;

[0059] a memory for storing instructions executable by the processor;

[0060] The processor is used to read the executable instructions from the memory and execute the instructions to implement any of the methods for sorting test cases.

[0061] The present invention calculates the priority of the test case, so that the test case selection process has low complexity, has low requirements on the computing and storage capabilities of the device, and is suitable for efficient execution on the terminal device. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] Figure 1 is a flow chart of the method of the present invention;

[0063] Figure 2 is a flow chart of an embodiment of the method of the present invention;

[0064] Figure 3 It is a structural diagram of the system of the present invention. DETAILED DESCRIPTION

[0065] Now, exemplary embodiments of the present invention are described with reference to the accompanying drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. These embodiments are provided to disclose the present invention in detail and completely and to fully convey the scope of the present invention to those skilled in the art. The terms used in the exemplary embodiments shown in the accompanying drawings are not intended to limit the present invention. In the accompanying drawings, the same units / elements are marked with the same reference numerals.

[0066] Unless otherwise specified, the terms (including technical terms) used herein have the commonly understood meanings to those skilled in the art. In addition, it is understood that the terms defined in commonly used dictionaries should be understood to have the same meanings as those in the context of the relevant fields, and should not be understood as idealized or overly formal meanings.

[0067] The present invention proposes a method for sorting test cases, such as Figure 1 As shown, including:

[0068] Collect use case information for operating system test cases;

[0069] Determine functional parameters of the test case according to the use case information, and calculate the priority of the functional parameters;

[0070] The test case with the highest priority of functional parameters is selected and the test case is executed.

[0071] The present invention will be further described below in conjunction with embodiments:

[0072] like Figure 2 As shown, the implementation process of the embodiment is as follows:

[0073] 1. Test case information collection:

[0074] ① The design developers listed all the functional sets as:

[0075] Func={func1,func2,…,func N}

[0076] Where N is the number of functions;

[0077] ② The tester generates a set of test cases based on the function set Func as follows:

[0078] TCase={tcase1,tcase2,…,tcase M}

[0079] Where M is the number of test cases; each test case is used to test one or more functions, and the functions covered by all test cases are recorded as the coverage matrix CM 0 , the matrix size is M rows and N columns, covering each element of the matrix If it is 1, it means the test case tcase i Can be used to test the function func j ,like If it is 0, it means the test case tcase i Cannot test function func j , where 1≤i≤M, 1≤j≤N.

[0080] ③ Select several commonly used application software and extract the usage frequency of these application software for all functions of the embedded system Fuse = {fuse1, fuse2,…, fuse N}, where fuse i Indicates the application software's use of the embedded operating system function func i The frequency of use, 1≤i≤M, fuse i ≥0, fuse i The larger the function, the func i The more frequently it is used by the application software;

[0081] ④ Based on experience and the open operating system vulnerability library, developers established the impact set of all functions as follows:

[0082] Feft={feft1,feft2,…,feft N}

[0083] where feft i For the function func i The influence degree, 1≤i≤M, 0≤feft i ≤1, 1, 2, 3, 4, 5, 6, 7, 8, 9, i The larger the function, the func i The greater the impact on the embedded operating system after an error occurs;

[0084] 2. Calculate test case priority

[0085] ① According to the test case coverage matrix CM 0 Calculate the initial functional coverage set of test cases as follows:

[0086]

[0087] in

[0088]

[0089] Represents the test case tcase i The coverage of the function to be tested, that is, the test case tcase i The ratio of the number of functions covered to the total number of functions N;

[0090] ② Calculate the function usage frequency set according to the function usage frequency set Fuse, as follows:

[0091] FF={ff1,ff2,…,ff N}

[0092] in

[0093]

[0094] Indicates the usage frequency of function funcj, 1≤j≤N.

[0095] ③ Calculate the importance set of functions based on the frequency set FF and the influence set Feft of the functions, as follows:

[0096] FI={fi1,fi2,…,fi N};

[0097] in

[0098] fi j =ff j ×feft j

[0099] Represents the function func j The importance of, 1≤j≤N.

[0100] ④Based on the test case coverage matrix CM 0 The initial test case importance set is calculated based on the function importance set FI as follows:

[0101]

[0102] in

[0103]

[0104] Represents the test case tcase i The importance of the test case tcase i The average importance of each feature covered.

[0105] ⑤Assume that each function func j Initial failure rate Each test case tcase i The initial failure rate is as follows:

[0106]

[0107] is the average of the initial failure rates of all functions covered by it. The initial function failure rate set and test case failure rate set are:

[0108]

[0109] Among them, 1≤i≤M, 1≤j≤N.

[0110] ⑥ According to the initial functional coverage set CR of the test case 0 , importance set TI 0 and the failure rate set Tbug 0 , calculate the initial priority set of test cases as follows:

[0111]

[0112] in

[0113]

[0114] Represents the test case tcase i The initial priority is tcase i The weighted sum of the initial function coverage, importance and failure rate. α1, α2 and α3 are the function coverage weight, importance weight and failure rate weight respectively.

[0115] in:

[0116] 0≤α1,α2,α3≤1, α1+α2+α3=1;

[0117] The specific values ​​of α1, α2, and α3 are set by the tester based on experience and actual conditions.

[0118] ⑦ Set the system test coverage set SysTest = {st1,st2,…,st N}, where each element is 0, select the test case with the highest priority tcase k As the test case executed for the first time, 1≤k≤M.

[0119] 3. Execute the test case. If the current test case is executed for the t-1th time (2≤t≤M), the specific operations are as follows:

[0120] ①Use the selected test case tcase k Test the embedded operating system and record the test results k , result k =1 means the test failed, result k =0 means the test passed;

[0121] ②Update the system test coverage set as follows:

[0122] SysTest={st1,st2,…,st N}

[0123] Traverse the function coverage matrix CM t-1 All elements in row k like Then st j Set to 1, where 1≤j≤N;

[0124] ③Calculate the system test coverage as follows:

[0125]

[0126] If SysCoverage is greater than or equal to the test termination threshold CoverThreshold, the test is terminated; otherwise, the process jumps to step 4 to select the next test case to be executed.

[0127] 4. Select a new test case. If the tth test case is currently selected (2≤t≤M), perform the following operations after completing the test of the t-1th test case:

[0128] ① Update function failure rate: If the previous test case tcase k Test results k =1, then the test case tcase k The failure rate of the covered function is increased, that is, the traversal for function, when hour otherwise Where δ is the fault increment, which is set by the system tester based on experience; if the test result result k =0, then the test case tcase k The failure rates of all covered functions are set to 0, and the failure rates of other functions remain unchanged, that is, traversal for Function otherwise The current set of functional failure rates is:

[0129]

[0130] Where 1≤j≤N;

[0131] ② Update the current coverage matrix CM t : The last run test case tcase k All columns with values ​​of 1 in the row are set to 0, that is, traversing like Then set the current coverage matrix CM t All elements in the jth column of

[0132]

[0133] ③ Update the current test case functional coverage: The number of functions that have not been tested yet is as follows:

[0134]

[0135] Test case tcase i The current functional coverage is as follows:

[0136]

[0137] The current test case functional coverage set is:

[0138]

[0139] Where 1≤i≤M;

[0140] ④ Update the current test case failure rate: based on the current functional failure rate and coverage matrix CM t , calculate each test case tcase that currently covers the untested functions i The current failure rates are as follows:

[0141]

[0142] The failure rates of all test cases constitute the current test case failure rate set, as follows:

[0143]

[0144] If a test case does not currently cover a function that has not been tested, its failure rate is 0, where 1≤i≤M;

[0145] ⑤Update the current test case importance: based on the function importance set FI and the current coverage matrix CM t , calculate each test case tcase i The current importance is as follows:

[0146]

[0147] The importance of all test cases constitutes the current test case importance set, as follows:

[0148]

[0149] Among them, 1≤i≤M;

[0150] ⑥ Update the current test case priority: according to each test case tcase i Current functional coverage Importance and failure rate Calculate test case tcase i The current priorities are as follows:

[0151]

[0152] The priorities of all test cases constitute the current priority set, as follows:

[0153]

[0154] Where 1≤i≤M;

[0155] ⑦ From the current priority set Prio t Select the test case tcase with the highest priority k As the test case executed for the tth time, where 1≤k≤M;

[0156] ⑧Go to step 3 to execute the test case.

[0157] The present invention also proposes a system for sorting test cases, comprising:

[0158] A collection unit 201 collects use case information of operating system test cases;

[0159] A priority calculation unit 202 determines the function parameters of the test case according to the use case information and calculates the priority of the function parameters;

[0160] The sorting unit 203 selects the test case with the highest priority of the functional parameter and executes the test case.

[0161] The judgment unit 204 records the test results after executing the test case;

[0162] Determine whether the operating system terminates the test based on the test results. If terminated, end the operating system function test. If not terminated, update the functional parameters of the test case based on the test results, calculate the priority of the functional parameters again, and select the test case with the highest functional parameter priority and execute it.

[0163] Among them, functional parameters include: functional coverage, importance and failure rate of test cases.

[0164] The use case information includes: the function set of the operating system, the function coverage information of the test case, the function impact of the operating system and the failure rate of the operating system.

[0165] Among them, collect the use case information of the operating system test case, specifically:

[0166] Obtaining a list of operating system functions, operating system test cases and system functions covered by the test cases, the frequency of use of operating system functions, and the safety impact of operating system functions;

[0167] The use case information is extracted from the function list of the operating system, the test cases of the operating system and the system functions covered by the test cases, the frequency of use of the system functions of the operating system, and the safety impact of the system functions of the operating system.

[0168] The step of determining the functional parameters of the test case according to the use case information and calculating the priority of the functional parameters specifically includes:

[0169] Establish a function coverage matrix for the test case, set the elements corresponding to the functions covered by the test case to 1, and set the elements corresponding to the functions not covered by the test case to 0, and calculate the initial function coverage rate of the test case, which is the ratio of the number of functions covered by the test case to the total number of functions;

[0170] Calculate the frequency of use of system functions by application software in the operating system, where the frequency of use of the system functions is the ratio of the system function use frequency to the sum of the function frequencies;

[0171] Calculate the importance of the system function in the operating system according to the frequency of use of the system function, where the importance of the system function is the product of the frequency of use of the function and the security impact;

[0172] Calculate the importance of the test case according to the importance of the system function, where the importance of the test case is the average importance of the system functions covered by the test case but not yet tested;

[0173] Setting a failure rate of a system function and calculating a failure rate of a test case, wherein the failure rate of the test case is an average of failure rates of system functions covered by the test case but not yet tested;

[0174] The priority of the test case is calculated according to the functional coverage, importance and failure rate of the test case, and the priority is the weighted sum of the functional coverage, importance and failure rate.

[0175] Among them, it is determined whether the operating system terminates the test according to the test results. If it is terminated, the operating system function test is ended. If it is not terminated, the function parameters of the test case are updated according to the test results, and the priority of the function parameters is calculated again, and the test case with the highest function parameter priority is selected and executed. Specifically:

[0176] When the operating system is determined to be terminated according to the test results, the failure rate of the function covered by the test case is set to 0. When the operating system is determined to be not terminated according to the test results, the failure rate covered by the test case is updated using the failure increment, and the failure rate of the function not covered remains unchanged;

[0177] Update the current function coverage matrix, remove the impact of the tested test cases and covered functions in the coverage matrix, and set the rows of the tested test cases and the columns of the covered system functions in the function coverage matrix to 0;

[0178] Update the functional coverage of the test cases according to the updated functional coverage matrix;

[0179] According to the updated functional failure rate, update the failure rate of each test case that covers the function that has not been tested;

[0180] Update the importance of test cases;

[0181] Update the priority of test cases based on the updated test case coverage, importance, and failure rate;

[0182] According to the updated priorities of the test cases, the test case with the highest priority is selected to perform functional testing of the operating system.

[0183] The present invention also proposes a computer-readable storage medium, which stores a computer program, and the computer program is used to execute any of the above-mentioned methods for sorting test cases.

[0184] The present invention also provides an electronic device, the electronic device comprising:

[0185] processor;

[0186] a memory for storing instructions executable by the processor;

[0187] The processor is used to read the executable instructions from the memory and execute the instructions to implement any of the methods for sorting test cases.

[0188] The present invention calculates the priority of the test case, so that the test case selection process has low complexity, has low requirements on the computing and storage capabilities of the device, and is suitable for efficient execution on the terminal device.

[0189] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The schemes in the embodiments of the present invention may be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.

[0190] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0191] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0192] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0193] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0194] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A method for sorting test cases, the method comprising: Collect use case information for operating system test cases; Determine functional parameters of the test case according to the use case information, and calculate the priority of the functional parameters; Select the test case with the highest priority of functional parameters and execute the test case; After executing the test cases, record the test results; Determine whether the operating system terminates the test according to the test result, and if so, end the operating system function test; if not, update the function parameters of the test case according to the test result, calculate the priority of the function parameters again, and select the test case with the highest function parameter priority and execute the test case; The method of determining whether the operating system terminates the test according to the test result, and ending the operating system function test if it is terminated, and if it is not terminated, updating the function parameters of the test case according to the test result, and calculating the priority of the function parameters again, and selecting the test case with the highest function parameter priority and executing the test case, is specifically as follows: When the operating system is determined to be terminated according to the test results, the failure rate of the function covered by the test case is set to 0. When the operating system is determined to be not terminated according to the test results, the failure rate covered by the test case is updated using the failure increment, and the failure rate of the function not covered remains unchanged; Update the current function coverage matrix, remove the impact of the tested test cases and covered functions in the coverage matrix, and set the rows of the tested test cases and the columns of the covered system functions in the function coverage matrix to 0; Update the functional coverage of the test cases according to the updated functional coverage matrix; According to the updated functional failure rate, update the failure rate of each test case that covers the function that has not been tested; Update the importance of test cases; Update the priority of test cases based on the updated test case coverage, importance, and failure rate; According to the updated priorities of the test cases, the test case with the highest priority is selected to perform functional testing of the operating system.

2. The method according to claim 1, wherein the functional parameters include: Functional coverage, importance and failure rate of test cases.

3. The method according to claim 1, wherein the use case information comprises: The functional set of the operating system, the functional coverage information of the test cases, the functional impact of the operating system and the failure rate of the operating system.

4. According to the method of claim 1, the collecting of use case information of operating system test cases is specifically: Obtaining a list of operating system functions, operating system test cases and system functions covered by the test cases, the frequency of use of operating system functions, and the safety impact of operating system functions; The use case information is extracted from the function list of the operating system, the test cases of the operating system and the system functions covered by the test cases, the frequency of use of the system functions of the operating system, and the safety impact of the system functions of the operating system.

5. The method according to claim 1, wherein determining the functional parameters of the test case according to the use case information and calculating the priority of the functional parameters specifically comprises: Establish a function coverage matrix for the test case, set the elements corresponding to the functions covered by the test case to 1, and set the elements corresponding to the functions not covered by the test case to 0, and calculate the initial function coverage rate of the test case, which is the ratio of the number of functions covered by the test case to the total number of functions; Calculate the frequency of use of system functions by application software in the operating system, where the frequency of use of the system functions is the ratio of the system function use frequency to the sum of the function frequencies; Calculate the importance of the system function in the operating system according to the frequency of use of the system function, where the importance of the system function is the product of the frequency of use of the function and the security impact; Calculate the importance of the test case according to the importance of the system function, where the importance of the test case is the average importance of the system functions covered by the test case but not yet tested; Setting a failure rate of a system function and calculating a failure rate of a test case, wherein the failure rate of the test case is an average of failure rates of system functions covered by the test case but not yet tested; The priority of the test case is calculated according to the functional coverage, importance and failure rate of the test case, and the priority is the weighted sum of the functional coverage, importance and failure rate.

6. A system for sorting test cases, the system comprising: A collection unit, collecting use case information of operating system test cases; A priority calculation unit, which determines the functional parameters of the test case according to the case information and calculates the priority of the functional parameters; A sorting unit selects the test case with the highest priority of functional parameters and executes the test case; The judgment unit, after executing the test case, records the test results; Determine whether the operating system terminates the test according to the test result, and if so, end the operating system function test; if not, update the function parameters of the test case according to the test result, calculate the priority of the function parameters again, and select the test case with the highest function parameter priority and execute the test case; The method of determining whether the operating system terminates the test according to the test result, and ending the operating system function test if it is terminated, and if it is not terminated, updating the function parameters of the test case according to the test result, and calculating the priority of the function parameters again, and selecting the test case with the highest function parameter priority and executing the test case, is specifically as follows: When the operating system is determined to be terminated according to the test results, the failure rate of the function covered by the test case is set to 0. When the operating system is determined to be not terminated according to the test results, the failure rate covered by the test case is updated using the failure increment, and the failure rate of the function not covered remains unchanged; Update the current function coverage matrix, remove the impact of the tested test cases and covered functions in the coverage matrix, and set the rows of the tested test cases and the columns of the covered system functions in the function coverage matrix to 0; Update the functional coverage of the test cases according to the updated functional coverage matrix; According to the updated functional failure rate, update the failure rate of each test case that covers the function that has not been tested; Update the importance of test cases; Update the priority of test cases based on the updated test case coverage, importance, and failure rate; According to the updated priorities of the test cases, the test case with the highest priority is selected to perform functional testing of the operating system.

7. The system according to claim 6, wherein the functional parameters include: Functional coverage, importance and failure rate of test cases.

8. The system according to claim 6, wherein the use case information comprises: The functional set of the operating system, the functional coverage information of the test cases, the functional impact of the operating system and the failure rate of the operating system.

9. The system according to claim 6, wherein the collecting of the use case information of the operating system test case comprises: Obtaining a list of operating system functions, operating system test cases and system functions covered by the test cases, the frequency of use of operating system functions, and the safety impact of operating system functions; The use case information is extracted from the function list of the operating system, the test cases of the operating system and the system functions covered by the test cases, the frequency of use of the system functions of the operating system, and the safety impact of the system functions of the operating system.

10. The system according to claim 6, wherein determining the functional parameters of the test case according to the use case information and calculating the priority of the functional parameters specifically comprises: Establish a function coverage matrix for the test case, set the elements corresponding to the functions covered by the test case to 1, and set the elements corresponding to the functions not covered by the test case to 0, and calculate the initial function coverage rate of the test case, which is the ratio of the number of functions covered by the test case to the total number of functions; Calculate the frequency of use of system functions by application software in the operating system, where the frequency of use of the system functions is the ratio of the system function use frequency to the sum of the function frequencies; Calculate the importance of the system function in the operating system according to the frequency of use of the system function, where the importance of the system function is the product of the frequency of use of the function and the security impact; Calculate the importance of the test case according to the importance of the system function, where the importance of the test case is the average importance of the system functions covered by the test case but not yet tested; Setting a failure rate of a system function and calculating a failure rate of a test case, wherein the failure rate of the test case is an average of failure rates of system functions covered by the test case but not yet tested; The priority of the test case is calculated according to the functional coverage, importance and failure rate of the test case, and the priority is the weighted sum of the functional coverage, importance and failure rate.

11. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to execute the method for sorting test cases described in any one of claims 1 to 5.

12. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the method for sorting test cases described in any one of claims 1-5.