Highlight in model in testmanager

3 次查看(过去 30 天)
浩 程
浩 程 2024-9-25
评论: 浩 程 2024-9-30
How to highlight a specific step in sltest.harness from the results of sltest.testmanager

回答(1 个)

Abhas
Abhas 2024-9-30
Hi,
To highlight a specific step in "sltest.harness" from the results of "sltest.testmanager" you can follow these general steps:
  • Run Your Test Case: First, ensure that you have executed your test case using the Simulink Test Manager. This will generate results that you can analyze.
  • Access the Test Results: Load the test results into MATLAB. You can do this by using the "sltest.testmanager.loadResults" function if you have saved the results to a file.
coderesults = sltest.testmanager.importResults('YourTestResults.mldatx');
  • Navigate to the Specific Test Result: Access the specific test case result you are interested in. You might need to iterate through the results to find the specific test case and step.
testSuiteResults = getTestSuiteResults(results);
  • Identify the Specific Step: Once you have the test case results, identify the specific test step you want to highlight. You may need to inspect the test case results to determine which step you are interested in.
  • Highlight the Step in the Harness: If you want to highlight a specific step in the harness, you can use Simulink's API to programmatically open the harness and highlight the desired block or step. This involves using the Simulink API to manipulate the model as follows:
harnessName = 'YourHarnessName';
blockPath = 'YourModel/YourBlock'; % Path to the block you want to highlight
sltest.harness.open(harnessName);
hilite_system(blockPath, 'find');
You may refer to the below MathWorks Documentation link to have a better understanding on creating a test harness and hilite_system function:
  1. https://www.mathworks.com/help/simulink/slref/hilite_system.html
  2. https://www.mathworks.com/help/sltest/gs/create-a-test-harness.html
  1 个评论
浩 程
浩 程 2024-9-30
Thanks a lot, but this doesn't solve my problem, hilite_system needs a simulink object, but I can't find it

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Inputs 的更多信息

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by