MATLAB Answers

I want to write a MATLAB script that tests all test suites in Simulink with extension .mldatx?

5 views (last 30 days)
Stefan Ramdhan
Stefan Ramdhan on 11 Nov 2020
Answered: Mark McBroom on 14 Nov 2020
Currently, my script is able to run specific tests in the Simulink Test Manager: I want this script to run ALL .mldatx files, not just TestingFile.mldatx, with continuous integration. How would I do this?
import matlab.unittest.TestRunner;
import matlab.unittest.TestSuite
import matlab.unittest.selectors.HasParameter;
import matlab.unittest.plugins.TestReportPlugin;
import sltest.plugins.TestManagerResultsPlugin;
import matlab.unittest.selectors.HasName;
suite = testsuite('tests\TestingFile.mldatx');
testRunner = TestRunner.withNoPlugins;
%Produce pdf file
pdfFile = 'TestReport.pdf';
trp = TestReportPlugin.producingPDF(pdfFile);
%add test manager results
tmr = TestManagerResultsPlugin;
result = run(testRunner,suite);

Community Treasure Hunt

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

Start Hunting!