getTestCase

Class: sltest.testmanager.TestCaseResult
Package: sltest.testmanager

Get test case that produced result

Syntax

tc = getTestCase(tcresult)

Description

tc = getTestCase(tcresult) returns the test case that produced the test case results, tc.

Input Arguments

expand all

Test case result from a test case run, specified as an sltest.testmanager.TestCaseResult object.

Output Arguments

expand all

Test case that produced the test case results, returned as an sltest.testmanager.TestCase object.

Examples

expand all

This example shows how to create a test file, test suite, and simulation test case programmatically. The test case runs on the sldemo_autotrans model and uses getTestCase to obtain the test case that produced the test results.

Clear existing test files from the Test Manager.

sltest.testmanager.clear;

Create test file, test suite, and test case.

tf = sltest.testmanager.TestFile('Test File 1');
ts = createTestSuite(tf,'Test Suite 1');
tc = createTestCase(ts,'simulation','Test Case 1');

Remove default test suite so that only the created test suite is used.

tsDel = getTestSuiteByName(tf,'New Test Suite 1');
remove(tsDel);

Assign the system under test to the test case. Run the test.

setProperty(tc,'Model','sldemo_autotrans');
tcresult = run(tc);

Obtain the test case results.

tcresultobj = getTestCaseResults(tc);

Obtain the test case that produced the results.

tcobj = getTestCase(tcresultobj);

Introduced in R2019b