Main Content

getTestCase

Class: sltest.testmanager.TestCaseResult
Namespace: 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 HeatPumpScenario 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 = tf.getTestSuites();
remove(tsDel(1));

Assign the system under test to the test case, and run the test.

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

Obtain the test case results.

tcresultobj = getTestCaseResults(tc);

Obtain the test case that produced the results.

tcobj = getTestCase(tcresultobj);

Version History

Introduced in R2019b