A test case prioritization method for Simulink testing

By generating and prioritizing Simulink test cases, using feature vectors and difference calculations, the problem of low Simulink testing efficiency and incomplete error detection is solved, a method of quickly identifying Simulink errors is realized, and the efficiency and effectiveness of automatic testing are improved.

CN115098358BActive Publication Date: 2024-10-01DALIAN MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210557212.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-19
Publication Date
2024-10-01
Estimated Expiration
2042-05-19

AI Technical Summary

Technical Problem

The existing Simulink testing method is inefficient and unable to detect various error types. The number of generated test cases is large and the mutation method is single. As a result, it takes a long time to detect errors and cannot fully discover errors.

Method used

Use the test case random generation tool to generate test cases, count module names, module times, subsystem levels, zombie block proportions and structural information, build feature vectors, calculate the difference based on the feature vectors, use cosine similarity to prioritize, and select zombies Those with the largest block proportions and differences are given priority for differential testing.

Benefits of technology

It realizes the rapid identification of differences between Simulink models, improves the efficiency of automatic testing, solves the effectiveness problem of automatic testing under the differential testing framework, and provides new ideas for accelerated testing of Simulink.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115098358B_ABST
    Figure CN115098358B_ABST
Patent Text Reader

Abstract

The invention discloses a test case prioritization method for Simulink testing, comprising: generating test cases by using a test case random generation tool; counting Simulink module names, module appearance times, subsystem layers, zombie block ratios and related test case structure information appearing in each test case; calculating three types of features of feature blocks, complexity and zombie block ratio of each test case by using the counted test case information; constructing a feature vector FV; calculating the difference between every two test cases based on the feature vector FV, and prioritizing Simulink test cases by comprehensively considering the zombie block ratio and the difference; and testing the prioritization result by using a differential test program. The method solves the effectiveness problem of automatic testing under a differential test framework and provides a new idea for accelerated testing of Simulink.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software testing, and in particular to a test case prioritization method for Simulink testing. Background Art

[0002] Chips are called "industrial food" and are the core technology of the manufacturing industry. As the country continues to pay attention to the chip industry, the chip design industry is booming. EDA is a necessary and most important software tool for chip design, so how to achieve efficient and stable EDA is crucial. Simulink is a widely used circuit design EDA, and people are increasingly in urgent need of its normal execution and expected results.

[0003] In recent years, some methods have been proposed to facilitate automated Simulink testing, which can be divided into two categories. One is to generate a large number of test models through some test case generation tools (such as SLforge), and run these generated test models to detect Simulink errors. The other is to perform equivalent module mutation on the existing Simulink model, generate new test cases by processing the zombie blocks in the test cases, and then detect Simulink errors by performing differential testing on the two.

[0004] Regarding method 1, this Simulink testing technology has serious efficiency problems, because they usually need to generate a large number of Simulink programs and continuously test them, so it takes a long time to find Simulink errors. Regarding method 2, although it only needs to perform equivalent module mutation on existing test cases to find Simulink errors, the mutation method is relatively simple, only adding and subtracting modules on the zombie block area, and it is unable to find more diverse error types. Summary of the invention

[0005] In view of the problems existing in the prior art, the present invention discloses a test case prioritization method for Simulink testing, which specifically comprises the following steps:

[0006] Generate test cases using the test case random generation tool, and use the error detection program to determine whether each test case can trigger a Simulink error. If it can trigger a Simulink error, it will be marked as an error case.

[0007] Count the Simulink module names, module appearance times, subsystem levels, zombie block ratios, and related test case structure information that appear in each test case;

[0008] The statistical test case information is used to calculate the three major features of each test case: feature blocks, complexity, and zombie block ratio;

[0009] Construct feature vector FV;

[0010] Calculate the difference between every two test cases based on the feature vector FV, and prioritize Simulink test cases based on the zombie block ratio and difference;

[0011] The prioritized results are tested using a differential testing procedure.

[0012] The characteristic blocks are modules in the test cases that are prone to trigger errors. The complexity includes the size measurement, structure measurement, adaptability measurement and reliability measurement of the test cases. The zombie block ratio is the ratio of modules that have both procedural live code and procedural dead code attributes.

[0013] The values ​​of the three types of features of each test case are standardized to form a feature vector FV.

[0014] The difference between the test cases is calculated based on the feature vector FV, and the cosine similarity is used as the distance calculation method:

[0015] Thus, the difference matrix between each test case is obtained.

[0016] Prioritize test cases based on zombie block ratio and difference: first select the test case with the largest zombie block ratio, put it into the optimization queue SQ, and delete the test case from the test case set TC, select m test cases with the largest zombie block ratio from the updated test case set TC to form the candidate set CQ, and then use the difference strategy to put the test case with the largest difference from all test cases in the optimization queue SQ in the candidate set CQ into the optimization queue SQ, and also delete the test case from the test case set TC, and repeat the above operation until the length of the test case set is 0;

[0017] Use the differential test program to test the prioritized test cases to quickly find Simulink errors.

