Main Content

Use Process Advisor to Streamline Requirements-Based Testing of Models and Generated Code

Note

The information below introduces using the Process Advisor to run the model testing process tasks and review the assessment results. For detailed information, see document Model Testing Process in Process Advisor (lifecycle_automation.pdf). To view the document, in the Process Advisor, click the ellipses (Ellipses icon.) for any task in the Tasks column and then click the Help button.

When testing models in a project that uses a Model-Based Design (MBD) approach, using a model testing process streamlines testing of Simulink® models to help you confirm that models used to generate production code accurately represents the system and meets the project requirements. Following a model testing workflow helps to ensure the accuracy, reliability, and performance of the designed system before deployment.

The Process Automation for Simulink Test™ add-on is an interactive workflow that uses verification and validation tools to assess the completeness of model testing for a project. The add-on uses the Process Advisor to systematically execute pre-defined tasks in the model testing process. These tasks are used to:

  • Assess specification of units and components in the project.

  • Verify that the model design does not introduce unintended functionality.

  • Verify that each requirement has a test.

  • Generate code.

  • Run tests in normal and SIL modes and use aggregate results to verify that the desired level of model and code coverage is achieved.

  • Achieve translation validation through back-to-back testing, which uses both requirements-based and non-requirements-based tests to compare the behavior of the model and generated code. Translation validation provides a high degree of confidence that, for the design, the output of the code generator, compiler, and linker tool chain exhibits equivalent input-output behavior as the model used for production code generation.

The Process Advisor uses data collected from the tasks to identify potential issues in the tests. You can review the results and use the interactive functionality in the model testing process to address assessment issues, such as:

  • Creating test files and tests and link them to existing requirements to resolve gaps in the requirements-based tests.

  • Modifying tests to resolve test failures.

  • Resolving model and code coverage gaps in the tests to achieve the desired level of coverage.

Use the Process Automation for Simulink Test add-on to support your work across all stages of the software development lifecycle, including during the planning and development stages.

After performing the initial assessment, the Process Advisor detects additional changes to your project and determines the impact of the change on your existing task results. For example, when you add a new requirement, the Process Advisor displays a warning in the banner that indicates changes are detected. When you click Refresh Tasks, the Process Advisor rescans the project and marks the affected results as outdated. Use the Run All option to rerun only the tasks with stale results, as well as any tasks that are not executed.

Note

You can use the Process Automation for Simulink Test add-on with R2024a and later.

This table identifies the MathWorks® products required to open the Process Advisor and run the model testing process tasks. Use the add-on manager to review your installed MathWorks products, including support packages and add-ons. During installation, the add-on manager informs you of dependencies that you may need to install before using the product.

MathWorks ProductsUsage
CI Support Package for Simulink support package.

Process Advisor app. Install the support package from the Add-On Explorer.

Process Automation for Simulink Test

Define tasks in the model testing workflow. Download the installer from File Exchange.

Simulink Check™Required to install the CI Support Package for Simulink support package.
Simulink Test

Author and execute tests and collect assessment information. Open the Model Testing Process by using Simulink Test Manager.

Set Up the Model Testing Process

Install the tools needed to assess your project and set up the model testing process in the Process Advisor.

  1. Use the add-on manager to check that these products are installed:

    • Simulink Check

    • Embedded Coder®

    • Requirements Toolbox™

    • Simulink Coverage™

    • CI Support Package for Simulink support package (available from Add-On Explorer).

    • Process Automation for Simulink Test add-on (available from File Exchange).

    Note

    MATLAB® installs add-ons in a default installation folder specific to the platform. For more information, see Default Add-On Installation Folder.

  2. If prompted, restart MATLAB.

  3. Set up the model testing process in the Process Advisor. For more information, see the document Getting Started with Process Automation for Simulink Test. This document is available on File Exchange, under Examples.

    During setup, the Process Advisor automatically creates a default process model file (processmodel.m) for the project. The Process Advisor reads the file and determines which tasks to run, how the tasks perform their actions, and the order in which tasks run. For more information, see Overview of Process Model (Simulink Check).

Open the Process Advisor by Using Simulink Test Manager

Use Simulink Test Manager to open the model testing process in the Process Advisor.

  1. Open a project that has a defined process model file (processmodel.m). The process model file is available in the project files.

    Process model file in the project

    If the project does not contain a process model, then you need to create the file by setting up the model testing process.

  2. Open the existing process model file and verify that the processmodel function contains these code lines.

    %Adds Model Testing Process from Process Automation for Simulink Test Add-On
    if(~isempty(which('pasltest.addProcess')))
        pasltest.addProcess(pm);
    end

    If missing, then add the code to the bottom of the file and save the file. Open the Process Advisor and review the model testing process tasks. Close the Process Advisor.

  3. Open the Simulink Test Manager.

    sltest.testmanager.view
    

  4. In the Results gallery, select Model Testing Process. This option is available only after you install both the Process Automation for Simulink Test add-on and CI Support Package for Simulink support package.

    Open the model testing process by using the Simulink Test Manager.

    The Process Advisor opens and displays the tasks in the model testing process.

    Snapshot of the model testing process tasks in the Process Advisor.

Run Tasks and View Results in the Model Testing Process

Note

For detailed information about running the model testing process and reviewing the results, see Model Testing Process in Process Advisor (lifecycle_automation.pdf). To open the document, click the ellipses (Ellipses icon.) for any task in the Tasks column and then click the Help button.

The tasks in the model testing process appear in the Tasks column. Hover over a task and observe these icons.

  • Run icon. — Run that task and outdated dependent tasks.

  • Information icon. — Review the instructions and guidelines for the task.

  • Ellipses icon. — Lists additional task functionality. Click the Help button to open the Model Testing Process in Process Advisor (lifecycle_automation.pdf) document.

Run all tasks together by using these buttons:

  • Run All — Run all tasks except those with up-to-date results.

  • Run All > Force Run All — Run all tasks, including those with up-to-date results.

  • Run All > Clean All — Clear task results and delete task outputs for each of the tasks.

As you run the tasks in the model testing process, the Process Advisor:

  • Detects the changes, displays a warning banner, and runs tasks with stale results.

  • Displays a Stop button, which ends the task currently running and prevents the next queued tasks from running.

Use icons to quickly review the results:

  • The Tasks column displays these icons for each task. Point to the status icon and view details about the status, including the task status and how long the task took to run.

    • Task run passed icon. — Pass

    • Task run failed icon. — Fail

    • Task run error icon. — Error

    • Task not run icon. — Not run

  • Hover over the icon in the I/O column to review the output artifacts from a task.

  • The Process Advisor aggregates the results of each task. In the Details column, Process Advisor shows the number of passing, warning, or failing results:

    • Icon for results that pass. — Pass

    • Icon for results that produce a warning. — Warning

    • Icon for results that fail. — Fail

  • Grey icons indicate that tasks results are outdated and the task must be rerun.

See Also

Topics

External Websites