MCDC coverage test method based on Simulink application layer model

By designing the input signal matrix and manually supplementing test cases in the Simulink application layer model, the cumbersome problems of the traditional MCDC test solution are solved, more efficient MCDC coverage testing is achieved, and the reliability and security of the software are improved.

CN118550812APending Publication Date: 2024-08-27上海星宇智行技术有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410382580.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-01
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

The traditional MCDC test solution based on the Simulink application layer model is cumbersome in input signal introduction, causing test engineers to encounter difficulties, and cannot effectively cover every condition and decision in the system, affecting the reliability and security of the software.

Method used

By designing input signals of the same type as the module input data in the Simulink application layer model, using .m script files to generate the input signal matrix through exhaustive methods, and manually supplementing test cases, configuring parameter information and simulation time, the MCDC coverage test is implemented .

Benefits of technology

It simplifies the signal input process, improves test efficiency and reliability, can automatically generate test input, comprehensively covers the conditions and decisions in the system, and reduces the complexity of writing test cases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550812A
    Figure CN118550812A
Patent Text Reader

Abstract

The invention discloses an MCDC coverage test method based on a Simulink application layer model, and the method comprises the steps: S1, determining a module X needing to be tested, stripping the module X from an overall algorithm model, and storing the module X in a Simulink file to form a new model Y; s2, designing an input signal of which the type is the same as that of the input data of the module X in the new model Y; s3, based on the. M script file, generating an input signal matrix through an exhaustion method and storing the input signal matrix; s4, in the new model Y, parameter information is configured, a test type is determined, and a test report is generated; if the input signal matrix generated by the exhaustion method cannot meet the MCDC coverage in the test process, manually supplementing the test case; and S5, improving imperfect items in the new model Y according to a test report. According to the invention, the signal input process can be simplified, and the test efficiency and reliability are improved. By writing the script, various test inputs can be automatically generated to cover different conditions and decisions in the system, so that the MCDC coverage test can be more comprehensively carried out.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of testing technology, and in particular to a MCDC coverage testing method based on a Simulink application layer model. Background Art

[0002] As car ownership continues to increase, how to produce vehicles that customers like has become a key issue for automakers. This places higher demands on developers to cope with the ever-changing market competition and consumer demands.

[0003] At this stage, the V-shaped development process has become the mainstream way of application layer development. In this process, Simulink software is widely used. Simulink software is a powerful modeling tool with many advantages. Simulink software can provide an intuitive graphical interface to facilitate developers to design and simulate models. It supports modular development, so that each component of the system can be developed and tested independently, improving the efficiency and quality of development.

[0004] During the development process, it becomes increasingly important to conduct MCDC (Modified Condition / Decision Coverage) coverage testing. MCDC testing can ensure that test cases cover every condition and decision in the system, thereby improving the reliability and security of the software. However, traditional MCDC testing solutions based on Simulink application layer models are usually only simulated in Simulink software, and the way to import input signals is relatively cumbersome, which brings great trouble to test engineers. Summary of the invention

[0005] In order to solve the problems existing in the prior art, the present invention provides a MCDC coverage testing method based on a Simulink application layer model.

[0006] The technical solution adopted by the present invention to solve the technical problem is: a MCDC coverage test method based on a Simulink application layer model, comprising:

[0007] S1. Determine the module X that needs to be tested, and separate the module X from the overall algorithm model and save it in the Simulink file to form a new model Y;

[0008] S2, designing an input signal in the new model Y that has the same input data type as that of the module X;

[0009] S3, based on the .m script file, generate the input signal matrix by exhaustive method and save it;

[0010] S4. In the new model Y, configure parameter information and determine the test type, and generate a test report; if during the test, the input signal matrix generated by the exhaustive method cannot meet the MCDC coverage, manually supplement the test case;

[0011] S5. Improve the imperfect items in the new model Y according to the test report.

[0012] Furthermore, step S3 specifically includes:

[0013] Get the number of input variables n, traverse the permutations and combinations of n-bit binary numbers by exhaustive enumeration, and use the de2bi function to store the traversed data in a matrix;

[0014] Dynamically generate variables and assign the data in the matrix to the variables to form an input signal matrix;

[0015] Save the input signal matrix as an Excel file.

[0016] Furthermore, the input signal matrix has n columns, and the input signal matrix has 2 n OK.

[0017] Furthermore, in the new model Y, the parameter information of the Form Workspace module is configured, and the timeseries input signal with timing information in the FormWorkspace module is imported into the new model Y, and the coverage requirements of this test are configured in the Setting of the new model Y.

