Main Content

createTestCase

Class: sltest.testmanager.TestSuite
Namespace: sltest.testmanager

Create test case

Syntax

tc = createTestCase(ts,type,name)
tc = createTestCase(ts,type,name,runOnTarget)
tc = createTestCase(ts,type,name,runOnPlatform="platform")

Description

tc = createTestCase(ts,type,name) creates a new test case of the specified type and name within the specified test suite.

tc = createTestCase(ts,type,name,runOnTarget) creates a new test case for real-time testing.

tc = createTestCase(ts,type,name,runOnPlatform="platform") creates a new test case that runs on the specified platform. When runOnPlatform="RoadRunner", the type must be "simulation".

Input Arguments

expand all

Test suite that you want to add a test case to, specified as an sltest.testmanager.TestSuite object.

Test case type, specified as:

  • "baseline"

  • "equivalence"

  • "simulation"

For RoadRunner test cases, the type must be "simulation".

Test case name, specified as a string scalar or character vector. If this input argument is empty, then the Test Manager gives the test case a unique name.

Option to run the test case on a target, specified as a cell array of Boolean values. For more information on real-time testing, see Test Models in Real Time.

Platform on which to run the test case, specified as "Desktop", "RealTime", or "RoadRunner", which is an enumerated value of the sltest.testmanager.RunPlatforms class. For example, to specify RoadRunner as the platform, you can use these syntaxes:

  • runOnPlatform="RoadRunner"

  • 'runOnPlatform,'RoadRunner'

  • sltest.testmanager.RunPlatforms.RoadRunner

Output Arguments

expand all

Test case, returned as an sltest.testmanager.TestCase object.

Examples

expand all

% Create test file
tf = sltest.testmanager.TestFile("test_file");

% Create test suite
ts = sltest.testmanager.TestSuite(tf,"My Test Suite");

% Create test case
tc = createTestCase(ts,"baseline","My Baseline Test")

Version History

Introduced in R2015b

expand all