-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathrun_integration_tests.m
executable file
·49 lines (42 loc) · 1.41 KB
/
run_integration_tests.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
40
41
42
43
44
45
46
47
48
49
try
% Imports
import matlab.unittest.TestRunner;
import matlab.unittest.TestSuite;
import matlab.unittest.plugins.XMLPlugin;
import matlab.unittest.plugins.ToFile;
root = fileparts(mfilename('fullpath'));
%% Initialize OpenCossan
workingDirectory = fullfile(root,'tmp');
if ~exist(workingDirectory,'dir')
mkdir(workingDirectory);
end
userpath(workingDirectory);
%% Setup
addpath(genpath(fullfile(root,'test','integration')));
addpath(genpath(fullfile(root,'COSSANXengine','src')));
OpenCossan('NverboseLevel',0);
%% Create TestRunner
runner = TestRunner.withTextOutput;
% Add XMLPlugin
% The XMLPlugin provides a jUnit style file to interface with Jenkins
xmlFile = 'integrationResults.xml';
if exist(xmlFile,'file')
delete(xmlFile);
end
runner.addPlugin(XMLPlugin.producingJUnitFormat(xmlFile));
%% Create TestSuites
suite = TestSuite.fromFolder(fullfile(root,'test','integration'));
%% Run and display results
result = runner.run(suite);
disp(result);
OpenCossan.setVerbosityLevel(3);
catch e
disp(getReport(e,'extended'));
OpenCossan.setVerbosityLevel(3);
if ~usejava('desktop') % Exit if running in headless mode
exit(1);
end
end
if ~usejava('desktop') % Exit if running in headless mode
exit(0);
end