Documentation

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.

  • Analyzablecomponents are compatible with金宝app®Design Verifier™. The preliminary analysis indicates thatSimulink Design Verifiermight achieve high component coverage.

  • Complexcomponents are also compatible withSimulink Design Verifier. However, the preliminary analysis indicates thatSimulink Design Verifiermight require more time and resources to achieve high component coverage due to component complexity or other factors. For more information, seeSources of Model Complexity.

  • You cannot generate tests forincompatiblecomponents. For more information, seeCheck Model Compatibility.

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

  • Status: The compatibility or complexity

  • 目标: 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.

  • 目标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 theDesign Verifiertab, in theModesection, selectTest Generation, then clickAdvisor.

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

  4. Enter a time value forSeconds per component,这限制了每个compon的分析时间ent. 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. 跟踪从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, enterfuelsysto open thefuelsysmodel.

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

  3. On theDesign Verifiertab, in theModesection, selectTest Generation, then clickAdvisor.

  4. In theSeconds per componenttext box, enter25.

  5. Click the Start Analysis buttonto begin the model analysis.

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

  7. Highlight thecontrol logicsubsystem in the component hierarchy. The analysis was partial, in that it determined 87% of the objectives forcontrol logicby test cases and dead logic. To load the test generation summary, click theShow test generation results summarylink.

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

  8. Click theComponent namehyperlink. Simulink traces to thecontrol logicStateflow®chart.

  9. Generate the full set of tests for the subsystem. In the Test Generation Advisor summary forcontrol logic, clickExtract 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 thesldvextractfunction to extract components into a new model. You can then analyze the individual components, starting with the lowest-level subsystems.

Related Topics