forked from IRIS-Solutions-Team/IRIS-Test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runAllTestsTAP.m
39 lines (32 loc) · 885 Bytes
/
runAllTestsTAP.m
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
30
31
32
33
34
35
36
37
38
39
function runAllTestsTAP()
import matlab.unittest.TestSuite;
import matlab.unittest.TestRunner;
import matlab.unittest.plugins.TAPPlugin;
import matlab.unittest.plugins.ToFile;
try
thisFolder = fileparts(mfilename('fullpath')) ;
addpath(thisFolder);
thisTAPFile = fullfile(thisFolder,'testResults.tap');
if exist(thisTAPFile, 'file')
delete(thisTAPFile);
end
% Create the suite and runner
suite = TestSuite.fromFolder(thisFolder, ...
'IncludingSubfolders', true);
runner = TestRunner.withTextOutput;
% Add the TAPPlugin directed to a file
runner.addPlugin(TAPPlugin.producingOriginalFormat(ToFile(thisTAPFile)));
% Run the tests
runner.run(suite);
% Clean up
rmpath(thisFolder);
catch e;
% Clean up
if exist('thisFolder','var')
rmpath(thisFolder);
end
% Display error report
disp(e.getReport);
exit(1);
end;
exit force;