[0018] Furthermore, in the .m script file, read the number of rows of the input signal matrix and set the simulation time of the new model Y to: T = 2 n ×t, T represents the simulation time, and t represents the sampling time.

[0019] Further, step S2 specifically includes: adding an input module to connect with the input of the stripped module X, selecting the Form Workspace module to implement the signal input, and specifying the generated structure data as a double type from the .m script file.

[0020] Furthermore, during testing, in the .m script file, the file name, simulation rate, and simulation time of the new model Y to be run are configured through the Sim function, and the new model Y is run for testing.

[0021] Furthermore, by analyzing the test report, if there is any coverage missing, the cause of the coverage missing is analyzed and improvements are made.

[0022] The beneficial effects of the present invention are:

[0023] By utilizing the powerful data processing capabilities of the m script to generate test cases and realize linkage with the Simulink model, the complexity of writing test cases is greatly reduced.

[0024] Compared with the original debugging process, which requires multiple configurations of Simulink related properties, this method directly transfers the configuration information of the properties to the Simulink model through variables using a script file, improving the problem of manually matching the number of test cases with the simulation time.

[0025] Provides a solution for manually supplementing test cases. When there are situations that cannot be covered by automatically generated test cases, you can manually write test cases through Excel files and merge them with the original test cases directly through m script files. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0027] Figure 1 It is an overall flow chart of the MCDC coverage testing method based on the Simulink application layer model of the present invention.

[0028] Figure 2 It is a specific flow chart of the testing process of the present invention.

[0029] Figure 3 It is a schematic diagram of the simulation test environment constructed by the present invention. DETAILED DESCRIPTION

[0030] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, which only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.

[0031] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In addition, features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "multiple" means two or more.

[0032] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0033] like Figures 1 to 3 As shown, the MCDC coverage test method based on the Simulink application layer model of the present invention includes: S1. Determine the module X that needs to be tested, and separate the module X from the overall algorithm model and save it in the Simulink file to form a new model Y. S2. Design an input signal with the same input data type as the module X in the new model Y. S3. Based on the .m script file, generate and save the input signal matrix by exhaustive method. S4. In the new model Y, configure parameter information and determine the test type, generate a test report, and if during the test process, the input signal matrix generated by the exhaustive method cannot meet the MCDC coverage, manually supplement the test case. S5. According to the test report, improve the imperfect items in the new model Y.

[0034] The test method of the present invention can simplify the process of signal input and improve the efficiency and reliability of the test. By writing scripts, various test inputs can be automatically generated to cover different conditions and decisions in the system, thereby performing MCDC coverage testing more comprehensively.

[0035] Specifically, in step S1, after determining the module X to be tested, first create a new Simulink file, then copy the module X from the overall algorithm model to the newly created Simulink file and save it to obtain the new model Y. Step S2 specifically includes: adding an input module to connect with the input of the stripped module X, selecting the Form Workspace module to implement the signal input, and specifying the generated structure data as double type from the .m script file. Therefore, it is necessary to convert the signal type input by the FormWorkspace module to avoid errors during testing.

[0036] For example, step S3 specifically includes: obtaining the number n of input variables, traversing the permutations and combinations of n-bit binary numbers by exhaustive enumeration, storing the traversed data in a matrix using the de2bi function, dynamically generating variables, assigning the data in the matrix to the variables, forming an input signal matrix, and saving the input signal matrix in the form of an Excel file. For example, the input signal matrix has n columns, and the input signal matrix has 2 nSpecifically, for some boolean type Similink inputs, we can get the number n by traversing all input variables, and then traverse the permutations and combinations of n-bit binary numbers through exhaustive enumeration, and store the data in a matrix. Then, we dynamically generate variables and assign the data in the matrix to the variables. Finally, we use the xlswrite function to write the variable data into an Excel file and save it, so that it can be merged with manually written test cases later.

[0037] Before testing, in the new model Y, configure the parameter information of the Form Workspace module, import the timeseries input signal with timing information in the FormWorkspace module into the new model Y, and configure the coverage requirements of this test in the Setting of the new model Y. In this embodiment, the coverage test checks the MCDC coverage option. Since the Form Workspace module has requirements for the input format, the structure data needs to be specified. During the variable generation process, the input signal needs to be assigned to the structure, and the timeseries format data of the structure needs to be configured. In addition, the input data variable name needs to match the Workspace and set the sampling time. For the configuration of the model test type, in Coverage in Setting, check Enable coverage analysis before configuring the coverage type. This embodiment uses MCDC coverage.

