Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit f0f6363

Browse files
committed
testsuite creation refactored in seperate function.
1 parent 13ac2ce commit f0f6363

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/main/resources/com/mathworks/ci/MatlabBuilder/runMatlabTests.m

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,16 @@
33
function failed = runMatlabTests(produceJUnit, produceTAP, produceCobertura)
44

55
BASE_VERSION_MATLABUNIT_SUPPORT = '8.1';
6-
BASE_VERSION_TESTSUITE_SUPPORT = '9.0';
76

87
if verLessThan('matlab',BASE_VERSION_MATLABUNIT_SUPPORT)
98
error('MATLAB:unitTest:testFrameWorkNotSupported','Running tests automatically is not supported in this relase.');
109
end
1110

12-
import('matlab.unittest.TestRunner');
13-
import('matlab.unittest.TestSuite');
14-
1511
%Create test suite for tests folder
16-
if verLessThan('matlab',BASE_VERSION_TESTSUITE_SUPPORT)
17-
suite = matlab.unittest.TestSuite.fromFolder(pwd,'IncludingSubfolders',true);
18-
else
19-
suite = testsuite(pwd,'IncludeSubfolders',true);
20-
end
12+
suite = getTestSuite();
2113

2214
% Create and configure the runner
15+
import('matlab.unittest.TestRunner');
2316
runner = TestRunner.withTextOutput;
2417

2518
% Add the requested plugins
@@ -85,6 +78,15 @@
8578
fclose(fopen(tapFile,'w'));
8679
tapToFile = matlab.unittest.plugins.ToFile(tapFile);
8780

81+
function suite = getTestSuite()
82+
import('matlab.unittest.TestSuite');
83+
BASE_VERSION_TESTSUITE_SUPPORT = '9.0';
84+
if verLessThan('matlab',BASE_VERSION_TESTSUITE_SUPPORT)
85+
suite = matlab.unittest.TestSuite.fromFolder(pwd,'IncludingSubfolders',true);
86+
else
87+
suite = testsuite(pwd,'IncludeSubfolders',true);
88+
end
89+
8890

8991
function mkdirIfNeeded(dir)
9092
if exist(dir,'dir') ~= 7

0 commit comments

Comments
 (0)