Conversion Simulink test to xUnit XML format possible?

Illustration
trans_them - 2021-08-31T12:36:59+00:00
Question: Conversion Simulink test to xUnit XML format possible?

Is it possible to export testresults from Simulink test to xUnit XML format?  

Expert Answer

Profile picture of Prashant Kumar Prashant Kumar answered . 2025-11-20

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);

 


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!