- '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 (최근 30일)
이전 댓글 표시
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
채택된 답변
Paras Gupta
2024년 5월 6일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Test Scripts에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!