[0038] In the .m script file, read the number of rows of the input signal matrix and set the simulation time of the new model Y to: T = 2 n ×t, T represents the simulation time, t represents the sampling time. For example, when n = 3, 2 3 =8, t=0.01s, the simulation time is 8×0.01=0.08 seconds, the number of rows of the input signal matrix is ​​assigned to the variable, and the variable is configured in the Stop Time option box in the Simulink model, so that the simulation end time can match the number of test cases and avoid the situation where the test cases are not completed.

[0039] During testing, in the .m script file, use the Sim function to configure the file name, simulation rate, and simulation time of the new model Y to be run, and run the new model Y for testing. By analyzing the test report, if there is any coverage, analyze the reasons for the coverage and make improvements. If there is coverage in the test report, the reasons may be: insufficient test cases and unreasonable software logic design. For insufficient test cases, determine the reason why MCDC is not covered according to the content of the test report, manually design test cases in the Excel file of the saved input signal matrix, and then rerun the script to achieve full coverage of MCDC. For unreasonable software logic design, developers need to find out the reasons for coverage and then redesign the model.

[0040] In summary, the MCDC coverage test method based on the Simulink application layer model of the present invention has the following advantages:

[0041] (1) The powerful data processing capabilities of m-script are used to generate test cases and realize linkage with Simulink models, which greatly reduces the complexity of writing test cases.

[0042] (2) Compared with the previous debugging process, which required multiple configurations of Simulink related properties, this method directly transfers the property configuration information to the Simulink model through variables using a script file, thus improving the problem of manually matching the number of test cases with the simulation time.

[0043] (3) Provide a solution for manually supplementing test cases. When there are situations that cannot be covered by the automatically generated test cases, you can manually write test cases through Excel files and directly merge them with the original test cases through m script files.

[0044] Through this method, developers can better cope with the challenges of the automotive industry and improve the reliability and safety of software. At the same time, it also demonstrates the importance and advantages of Simulink in automotive application development and promotes technological progress and development in related fields.

[0045] Based on the above ideal embodiments of the present invention, the relevant staff can make various changes and modifications without departing from the technical concept of the present invention through the above description. The technical scope of the present invention is not limited to the contents of the specification, but must be determined according to the scope of the claims.

Claims

1. A MCDC coverage test method based on Simulink application layer model, characterized in that: include: S1. Determine the module X that needs to be tested, and separate the module X from the overall algorithm model and save it in the Simulink file to form a new model Y; S2, designing an input signal in the new model Y that has the same input data type as that of the module X; S3, based on the .m script file, generate the input signal matrix by exhaustive method and save it; S4. In the new model Y, configure parameter information and determine the test type, and generate a test report; If during the test, the input signal matrix generated by the exhaustive method cannot meet the MCDC coverage, the test cases are manually supplemented; S5. Improve the imperfect items in the new model Y according to the test report.

2. The MCDC coverage test method based on the Simulink application layer model as claimed in claim 1, characterized in that: Step S3 specifically includes: Get the number of input variables n, traverse the permutations and combinations of n-bit binary numbers by exhaustive enumeration, and use the de2bi function to store the traversed data in a matrix; Dynamically generate variables and assign the data in the matrix to the variables to form an input signal matrix; Save the input signal matrix as an Excel file.

3. The MCDC coverage test method based on the Simulink application layer model as claimed in claim 2, characterized in that: The input signal matrix has n columns and 2 n OK.

4. The MCDC coverage test method based on the Simulink application layer model as claimed in claim 2, characterized in that: In the new model Y, configure the parameter information of the Form Workspace module, import the timeseries input signal with timing information in the Form Workspace module into the new model Y, and configure the coverage requirements of this test in the Setting of the new model Y.

5. The MCDC coverage test method based on the Simulink application layer model as claimed in claim 4, characterized in that: In the .m script file, read the number of rows of the input signal matrix and set the simulation time of the new model Y to: T = 2 n ×t, T represents the simulation time, and t represents the sampling time.

6. The MCDC coverage test method based on Simulink application layer model as claimed in claim 1, characterized in that: Step S2 specifically includes: adding an input module to connect with the input of the stripped module X, selecting the Form Workspace module to implement the signal input, and specifying the generated structure data as double type from the .m script file.

7. The MCDC coverage test method based on the Simulink application layer model as claimed in claim 4, characterized in that: During the test, in the .m script file, the file name, simulation rate, and simulation time of the new model Y to be run are configured through the Sim function, and the new model Y is run for testing.

8. The MCDC coverage test method based on Simulink application layer model as claimed in claim 7, characterized in that: By analyzing the test report, if there is any coverage missing, analyze the cause and make improvements.