Verify Statements with outcomes from TestCaseResult object
3 views (last 30 days)
Show older comments
Hello,
I am using Simulink Test for setting up some unit tests and need to extract low level results programatically after running the test manager.
It is important to run the tests using Test Manager and work on the various objects returned by it, due to how things are setup.
tfr = getTestFileResults(ro);
tsr = getTestSuiteResults(tfr(1,1));
tcr = getTestCaseResults(tsr);
The closest solution is :
getVerifyRuns(tcr)
This returns a simulink run object that is mostly empty and contains the signals, but not the information about what were the verify statements of the test case and whether they passed or failed.
sltest.getAssessmentSet, sltest.getAssessment and sltest.TestResult etc are some methods that are able to provide the needed info, but I need to do this with Test Manager session and tfr, tsr and tcr objects mentioned above.
I can also manually export to workspace the assessment set from the gui of the Test Manager, but need to do this programmatically, thanks in advance!
0 Comments
Answers (1)
Riya
on 24 Mar 2025
Hi,
I understand that you want to extract information about the verify statements in each testcase and their pass/fail status. To do this, you can use the “sltest.getAssessments” function to retrieve all assessment details of a given test case result (tcr).
assessments = sltest.getAssessments(tcr);
% Display results
for i = 1:length(assessments)
fprintf('Assessment %d:\n', i);
fprintf(' - Name: %s\n', assessments(i).Name);
fprintf(' - Passed: %d\n', assessments(i).Passed);
fprintf(' - Failed: %d\n', assessments(i).Failed);
end
This approach works well with the Test Manager workflow using “tfr”, “tsr” and “tcr”.
For more information about “sltest.getAssessments” function, please refer the following documentation:
Thanks!
0 Comments
See Also
Categories
Find more on Results, Reporting, and Test File Management in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!