Main Content

Use Test Generation Advisor to Identify Analyzable Components

Test Generation Advisor

You can use the Test Generation Advisor to select model components (atomic subsystems and model blocks) for test generation. The Test Generation Advisor summarizes test generation compatibility, condition and decision objectives, and dead logic for the model and model components.

The Test Generation Advisor performs a high-level analysis and fast dead logic detection. You can use the results to better understand your model before test generation, particularly for large models, complex models, or models for which you are uncertain of the test generation compatibility. For example, you can:

  • Identify components that are incompatible with test case generation.

  • Identify complex components that may be time-consuming to analyze.

  • Determine instances of dead logic.

  • Get a snapshot of the component hierarchy.

  • Get recommended test generation parameters.

The Test Generation Advisor classifies components as analyzable, complex, or incompatible.

  • Analyzable components are compatible with Simulink® Design Verifier™. The preliminary analysis indicates that Simulink Design Verifier might achieve high component coverage.

  • Complex components are also compatible with Simulink Design Verifier. However, the preliminary analysis indicates that Simulink Design Verifier might require more time and resources to achieve high component coverage due to component complexity or other factors. For more information, see Sources of Model Complexity.

  • You cannot generate tests for incompatible components. For more information, see Check Model Compatibility.

The results summary displays specific information about the model and each component:

  • Status: The compatibility or complexity

  • Objectives: The number of condition and decision objectives

  • Dead Logic Detected: The number of instances of dead logic decided during the analysis. This might not include every instance of dead logic.

  • Objectives Decided: The percentage of condition and decision objectives determined by test cases and dead logic.

Test Generation Advisor Requirements

For analysis, your model must compile. Also, if you change the model name, you must reload the model and reopen the Test Generation Advisor.

Identify Analyzable Components

To analyze your model using the Test Generation Advisor, follow this high-level workflow:

  1. Open your model.

  2. On the Design Verifier tab, in the Mode section, select Test Generation, then click Advisor.

  3. Your model compiles, and the Test Generation Advisor opens. It displays the model hierarchy and summary table.

  4. Enter a time value for Seconds per component, which limits the analysis time per component. This value does not include time for other operations such as compilation.

  5. Run the analysis by clicking the Start Analysis button . Track the analysis using the progress indicator.

  6. Determine incompatibilities, complexities and characteristics from the component hierarchy tree and the results summary.

  7. Trace from the summary to the model using the component hyperlinks.

Analyze and Generate Tests for Model Components

This example demonstrates analysis and test generation using the Test Generation Advisor. The example model has analyzable and incompatible subsystems.

  1. At the command line, enter fuelsys_docreq to open the fuelsys_docreq model.

  2. Save a copy of the model in a writable location on the MATLAB® path.

  3. On the Design Verifier tab, in the Mode section, select Test Generation, then click Advisor.

  4. In the Seconds per component text box, enter 25.

  5. Click the Start Analysis button to begin the model analysis.

  6. After the analysis is complete, the component tree displays results for the overall model and each component.

  7. Highlight the control logic subsystem in the component hierarchy. The analysis was partial, in that it determined 87% of the objectives for control logic by test cases and dead logic. To load the test generation summary, click the Show test generation results summary link.

    At the bottom of the summary, the table lists recommended test generation parameters.

  8. Click the Component name hyperlink. Simulink traces to the control logic Stateflow® chart.

  9. Generate the full set of tests for the subsystem. In the Test Generation Advisor summary for control logic, click Extract this component and generate tests.

Manually Select Components for Testing

If you know which model components that you want to test, you can manually select these components. Break down the model into components of 100–1000 objectives each. Use the sldvextract function to extract components into a new model. You can then analyze the individual components, starting with the lowest-level subsystems.

Related Topics