cavediverchris / Manager-for-MATLAB-Projects

MATLAB Project Manager provides configured Project templates for specific modelling tasks and an app to automate routine tasks.
GNU General Public License v3.0
0 stars 0 forks source link

Create a utility for running all unit tests within a project #32

Open cavediverchris opened 2 years ago

cavediverchris commented 2 years ago

As a developer, I want a utility to enable me to easily run all of the unit tests within my project. If I am developing simulink models that are coupled with a Simulink Test Manager this utility will need to use that. For MATLAB code it will need to use the MATLAB unit test framework

cavediverchris commented 2 years ago

For a project based on Simulink where a test manager will exist the following code made be useful:

function runAllTests()

%projObj = currentProject;

% TODO - Find the test case file tc = 'TestFile.mldatx'; tfObj = sltest.testmanager.load(tc); resultsObj = run(tfObj);

% Generate a report from the results data filePath = 'test_report.pdf'; sltest.testmanager.report(resultsObj,filePath,... 'Author','Test Engineer',... 'IncludeSimulationSignalPlots',true,... 'IncludeComparisonSignalPlots',true); end