Main Content

getTestCaseResults

Class: sltest.testmanager.TestCase
Package: sltest.testmanager

Get test case results history

Syntax

tcresult = getTestCaseResults(tc)

Description

tcresult = getTestCaseResults(tc) returns the test case results history for the specified test case, tc. The test case history includes the results for all runs of the test case in the Test Manager.

Input Arguments

expand all

Test case for which to obtain result history, specified as an sltest.testmanager.TestCase object.

Output Arguments

expand all

Test case result history, returned as an array of sltest.testmanager.TestCaseResult objects. Each object in the array contains the results for a single test case run.

Examples

expand all

This example shows how to create a test file, test suite, and simulation test case programmatically. It also show how to obtain the results. The test case runs on the sldemo_autotrans model.

Clear existing test files from the Test Manager.

sltest.testmanager.clear;

Create new test file, test suite, and test case.

tf = sltest.testmanager.TestFile('TestFile1');
ts = createTestSuite(tf,'TestSuite1');
tc = createTestCase(ts,'simulation','TestCase1');

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. Run the test.

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

Obtain the test case results

tcresultobj = getTestCaseResults(tc);

See Also

Introduced in R2019b