A test case screening method, device, medium, product and equipment
By using clustering and total contribution calculation methods, test cases are automatically filtered, solving the problems of low efficiency and poor accuracy in test case filtering in existing technologies, and achieving efficient and accurate test case filtering.
Patent Information
- Application Number
- CN202511935955.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-22
- Publication Date
- 2026-03-17
- Estimated Expiration
- 2045-12-22
AI Technical Summary
Existing technologies suffer from low efficiency and low automation in large-scale regression testing, and the assessment of coverage contribution is inaccurate, leading to inaccurate screening results.
By obtaining the test case name, random seed, and coverage information from the coverage report, clustering is performed to calculate the total contribution of each test scenario, and test cases are automatically filtered according to the filtering threshold, thus achieving automated screening of test cases.
It improves the accuracy and efficiency of test case selection results, reduces the probability of errors in manual selection, and optimizes the efficiency of coverage collection and regression testing.
Smart Images

Figure CN121387753B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software testing technology, and in particular to a test case selection method, apparatus, computer-readable storage medium, computer program product, and terminal device. Background Technology
[0002] Coverage is a measure of test completeness, used to measure the ratio of tested to untested parts of a design, typically defined as the percentage of parts that have met the required testing criteria. Current coverage collection methods involve using VCS (Verilog Compiler Simulator) software to simulate written test cases. During simulation, VCS automatically collects various types of coverage, such as line coverage, inversion coverage, finite state machine coverage, branch coverage, and functional coverage. Through multiple rounds of simulation, coverage collection is complete if the coverage reaches the target value (e.g., 100%).
[0003] In large-scale regression testing, the number of test cases is enormous. Using all these test cases without filtering them would lead to a waste of computing power and time, severely impacting the efficiency of coverage collection and regression testing. Therefore, filtering test cases is essential for efficiency optimization. The contribution of test cases to coverage is a core indicator of test quality, reflecting the extent to which test cases cover the software's functionality, code, and requirements. Therefore, filtering test cases with lower contributions to coverage is an effective filtering method.
[0004] However, existing technologies typically treat test cases with different random seeds but the same test scenario as independent individuals, evaluating their contribution to coverage separately. This fails to determine the total contribution of test cases to coverage within a specific test scenario, thus affecting the accuracy of the contribution evaluation results and consequently the accuracy of the test case selection results. Furthermore, in actual test case selection, manual identification of test cases with low contribution to coverage from the coverage report is required, resulting in low automation. The coverage report also contains excessive redundant information, hindering the rapid identification of low-contribution test cases and impacting selection efficiency. Additionally, the higher probability of errors in manual selection further affects the accuracy of the selection results. Summary of the Invention
[0005] The purpose of this invention is to provide a test case screening method, apparatus, computer-readable storage medium, computer program product, and terminal device, which can improve the accuracy of test case screening results and improve the screening efficiency of test cases.
[0006] To achieve the above objectives, embodiments of the present invention provide a test case filtering method, including:
[0007] Obtain pre-configured command-line parameters; wherein, the command-line parameters include the coverage report input path and the filtering threshold;
[0008] Read the coverage report according to the input path of the coverage report, and extract the test case name, random seed and coverage information of each test case in the coverage report;
[0009] Based on the extracted test case names, random seeds, and coverage information, test cases with the same test case name but different random seeds are clustered.
[0010] Based on the clustering results of all test cases in the coverage report, obtain the total contribution of each test case to the coverage in each test scenario;
[0011] Test cases are filtered based on the aforementioned screening threshold and the total contribution of each test case to coverage in each test scenario, and the filtering results are obtained.
[0012] Furthermore, the extraction of the test case name, random seed, and coverage information for each test case in the coverage report specifically includes:
[0013] The starting position of the coverage data included in the coverage report is determined using a regular expression matching algorithm;
[0014] Starting from the initial position, the test case name, random seed, and coverage information of each test case in the coverage data are extracted using a regular expression matching algorithm.
[0015] Furthermore, the step of obtaining the total contribution of test cases to coverage in each test scenario based on the clustering results of all test cases in the coverage report specifically includes:
[0016] Based on the clustering results of all test cases in the coverage report, the coverage information of all test cases contained in each cluster is obtained; wherein, each cluster contains a group of test cases with the same test case name but different random seeds, and one cluster corresponds to one test scenario;
[0017] The coverage information of all test cases in each cluster is merged to obtain the total contribution of each test case to the coverage in each test scenario.
[0018] Furthermore, the command-line parameters also include the output path for the filtered results, and the method further includes:
[0019] The filtering results are output to the test case filtering report according to the filtering result output path.
[0020] Furthermore, the command-line parameters also include filtering the report output format, and the method further includes:
[0021] The filtering results are output to the test case filtering report according to the filtering report output format.
[0022] Furthermore, the output format of the screening report includes a detailed mode and a simplified mode;
[0023] In the detailed mode, the test case screening report shall include at least the test case name, random number of times, and coverage information of the screened test cases;
[0024] In the simplified mode, the test case screening report only includes the test case names of the screened test cases.
[0025] To achieve the above objectives, embodiments of the present invention also provide a test case screening device, comprising:
[0026] The command-line parameter acquisition module is used to acquire pre-configured command-line parameters, including the coverage report input path and the filtering threshold.
[0027] The test case extraction module is used to read the coverage report according to the coverage report input path and extract the test case name, random seed and coverage information of each test case in the coverage report;
[0028] The test case clustering module is used to cluster test cases with the same test case name but different random seeds based on the extracted test case name, random seed and coverage information;
[0029] The contribution acquisition module is used to obtain the total contribution of each test case to the coverage in each test scenario based on the clustering results of all test cases in the coverage report.
[0030] The test case filtering module is used to filter test cases based on the filtering threshold and the total contribution of each test case to the coverage in each test scenario, and obtain the filtering results.
[0031] This invention also provides a computer-readable storage medium including a stored computer program, which, when running, controls the device where the computer-readable storage medium is located to execute the test case screening method described above.
[0032] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the test case screening method described in any of the preceding embodiments.
[0033] This invention also provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the test case screening method described in any of the preceding embodiments when executing the computer program.
[0034] Compared with existing technologies, embodiments of the present invention provide a test case screening method, apparatus, computer-readable storage medium, computer program product, and terminal device. First, pre-configured command-line parameters are obtained, including a coverage report input path and a screening threshold. Then, a coverage report is read according to the coverage report input path, and the test case name, random seed, and coverage information of each test case in the coverage report are extracted. Next, based on the extracted test case name, random seed, and coverage information, test cases with the same name but different random seeds are clustered. Then, based on the clustering results of all test cases in the coverage report, the total contribution of test cases to coverage in each test scenario is obtained. Finally, test cases are screened according to the screening threshold and the total contribution of test cases to coverage in each test scenario to obtain the screening results. The embodiments of this invention can aggregate and calculate the total contribution of test case coverage across test scenarios, eliminating the interference of random seed differences on the evaluation of test case coverage contribution, thereby improving the accuracy of test case contribution evaluation results and thus improving the accuracy of test case selection results based on coverage contribution. Simultaneously, it can automate the test case selection process, increasing data processing speed and thus improving test case selection efficiency. Furthermore, it can reduce the probability of errors introduced by manual selection, further improving the accuracy of test case selection results. Attached Figure Description
[0035] Figure 1 This is a flowchart of a test case screening method provided in an embodiment of the present invention;
[0036] Figure 2 This is a detailed flowchart of a test case screening method provided in an embodiment of the present invention;
[0037] Figure 3 This is a structural block diagram of a test case screening device provided in an embodiment of the present invention;
[0038] Figure 4 This is a structural block diagram of a terminal device provided in an embodiment of the present invention. Detailed Implementation
[0039] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0040] This invention provides a test case filtering method, see [link to relevant documentation]. Figure 1 The diagram shows a flowchart of a test case screening method according to an embodiment of the present invention, the method comprising steps S11 to S15:
[0041] Step S11: Obtain pre-configured command line parameters; wherein, the command line parameters include the coverage report input path and the filtering threshold;
[0042] Step S12: Read the coverage report according to the coverage report input path, and extract the test case name, random seed and coverage information of each test case in the coverage report;
[0043] Step S13: Based on the extracted test case names, random seeds, and coverage information, cluster test cases with the same test case name but different random seeds;
[0044] Step S14: Based on the clustering results of all test cases in the coverage report, obtain the total contribution of each test case to the coverage in each test scenario;
[0045] Step S15: Filter test cases according to the filtering threshold and the total contribution of test cases to coverage in each test scenario to obtain the filtering results.
[0046] In specific implementation of this invention, firstly, pre-configured command-line parameters are obtained. These parameters include at least a coverage report input path and a filtering threshold. The coverage report input path indicates the reading path of the coverage report, and the filtering threshold serves as a comparison threshold used for test case filtering, determining the threshold at which test cases with a total contribution below a certain level will be filtered out. Then, the coverage report is read according to the pre-configured input path, and its contents are analyzed line by line to extract the test case name, random seed, and coverage information for each test case contained in the coverage report. Next, after extracting the test case name, random seed, and coverage information for each test case, based on the extracted test case name, random seed, and coverage information, test cases with the same name but different random seeds are filtered out. Test cases with different random seeds are clustered (i.e., each extracted test case is clustered according to the criterion of "same test case name but different random seeds," where the same test case name indicates that the test case corresponds to the same test scenario). After all test cases included in the coverage report have been clustered, the clustering results are obtained. The clustering results include several clusters, and each cluster corresponds to a test scenario. Then, based on the clustering results of all test cases included in the coverage report, the total contribution of test cases to coverage in each test scenario is obtained. Finally, a pre-configured filtering threshold is compared with the total contribution of test cases to coverage in each test scenario to filter out test cases with a total contribution lower than the filtering threshold, and the filtering results are obtained accordingly.
[0047] It should be noted that command-line arguments refer to the input parameters that are passed directly to the program via the command line when the program is running. These parameters allow users to dynamically control the behavior of the program without modifying the program code. Therefore, users can pre-configure various parameters they need in the command line, such as the coverage report input path and the filtering threshold.
[0048] It should be noted that since command-line parameters can be configured by the user, this embodiment of the invention can support setting different filtering thresholds through command-line configuration parameters to adapt to different test case filtering needs, thereby improving the application flexibility of the test case filtering scheme and enhancing its scalability.
[0049] It should be noted that after extracting the test case name, random seed, and coverage information for each test case, the extracted text data can be packaged and stored in an object to realize the transformation of unstructured text data (formats that are easy for users to read, such as a text description) into structured data objects, so that computer programs can easily recognize and process it. For example, taking the use of a class to store structured data as an example, the transformation process includes: (1) defining a class and defining multiple member variables in the class; (2) instantiating an object with the class; (3) assigning the extracted text data to the member variables of the object. After the above three steps, the text data is stored in the object, and the object is structured, thus realizing the transformation of unstructured text data into structured data objects.
[0050] It should be noted that the embodiments of the present invention are preferably applicable to the front-end verification of large-scale digital integrated circuits. By automatically screening out test cases with low contribution to coverage in large-scale regression testing, and dynamically adjusting the regression strategy according to the screening results (automatically removing the screened test cases with low contribution to coverage during the coverage collection process), the number of regressions of low contribution test cases can be reduced without affecting the completeness of coverage, thereby effectively improving the efficiency of coverage collection and regression testing.
[0051] It should be noted that the coverage involved in the embodiments of the present invention does not refer to a specific type of coverage, but rather takes into account all coverage types. Therefore, when screening test cases with low contribution to coverage, it can be understood that the coverage contribution takes into account the overall contribution of all coverage types.
[0052] The test case filtering method provided in this invention clusters test cases with the same name but different random seeds, grouping all test cases under the same test scenario into one cluster. It then obtains the total contribution of test cases to coverage within the same test scenario and filters test cases based on a pre-configured filtering threshold and the obtained total contribution. This method achieves aggregated calculation of the total contribution to coverage at the test scenario level, eliminating the interference of random seed differences on the evaluation of test case coverage contribution, reducing the impact of random seeds on the evaluation, and thus improving the accuracy of the test case contribution evaluation results. This, in turn, improves the accuracy of the filtering results when filtering test cases based on coverage contribution. Furthermore, by using scripts to automate data acquisition, clustering, contribution calculation, and test case filtering, the method automates the test case filtering process, increases data processing speed, improves the efficiency of test case filtering, and reduces the probability of errors introduced by manual filtering, further enhancing the accuracy of the filtered test cases.
[0053] In one optional embodiment, extracting the test case name, random seed, and coverage information for each test case in the coverage report specifically includes:
[0054] The starting position of the coverage data included in the coverage report is determined using a regular expression matching algorithm;
[0055] Starting from the initial position, the test case name, random seed, and coverage information of each test case in the coverage data are extracted using a regular expression matching algorithm.
[0056] Specifically, in conjunction with the above embodiments, when extracting the test case name, random seed, and coverage information of each test case in the coverage report, a regular expression matching algorithm can be used to skip the header of the coverage report and determine the starting position of the test case coverage data portion contained in the coverage report (equivalent to locating the starting position of valid data). Then, starting from this starting position, the test case coverage data is parsed line by line, and the test case name, random seed, and coverage information of each test case contained in the test case coverage data are extracted sequentially using the regular expression matching algorithm.
[0057] It should be noted that, for regular expression matching algorithms, based on regular expression matching and string processing techniques, a specific character representing the "starting position" can be found in the coverage report to determine the starting position of the test case coverage data section. For example, if a line containing both "TOTAL" and "INCR" but not "LINE" is found in the coverage report, then this line is the starting position of the test case coverage data section.
[0058] It should be noted that, for regular expression matching algorithms, based on regular expression matching and string processing techniques, specific characters indicating the location of test cases can be found from the test case coverage data to determine the test case name. For example, assuming that all test case names are followed by "simv / ", then as long as the regular expression matching algorithm matches "simv / ", the content following it (i.e., the test case name) can be directly extracted.
[0059] The test case screening method provided in this invention uses a regular expression matching algorithm to accurately locate the starting position of coverage data and extract relevant data of test cases. This avoids the problems of missed or misreading during manual identification, ensuring that no relevant data of any test case is missed, thereby improving the completeness and accuracy of data extraction. It provides a complete and reliable data foundation for subsequent clustering and contribution calculation, avoiding clustering errors or contribution calculation deviations caused by missing or incorrect data. At the same time, it can quickly adapt to coverage reports of different formats, thereby enhancing the versatility of the test case screening scheme.
[0060] In one optional embodiment, obtaining the total contribution of test cases to coverage in each test scenario based on the clustering results of all test cases in the coverage report specifically includes:
[0061] Based on the clustering results of all test cases in the coverage report, the coverage information of all test cases contained in each cluster is obtained; wherein, each cluster contains a group of test cases with the same test case name but different random seeds, and one cluster corresponds to one test scenario;
[0062] The coverage information of all test cases in each cluster is merged to obtain the total contribution of each test case to the coverage in each test scenario.
[0063] Specifically, in conjunction with the above embodiments, since the clustering results include several clusters, each cluster contains a group of test cases with the same test case name (indicating the same test scenario) but different random seeds, and each cluster corresponds to a test scenario, when obtaining the total contribution of test cases to coverage in each test scenario based on the clustering results of all test cases in the coverage report, we can first obtain the coverage information of all test cases contained in each cluster in the clustering results according to the clustering results of all test cases contained in the coverage report, and then merge the coverage information of all test cases contained in each cluster to obtain the total contribution of test cases to coverage in each test scenario.
[0064] For example, test case coverage information refers to the contribution of test cases to coverage. Accordingly, when merging the coverage information of all test cases contained in each cluster, the total contribution of test cases to coverage in the corresponding test scenario can be obtained by directly summing the coverage information of all test cases contained in each cluster (i.e., the contribution of test cases to coverage).
[0065] It should be noted that after obtaining the total contribution of test cases to coverage in each test scenario, the total contribution of test cases to coverage in each test scenario can be recorded in a dictionary (a dictionary is a data type in Python that stores multiple key-value pairs, and you can look up the value corresponding to the key by the key). That is, use the test case name as the key and the corresponding total contribution as the value to form a key-value pair and store it in the dictionary. Later, you can look up the corresponding total contribution from the dictionary based on the test case name.
[0066] In one optional embodiment, the command-line parameter further includes a path to the filtered results output, and the method further includes:
[0067] The filtering results are output to the test case filtering report according to the filtering result output path.
[0068] Specifically, in conjunction with the above embodiments, in addition to the coverage report input path and the filtering threshold, the command line parameters may also include the filtering result output path. Then, after filtering test cases according to the filtering threshold and the total contribution of test cases to coverage in each test scenario, and obtaining the filtering results, the obtained filtering results can also be output to the test case filtering report according to the pre-configured filtering result output path.
[0069] The test case filtering method provided in this embodiment of the invention specifies the output path of the filtering results and automatically writes the filtering results into a test case filtering report according to the output path of the filtering results. As a record, it can be easily viewed, archived and analyzed by users. In addition, the test case filtering report can be kept as a document of the test process, thereby improving the traceability of the filtering results.
[0070] In one alternative embodiment, the command-line parameters further include filtering the report output format, and the method further includes:
[0071] The filtering results are output to the test case filtering report according to the filtering report output format.
[0072] Specifically, in conjunction with the above embodiments, in addition to the coverage report input path and the filtering threshold, the command line parameters may also include the filtering report output format. Then, after filtering test cases according to the filtering threshold and the total contribution of each test case to the coverage in each test scenario, and obtaining the filtering results, the obtained filtering results can be output to the test case filtering report according to the pre-configured filtering report output format (in conjunction with the pre-configured filtering result output path).
[0073] The test case screening method provided in this embodiment of the invention can standardize the output format by specifying the output format of the screening report and automatically writing the screening results into the test case screening report according to the output format of the screening report. This can achieve standardized output of the screening results. For example, the relevant data of the screened test cases are formatted in a fixed format, highlighting the key points and making the hierarchy clear, thereby improving the readability of the test case screening report.
[0074] In one optional embodiment, the screening report output format includes a detailed mode and a simplified mode;
[0075] In the detailed mode, the test case screening report shall include at least the test case name, random number of times, and coverage information of the screened test cases;
[0076] In the simplified mode, the test case screening report only includes the test case names of the screened test cases.
[0077] Specifically, in conjunction with the above embodiments, the output format of the screening report can be divided into two types: detailed mode and simplified mode. If the screening results obtained are output to the test case screening report in detailed mode, the test case screening report will record the detailed information of the screened test cases, such as the test case name, random number of times, coverage information (various coverage metrics), etc. If the screening results obtained are output to the test case screening report in simplified mode, the test case screening report will only record the test case name of the screened test cases.
[0078] The test case filtering method provided in this embodiment of the invention allows users to select different output formats according to their actual needs by configuring different filtering report output formats, thereby meeting different information needs and adapting to different usage scenarios, thus improving the flexibility and practicality of the test case filtering scheme.
[0079] See Figure 2 The diagram shown is a detailed flowchart of a test case selection method provided in an embodiment of the present invention. Figure 2 Following all the above embodiments, the detailed implementation process of the embodiments of the present invention will be described below:
[0080] Command line argument acquisition steps: Obtain pre-configured command line arguments, including the coverage report input path, filter threshold, filter result output path, and filter report output format;
[0081] Coverage report reading steps: Read the coverage report according to the pre-configured coverage report input path;
[0082] Starting position location steps: Analyze the content of the coverage report line by line, skip the header of the coverage report, and use the regular expression matching algorithm to determine the starting position of the test case coverage data (i.e., valid data) contained in the coverage report;
[0083] Test case parsing steps: Starting from the beginning, parse the test case coverage data line by line. Use a regular expression matching algorithm to parse the test case data contained in the test case coverage data. The test case data includes the test case name, random seed, and coverage information.
[0084] Test case clustering steps: After obtaining the test case data, cluster test cases with the same test case name but different random seeds, and merge the coverage information of all test cases contained in each cluster according to the clustering results of the test cases contained in the test case coverage data, so as to obtain the total contribution of the test cases to the coverage in each test scenario.
[0085] Judgment Step: Determine if there are any unparsed test cases in the test case coverage data. If yes, return to execute the "Test Case Parsing Step"; otherwise, continue to execute the "Add to Dictionary Step".
[0086] Steps for recording in the dictionary: Record the total contribution of each test case to the coverage in each test scenario into the dictionary;
[0087] Dictionary lookup steps: Query the dictionary to obtain the total contribution of test cases to coverage for each test scenario recorded in the dictionary, and compare the pre-configured filtering threshold with the total contribution of test cases to coverage for each test scenario to filter out test cases with a total contribution lower than the filtering threshold.
[0088] Filtering result output steps: Output the filtering results and output them to the test case filtering report according to the pre-configured filtering result output path and filtering report output format.
[0089] This invention also provides a test case filtering device for implementing the test case filtering method described in any of the above embodiments. See [link to related document]. Figure 3 The diagram shown is a structural block diagram of a test case screening device according to an embodiment of the present invention. The device includes:
[0090] Command line parameter acquisition module 11 is used to acquire pre-configured command line parameters; wherein, the command line parameters include the coverage report input path and the filtering threshold;
[0091] The test case extraction module 12 is used to read the coverage report according to the coverage report input path and extract the test case name, random seed and coverage information of each test case in the coverage report;
[0092] The test case clustering module 13 is used to cluster test cases with the same test case name but different random seeds based on the extracted test case name, random seed and coverage information;
[0093] The contribution acquisition module 14 is used to acquire the total contribution of each test case to the coverage in each test scenario based on the clustering results of all test cases in the coverage report.
[0094] The test case filtering module 15 is used to filter test cases based on the filtering threshold and the total contribution of each test case to the coverage in each test scenario, and obtain the filtering results.
[0095] Preferably, the test case extraction module 12 specifically includes:
[0096] The starting position determination unit is used to determine the starting position of the coverage data included in the coverage report using a regular expression matching algorithm;
[0097] The test case extraction unit is used to extract the test case name, random seed, and coverage information of each test case in the coverage data, starting from the starting position, using a regular expression matching algorithm.
[0098] Preferably, the contribution acquisition module 14 specifically includes:
[0099] The same-cluster coverage acquisition unit is used to obtain the coverage information of all test cases contained in each cluster based on the clustering results of all test cases in the coverage report; wherein, each cluster contains a group of test cases with the same test case name but different random seeds, and one cluster corresponds to one test scenario;
[0100] The cluster contribution merging unit is used to merge the coverage information of all test cases contained in each cluster, and obtain the total contribution of test cases to coverage in each test scenario.
[0101] Preferably, the command-line parameters further include a path for the output of the filtering results, and the device further includes:
[0102] The first screening report output module is used to output the screening results to the test case screening report according to the screening result output path.
[0103] Preferably, the command-line parameters further include a filter report output format, and the device further includes:
[0104] The second screening report output module is used to output the screening results to the test case screening report according to the screening report output format.
[0105] Preferably, the output format of the screening report includes a detailed mode and a simplified mode;
[0106] In the detailed mode, the test case screening report shall include at least the test case name, random number of times, and coverage information of the screened test cases;
[0107] In the simplified mode, the test case screening report only includes the test case names of the screened test cases.
[0108] It should be noted that the test case screening device provided in this embodiment of the invention can implement all the processes of the test case screening method described in any of the above embodiments. The functions and technical effects of each module and unit in the device are the same as the functions and technical effects of the test case screening method described in the above embodiments, and will not be repeated here.
[0109] This invention also provides a computer-readable storage medium including a stored computer program, which, when running, controls the device where the computer-readable storage medium is located to execute the test case screening method described in any of the above embodiments.
[0110] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the test case screening method described in any of the above embodiments.
[0111] This invention also provides a terminal device, see [link to relevant documentation]. Figure 4 The diagram shown is a structural block diagram of a terminal device according to an embodiment of the present invention. The terminal device includes a processor 10, a memory 20, and a computer program stored in the memory 20 and configured to be executed by the processor 10. When the processor 10 executes the computer program, it implements the test case screening method described in any of the above embodiments.
[0112] Preferably, the computer program can be divided into one or more modules / units (such as computer program 1, computer program 2, ...), and the one or more modules / units are stored in the memory 20 and executed by the processor 10 to complete the present invention. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program in the terminal device.
[0113] The processor 10 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor, or the processor 10 may be any conventional processor. The processor 10 is the control center of the terminal device, connecting various parts of the terminal device through various interfaces and lines.
[0114] The memory 20 mainly includes a program storage area and a data storage area. The program storage area can store the operating system, applications required for at least one function, etc., while the data storage area can store related data, etc. Furthermore, the memory 20 can be a high-speed random access memory, or a non-volatile memory, such as a plug-in hard drive, a smart media card (SMC), a secure digital card (SD), and a flash card, or other volatile solid-state storage devices.
[0115] It should be noted that the aforementioned terminal devices may include, but are not limited to, processors and memory, as will be understood by those skilled in the art. Figure 4 The structural block diagram shown is merely a structural example of the terminal device described above and does not constitute a limitation on the structure of the terminal device. The terminal device may include more or fewer components than shown, or combine certain components, or use different components.
[0116] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A test case filtering method, characterized by, The method comprises the following steps: acquiring pre-configured command line parameters; wherein the command line parameters comprise a coverage report input path and a filtering threshold; reading a coverage report according to the coverage report input path, and extracting a case name, a random seed, and coverage information of each test case in the coverage report; clustering test cases with the same case name but different random seeds according to the extracted case name, random seed, and coverage information of the test cases; acquiring a total contribution of test cases to coverage under each test scenario according to the clustering results of all test cases in the coverage report; performing test case filtering according to the filtering threshold and the total contribution of test cases to coverage under each test scenario, and obtaining a filtering result.
2. The test case filtering method of claim 1, wherein, The extraction of the case name, random seed, and coverage information of each test case in the coverage report specifically comprises the following steps: determining a starting position of coverage data contained in the coverage report by using a regular matching algorithm; extracting the case name, random seed, and coverage information of each test case in the coverage data from the starting position by using the regular matching algorithm.
3. The test case filtering method of claim 1, wherein, The acquisition of the total contribution of test cases to coverage under each test scenario according to the clustering results of all test cases in the coverage report specifically comprises the following steps: acquiring coverage information of all test cases contained in each cluster according to the clustering results of all test cases in the coverage report; wherein each cluster contains a group of test cases with the same case name but different random seeds, and one cluster corresponds to one test scenario; merging the coverage information of all test cases contained in each cluster, and correspondingly obtaining the total contribution of test cases to coverage under each test scenario.
4. The test case filtering method of claim 1, wherein, The command line parameters further comprise a filtering result output path, and the method further comprises the following steps: outputting the filtering result into a test case filtering report according to the filtering result output path.
5. The test case filtering method of claim 1, wherein, The command line parameters further comprise a filtering report output format, and the method further comprises the following steps: outputting the filtering result into a test case filtering report according to the filtering report output format.
6. The test case filtering method of claim 5, wherein, The filtering report output format comprises a detailed mode and a brief mode; In the detailed mode, the test case filtering report at least comprises a case name, a random number, and coverage information of the filtered test case; In the brief mode, the test case filtering report only comprises a case name of the filtered test case.
7. A test case filtering apparatus characterized by comprising: The method comprises the following steps: a command line parameter acquisition module, configured to acquire pre-configured command line parameters; wherein the command line parameters comprise a coverage report input path and a filtering threshold; a test case extraction module, configured to read a coverage report according to the coverage report input path, and extract a case name, a random seed, and coverage information of each test case in the coverage report; a test case clustering module, configured to cluster test cases with the same case name but different random seeds according to the extracted case name, random seed, and coverage information of the test cases; The contribution degree acquisition module is configured to acquire a total contribution degree of a test case to coverage under each test scenario according to the clustering result of all test cases in the coverage report. The test case screening module is configured to perform test case screening according to the screening threshold and the total contribution degree of the test case to the coverage under each test scenario, and obtain a screening result.
8. A computer-readable storage medium, characterized in that, The computer program, when executed, controls a device in which the computer readable storage medium is located to perform the test case screening method according to any one of claims 1-6.
9. A computer program product, characterised in that, The computer program, when executed by a processor, implements the test case screening method according to any one of claims 1-6.
10. A terminal device, comprising: The processor, the memory, and the computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the test case screening method according to any one of claims 1-6 when executing the computer program.
Citation Information
Patent Citations
Recommendation method and device of regression test case, medium and equipment
CN114519008A
System testing method and device, computer equipment, computer readable storage medium and computer program product
CN119669085A