%% Obtain Test Case Results
% 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 |HeatPumpScenario| model.

% Copyright 2019 The MathWorks, Inc.

%% 
% Clear existing test files from the Test Manager.
sltest.testmanager.clear; 
%%
% Create a new test file, test suite, and test case.
tf = sltest.testmanager.TestFile('TestFile1');
ts = createTestSuite(tf,'TestSuite1');
tc = createTestCase(ts,'simulation','TestCase1');
%%
% Remove the 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. 
setProperty(tc,'Model','HeatPumpScenario');
tcresult = run(tc);
%% 
% Obtain the test case results
tcresultobj = getTestCaseResults(tc);