%% Creating Baseline Tests
%
% Verify simulation result against a baseline dataset created from a model.

%%
% This example shows you how to create baselines tests for a model.  
% The example uses the model |sltestBaselineBasicExample| to generate a baseline dataset  
% of expected results by simulating the model. The baseline test case checks that the simulation 
% results produce the same output as the baseline dataset, which determines the pass/fail
% criteria of the test case.  
%

%% Open the Model and Test Manager
% 1. Open the model.
mdl = 'sltestBaselineBasicExample';
open_system(mdl);

%%
% 2. From the model, select *Analysis > Test Manager* to open the Test
% Manager.

%% 
% 3. Create a new test file using the Test Manager toolstrip.

%%
% 4. Name the test file, and save it in a writable folder.

%% Capture Baseline
% 1. Under *System Under Test*, for *Model*, enter
% |sltestBaselineBasicExample|.
% Capture a baseline for the test case by expanding the *Baseline Criteria*
% section and clicking *Capture*. Save the file |BaselineData| in a
% writable folder.

%%
% The test case runs, and baseline data is captured for the root outports.

%%
% <<sltestBaselineTestCaseAfterSetupPix.png>>

%% 
% 2. Click *Run* from the toolstrip to execute the test.

%%
% <<sltestBaselineTestCaseJustBeforeRunningPix.png>>

%% Visualize Baseline Test Results 
% 1. After the test completes, expand all rows in the *Results and Artifacts* pane. The test case passes 
% because the simulation results match the baseline results.

%%
% <<sltestResultsAfterExpansionPix.png>>

%% 
% 2. Select the option button for |Out2| under *Baseline Criteria Result* to visualize 
% the data comparison.

%%
% <<sltestResultsComparisonPlotted1Pix.png>>

%% 
close_system(mdl, 0);
clear mdl;


displayEndOfDemoMessage(mfilename)

%%
% Copyright 2018 The MathWorks, Inc.
