%% Set Harness Options When Creating a Test Case
% This example shows how to create a test case and test harness for a model component. It also shows how to use the HarnessOptions property. The test case uses only a component harness and is set up with no inputs or baseline strategy. To use this test case creation strategy, the UseComponentInputs property of createTestForComponent function must be false, and the SLDVTestGeneration property must be off. The HarnessSource property is ignored and the FunctionInterfaceName is deduced from the argument passed to createTestForComponent.
% Once the test case is set up, you can specify the verification strategy for the component, such as importing test input data for the component into the created test case.
% This code creates a test file and harness for the Contoller component of the f14 model. The HarnessOptions specify that the harness name is myHarness, a Signal Editor is used as the harness source, and the harness syncs with the model when the harness is opened.

load_system('f14');

tcObj = sltest.testmanager.createTestForComponent(...
    'CreateTestFile',true,'TestFile','MyHarnessTest', ...
    'Component','f14/Controller','UseComponentInputs', ...
    false,'HarnessOptions',{'Name','myHarness', ...
    'Source','Signal Editor','SynchronizationMode', ...
    'SyncOnOpen'});

% Copyright 2021 The MathWorks, Inc.