Conversion Simulink test to xUnit XML format possible?

조회 수: 15 (최근 30일)
Jakob Klein
Jakob Klein 2019년 7월 16일
댓글: Ondrej Mikulas 2019년 10월 30일
Is it possible to export testresults from Simulink test to xUnit XML format?

채택된 답변

Anjana Krishnan
Anjana Krishnan 2019년 7월 24일
Hi Jakob,
This walks you through how to leverage the MATLAB Unit Test Runner and plugins to output test results in formats including XML and TAP. To output JUnit XML results, you can use the XMLPlugin.
Here's an example:
import matlab.unittest.plugins.XMLPlugin;
import matlab.unittest.TestRunner;
suite = testsuite('mySimulinkTestFile.mldatx');
runner = TestRunner.withTextOutput;
runner.addPlugin(XMLPlugin.producingJUnitFormat('myJUnitResults.xml'));
runner.run(suite);
Hope this helps!
Anjana
  댓글 수: 1
Ondrej Mikulas
Ondrej Mikulas 2019년 10월 30일
Hi Anjana,
I went through the post you linked and got the XML file generated for test suites created from mldatx Simulink Test Manager files. I followed exactly the same steps.
I am facing an error when running the same runner instance in paralllel mode (with Parallel Computing Toolbox).
Instead of runner.run(suite) I call runner.runInParallel(suite), but I a getting the following error:
Error using matlab.unittest.internal.TestRunnerExtension/runInParallel (line 72)
Exception occurred. Any unfinished groups were cancelled.
Error in run_unit_tests_all (line 222)
runner.runInParallel(test_suite)
Caused by:
Error using matlab.unittest.FunctionTestCase.fromFunction (line 61)
The value of 'TestFcn' is invalid. Expected fcn to be one of these types:
function_handle
Instead its type was double.
Error using matlab.unittest.FunctionTestCase.fromFunction (line 61)
The value of 'TestFcn' is invalid. Expected fcn to be one of these types:
function_handle
Instead its type was double
I wonder if you could help with this issue.
Best Regards, Ondrej

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Test Model Components에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by