Test Scripts

Customize test environment, automate testing

You can use the Simulink® Test™ programmatic interface to:

  • Create test scripts and functions.

  • Run tests from the command line.

  • Set up and standardize your testing environment.

You can use scripts and functions to repeat the same test strategy on multiple systems, or perform regression testing. These functions and classes cover test authoring, execution, and results in Simulink Test. If you want to combine existing Simulink tests with MATLAB® tests, or run tests with continuous integration, use the MATLAB Unit Test Framework. See Continuous Integration.

Simulink Test provides graphical user interfaces to help you create and run tests. For more information, see Test Authoring, Test Execution, and Results, Reports, and Test Management.

Functions

expand all

Test Files

sltest.testmanager.TestFileCreate or modify test file
sltest.testmanager.TestSuiteCreate or modify test suite
sltest.testmanager.TestCaseCreate or modify test case
sltest.testmanager.createTestsFromModelGenerate test cases from a model
sltest.testmanager.copyTestsCopy test cases or test suites to another location
sltest.testmanager.moveTestsMove test cases or test suites to a new location
sltest.testmanager.loadLoad a test file in the Simulink Test manager
sltest.testmanager.getTestFilesGet test files open in the Test Manager
sltest.testmanager.clearClear test files from the Test Manager

Inputs

sltest.testmanager.TestInputAdd or modify test input
sltest.import.sldvDataCreate test cases from Simulink Design Verifier results

Outputs

sltest.testmanager.BaselineCriteriaAdd or modify baseline criteria
sltest.testmanager.EquivalenceCriteriaAdd or modify equivalence criteria
sltest.testmanager.SignalCriteriaAdd or modify signal criteria
sltest.testmanager.CustomCriteriaAdd or modify custom criteria
sltest.testmanager.LoggedSignalCreate or modify logged signals for use as simulation outputs
sltest.testmanager.LoggedSignalSetCreate or modify a set of logged signals

Iterations

sltestiterationCreate test iteration
sltest.testmanager.TestIterationCreate or modify test iteration
sltest.testmanager.ParameterSetAdd or modify parameter set
sltest.testmanager.ParameterOverrideAdd or modify parameter override
sltest.testmanager.viewLaunch the Simulink Test Manager
sltest.testmanager.setprefSet Test Manager preferences
sltest.testmanager.getprefGet Test Manager preferences
sltest.testmanager.OptionsReturn and specify test file options
sltest.testmanager.closeClose the Simulink Test Manager
sltest.testmanager.runRun tests with Test Manager
sltest.testmanager.CoverageSettingsModify coverage settings
sltest.testmanager.ResultSetAccess results set data
sltest.testmanager.TestFileResultAccess test file results data
sltest.testmanager.TestSuiteResultAccess test suite results data
sltest.testmanager.TestCaseResultAccess test case results data
sltest.testmanager.TestIterationResultAccess test iteration result data
sltest.testmanager.ComparisonRunResultAccess result of a comparison test
sltest.testmanager.ComparisonSignalResultAccess signal comparison results from a baseline or equivalence result
sltest.testmanager.CustomCriteriaResultView custom criteria test result
sltest.testmanager.importResultsImport Test Manager results file
sltest.testmanager.exportResultsExport results set from Test Manager
sltest.testmanager.getResultSetsReturns result set objects in Test Manager
sltest.testmanager.clearResultsClear results from Test Manager
sltest.testmanager.reportGenerate report of test results
sltest.testmanager.TestResultReportCustomize generated results report
sltest.testmanager.TestSpecReportGenerate report of test specifications
sltest.testmanager.DiagnosticRecordView custom criteria diagnostic information
sltest.testsequence.addStepAdd test sequence step
sltest.testsequence.addStepAfterAdd test sequence step after existing step
sltest.testsequence.addStepBeforeAdd test sequence step before existing step
sltest.testsequence.addSymbolAdd symbol to test sequence
sltest.testsequence.addTransitionAdd new transition to test sequence step
sltest.testsequence.deleteStepDelete test sequence step
sltest.testsequence.deleteSymbolDelete test sequence block symbol
sltest.testsequence.deleteTransitionDelete test sequence transition
sltest.testsequence.editStepEdit test sequence step
sltest.testsequence.editSymbolEdit symbol in Test Sequence block
sltest.testsequence.editTransitionEdit test sequence step transition
sltest.testsequence.findFind Test Sequence blocks
sltest.testsequence.findStepFind test sequence steps
sltest.testsequence.findSymbolFind Test Sequence block symbols
sltest.testsequence.getPropertyGet Test Sequence block properties
sltest.testsequence.newBlockCreate Test Sequence block
sltest.testsequence.readStepFind Test Sequence blocks
sltest.testsequence.readSymbolRead Test Sequence block symbol properties
sltest.testsequence.readTransitionRead properties of test sequence transition
sltest.testsequence.setPropertySet Test Sequence block properties
sltest.getAssessmentsReturns test assessment set object
sltest.AssessmentAccess assessment from set
sltest.AssessmentSetAccess a set of assessments from a simulation
sltest.harness.checkCompare component under test between harness model and main model
sltest.harness.cloneCopy test harness
sltest.harness.closeClose test harness
sltest.harness.convertConvert test harnesses between internal and external storage
sltest.harness.createCreate test harness
sltest.harness.deleteDelete test harness
sltest.harness.exportExport test harness to Simulink model
sltest.harness.findFind test harnesses in model
sltest.harness.importImport Simulink model to test harness
sltest.harness.loadLoad test harness
sltest.harness.moveMove test harness from linked instance to library block or to a different harness owner
sltest.harness.openOpen test harness
sltest.harness.pushPush test harness workspace entries and configuration set to model
sltest.harness.rebuildRebuild test harness and update workspace entries and configuration parameter set based on main model
sltest.harness.setChange test harness property

Topics

Create and Run Test Cases with Scripts

Examples of how to create and run tests using the programmatic interface.

Featured Examples