report results of tests run with testmanager works from testmanager only

11 views (last 30 days)
Hello everybody,
I've just installed simulink test and started to try things. Matlab and Simulink are 2019a.
I've authored tests in the testmanager, ran them and created a report from within the testmanager. This works like a charm.
When I try to repeat the steps described above via commands, which is:
>> test_cases = sltest.testmanager.load('BE_inject_testcases.mldatx');
>> test_results = sltest.testmanager.run()
test_results =
ResultSet with properties:
Name: 'Results: 2019-Aug-20 07:53:31'
NumPassed: 2
NumFailed: 0
NumDisabled: 0
NumIncomplete: 0
NumTotal: 2
NumTestCaseResults: 0
NumTestSuiteResults: 0
NumTestFileResults: 1
Outcome: Passed
StartTime: 20-Aug-2019 07:53:31
StopTime: 20-Aug-2019 07:53:37
Duration: 6 sec
CoverageResults: [1×2 cvdata]
Release: ''
alternatively:
test_results = sltest.testmanager.importResults('test_results_1.mldatx');
If I now call the report:
sltest.testmanager.report(test_results,'test_report.pdf','Author','author','Title','Titel','IncludeCoverageResult',true)
I get the following error:
Error using sltest.internal.TestResultReportBase/flatAndFilterReportData
No failed results selected.
Error in sltest.internal.TestResultReportBase/setReportGenerationEnviroment
Error in sltest.internal.TestResultReportBase/createReport
Error in stm.internal.report.createReport>processingArgs (line 140)
report.createReport();
Error in stm.internal.report.createReport (line 3)
processingArgs(inArgs)
Error in stm.internal.apiDetail.reportWrapper
Error in sltest.internal.report
Error in sltest.testmanager.report (line 73)
sltest.internal.report(resultObj, filePath, varargin{:});
Does someone know, what could be the cause of this behaviour?
Please not, that I do not have a report generator license.
Greetings from the sunny south of Germany,
Tobias

Accepted Answer

Nick Mazzilli
Nick Mazzilli on 10 Dec 2019
This should fix your issue
sltest.testmanager.report(test_results,'test_report.pdf','Author','author','Title','Titel','IncludeCoverageResult',true,'IncludeTestResults',0)
  1 Comment
Tobias Huth
Tobias Huth on 11 Dec 2019
Hey,
I do not understand why, but this fixed my issue indeed! Thank you very much!
Greetings from swabia,
Tobias

Sign in to comment.

More Answers (1)

Jalaj Gambhir
Jalaj Gambhir on 29 Aug 2019
Hi,
It is stated in the MathWorks documentation that the report is only generated if the model has failed for at least one test case. This is mentioned here.
  1 Comment
Tobias Huth
Tobias Huth on 30 Aug 2019
Hi,
thank you for your answer! I must have overseen the hint in the help document. I've tried it and it works if I alter the model to fail at least one test.
For me, it is still unclear why I can create a report on a model without failed tests from the toolstrip in the testmanager:SLTestman_repBtn.png
therefore I'm not going to accept the answer (yet).
Thanks again and regards,
Tobias

Sign in to comment.

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!