Main Content


Generate decision coverage tests for execution-time analysis

Since R2024a



decisionCoverageTest = coder.profile.test.generateTests(modelName) generates decision coverage test cases for the specified model by using Simulink® Design Verifier™. The function ensures 100% decision coverage. It saves the generated test cases in both a MAT data file and a Simulink Test™ compatible MLDATX file. It also generates an harness to run the test file in the current folder.

If you have a Simulink Test license, you can use the MLDATX file for execution-time analysis. If you do not have a Simulink Test license, you can import the tests in the MAT data file to your model as inputs and use those for analysis. For more information on importing data into a model, see Overview of Signal Loading Techniques and Load Input Data for Basic Test Cases. To generate test cases, this function can change model parameter settings which are restored back to the original settings after test generation. In such cases, you get a warning message.

decisionCoverageTest = coder.profile.test.generateTests(modelName,Name=Value) specifies additional name-value arguments. Use this syntax with the input argument in the preceding syntax.


collapse all

This example show how you can use coder.profile.test.generateTests to generate decision coverage tests.

Open the CriticalPathIdentify model.

model= "CriticalPathIdentify";

Generate decision coverage tests, using this command: .

decisionCoverageTest = coder.profile.test.generateTests(model)
Data file:

decisionCoverageTest =


Input Arguments

collapse all

Name of the model, specified as a character vector or string.

Example: "CriticalPathIdentify"

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: decisionCoverageTest = coder.profile.test.generateTests("mymodel", MaxTime=100)

You can provide a custom sldvoptions object. If you do not provide an object, the function creates an object that have these parameter settings, which are different from their default settings.


For more information, see sldvoptions (Simulink Design Verifier).

Maximum time for test generation, specified as a positive integer.

MaxTime specifies the maximum time in seconds for test generation. If the specified time is not sufficient for test generation, the function issues an error and suggests increasing MaxTime value.

Example: decisionCoverageTest = coder.profile.test.generateTests("mymodel", MaxTime=100)

When you set Verbose to true, the function displays the test generation progress details in the MATLAB Command Window and opens the Simulink Design Verifier Results Summary window.

Example: decisionCoverageTest = coder.profile.test.generateTests("mymodel", Verbose=true)

Data Types: logical

Output Arguments

collapse all

Path of the MLDATX test file, returned as a character vector. The function also returns a path to the MAT data file containing the generated test cases.

Version History

Introduced in R2024a