report results of tests run with testmanager works from testmanager only

13 次查看(过去 30 天)
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

采纳的回答

Nick Mazzilli
Nick Mazzilli 2019-12-10
This should fix your issue
sltest.testmanager.report(test_results,'test_report.pdf','Author','author','Title','Titel','IncludeCoverageResult',true,'IncludeTestResults',0)

更多回答(1 个)

Jalaj Gambhir
Jalaj Gambhir 2019-8-29
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 个评论
Tobias Huth
Tobias Huth 2019-8-30
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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Results, Reporting, and Test File Management 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by