[0018] Due to the adoption of the above technical solution, the present invention provides a test case prioritization method for Simulink testing, which discloses a method for identifying the difference between Simulink models, including three categories: feature blocks, complexity, and zombie block ratio, solving the efficiency problem in automatic compiler testing technology. In addition, the prioritization method proposed by the method can comprehensively consider the zombie block ratio and the difference between models for sorting, solving the effectiveness problem of automatic testing under the differential testing framework, and providing a new idea for accelerated testing of Simulink. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

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

[0021] Figure 2 It is a schematic diagram of the test case feature block in the present invention. DETAILED DESCRIPTION

[0022] In order to make the technical solutions and advantages of the present invention more clear, the technical solutions in the embodiments of the present invention are clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention:

[0023] like Figure 1 A test case prioritization method for Simulink testing is shown, which specifically includes the following steps:

[0024] S1: Collect test cases, use a test case random generation tool to generate test cases, and collect test cases that can trigger Simulink errors through a third-party library. Use an error detection program to determine whether each test case can trigger a Simulink error. If it can trigger a Simulink error, it will be marked as an error case.

[0025] S2: Process the collected test cases and extract three types of features for prioritization. The specific steps are as follows:

[0026] S21: Extract the feature blocks of the test case. Refer to the idea of ​​extracting features in compiler testing in C language. Only the number of modules that are easy to trigger Simulink errors in each test case is counted, such as Figure 2 As shown;

[0027] S22: Extract the complexity of the test case and evaluate it with reference to the 26 complexity metrics provided by Simulink. These 26 metrics are divided into the following four categories: size metric, structure metric, adaptability metric, and reliability metric.

[0028] S23: Extract the zombie block ratio of the test case, use the built-in function of Simulink to simulate and return the simulation results of the test object, and extract the zombie block ratio in each test case.

[0029] S3: Based on the extracted information, construct a one-hot feature vector for each test case, FV = (η1, η2, L, η n ). The data in the feature vector contains three types of features: feature blocks, complexity, and zombie block ratio. The specific steps are as follows:

[0030] S31: There are 153 feature blocks in total. After the number of each block in the test case is standardized, it is extracted and organized into columns 1-153 of the one-hot vector;

[0031] S32: There are 26 categories of complexity information in total, and the standardized values ​​of each category are organized into 154-180 columns of one-hot vectors;

[0032] S33: For the zombie block ratio, each test case can extract the zombie block ratio in the [0,1] interval and directly use it as the 181st column of the one-hot vector.

[0033] S4: Prioritize the test queue. The specific steps are as follows:

[0034] S41: Calculate the difference between two test cases using cosine similarity;

[0035] S42: Considering the zombie block ratio and difference, first select the test case with the largest zombie block ratio, put it into the optimization queue SQ, and delete the test case from the test case set TC. Select m test cases with the largest zombie block ratio from the updated test case set TC to form an alternative set CQ. Then use the difference strategy to put the test case with the largest difference from all the test cases in the optimization queue SQ in the alternative set CQ into the optimization queue SQ. Also delete the test case from the test case set TC. Repeat the above operation until the length of the test case set is 0.

[0036] S5: Use the differential test program to test the prioritized test cases to quickly find Simulink errors.

[0037] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A test case prioritization method for Simulink testing, characterized in that include: Generate test cases using the test case random generation tool, and use the error detection program to determine whether each test case can trigger a Simulink error. If it can trigger a Simulink error, it will be marked as an error case. Count the Simulink module names, module appearance times, subsystem levels, zombie block ratios, and related test case structure information that appear in each test case; The statistical test case information is used to calculate the three major features of each test case: feature blocks, complexity, and zombie block ratio; Construct feature vector FV; Calculate the difference between every two test cases based on the feature vector FV, and prioritize Simulink test cases based on the zombie block ratio and difference; Testing the prioritization results using a differential testing procedure; Prioritize test cases based on zombie block ratio and difference: first select the test case with the largest zombie block ratio, put it into the optimization queue SQ, and delete the test case from the test case set TC. Select m test cases with the largest zombie block ratio from the updated test case set TC to form the alternative set CQ. Then use the difference strategy to put the test case with the largest difference from all test cases in the optimization queue SQ in the alternative set CQ into the optimization queue SQ. Also delete the test case from the test case set TC. Repeat the above operations until the length of the test case set is 0.

2. The method according to claim 1, characterized in that: The characteristic blocks are modules in the test cases that are prone to trigger errors. The complexity includes the size measurement, structure measurement, adaptability measurement and reliability measurement of the test cases. The zombie block ratio is the ratio of modules that have both procedural live code and procedural dead code attributes.

3. The method according to claim 2, characterized in that: The values ​​of the three types of features of each test case are standardized to form a feature vector FV.

4. The method according to claim 1, characterized in that: The difference between the test cases is calculated based on the feature vector FV, and the cosine similarity is used as the distance calculation method: Thus, the difference matrix between each test case is obtained.

5. The method according to claim 1, characterized in that: Use the differential test program to test the prioritized test cases to quickly find Simulink errors.