-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrunTests.m
More file actions
29 lines (23 loc) · 801 Bytes
/
Copy pathrunTests.m
File metadata and controls
29 lines (23 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import matlab.unittest.TestRunner;
import matlab.unittest.TestSuite;
import matlab.unittest.plugins.CodeCoveragePlugin;
import matlab.unittest.plugins.codecoverage.CoberturaFormat;
% Create suite
suite = TestSuite.fromFolder('tests', 'IncludingSubfolders', true);
% Create runner
runner = TestRunner.withTextOutput;
% Configure coverage
sourceFiles = { ...
fullfile(pwd, 'toolbox', 'ConsoleErrorRerouter.m'), ...
fullfile(pwd, 'toolbox', 'UIHTMLDevTools.m') ...
};
mkdir('code-coverage');
coverageFile = fullfile(pwd, 'code-coverage', 'coverage.xml');
plugin = CodeCoveragePlugin.forFile(sourceFiles, ...
'Producing', CoberturaFormat(coverageFile));
runner.addPlugin(plugin);
% Run tests
results = runner.run(suite);
% Output results for CI
display(results);
assertSuccess(results);