- 'setProperty' function - https://www.mathworks.com/help/sltest/ref/sltest.testmanager.testcase.setproperty.html
- 'createTestCase' function - https://www.mathworks.com/help/sltest/ref/sltest.testmanager.testsuite.createtestcase.html
- Create and Run Test Cases with Scripts - https://www.mathworks.com/help/sltest/ug/create-and-run-test-cases-with-scripts.html
- Create harnesses - https://www.mathworks.com/help/sltest/ref/sltest.harness.create.html
How to select the harness of model through scripting commands and select the harness in test manager automatically by just specifying the harness name
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mahesh
am 2 Mai 2024
Beantwortet: Paras Gupta
am 6 Mai 2024
I am trying to access the test manager through scripting commands .I getted the harnessList = sltest.testmanager.find(Model_Name), getting list of harnesses present woth fields .I have used testmanager.SetProperty ('HarnessName' ,name) and testmanager.SetProperty('HarnessOwner', OwnerfullPath) by field names of the harnessList bybut still the property is not setted in test manager .I want to select the harness in the test manager through scripting functions .The above is not selecting the desired harness which I want to select from the harnessList.Please help to solve this if any one knows.Any UI method or command lines .The model is selected the Harness is drop down showing harness of internaly saved ,lets says the harnesses from XML saved info file .I want to select the harnesses by name .Help me out!
0 Kommentare
Akzeptierte Antwort
Paras Gupta
am 6 Mai 2024
Hi Mahesh,
I understand that you want to select a test harness within a test case programatically using commands. The following example on the 'f14' model shows one way to achieve the same:
openExample('f14');
% create test harnesses
sltest.harness.create('f14','Name','model_harness_test');
sltest.harness.create('f14/Controller','Name',...
'Controller_Harness_test');
harnessList = sltest.harness.find('f14');
% create test file, suite, and case
tf = sltest.testmanager.TestFile('Test Scripts');
ts = createTestSuite(tf,'Test Scripts Suite');
tc = createTestCase(ts,'baseline','Baseline API Test Case');
% Remove the default test suite
tsDel = getTestSuiteByName(tf,'New Test Suite 1');
remove(tsDel);
% Assign the system under test to the test case
setProperty(tc,'Model','f14');
setProperty(tc,'HarnessName','Controller_Harness_test','HarnessOwner','f14/Controller');
% We can see the harness set in test manager by opening it
sltest.testmanager.view;
It is to be noted that the 'HarnessName' and 'HarnessOwner' property should be set together in the same command. You can refer to the following documentation links for more information on the code above:
Hope this helps resolve your query.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Test Scripts finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!