Main Content


Generate test cases from a model



testFile = sltest.testmanager.createTestsFromModel(filePath,modelName,testType) generates test cases based on the model structure. The function creates test cases from test harnesses, Signal Editor scenarios, and Signal Builder groups in the model and assigns them to a test file. If there are multiple Signal Builder groups, the test file includes iterations for each group instead of separate test cases.


collapse all

Create a new test file with new test cases in the Test Manager. Each test case uses a Signal Builder group scenario.

testFile = sltest.testmanager.createTestsFromModel...
testFile = 

  TestFile with properties:

        Name: 'TestFile'
    FilePath: 'C:\MATLAB\TestFile.mldatx'
       Dirty: 0

Input Arguments

collapse all

The path and name of the test file to save the generated test cases to, specified as a character vector.

Example: 'C:\MATLAB\TestFile.mldatx'

The name of the model to generate test cases from, specified as a character vector.

Example: 'sldemo_autotrans'

The type of test cases to generate, specified as a character vector. The function creates test cases using this test case type.

Output Arguments

collapse all

Test file that contains the generated test cases, returned as an sltest.testmanager.TestFile object.

Introduced in R2015b