|
3 | 3 | function failed = runMatlabTests(produceJUnit, produceTAP, produceCobertura) |
4 | 4 |
|
5 | 5 | BASE_VERSION_MATLABUNIT_SUPPORT = '8.1'; |
6 | | -BASE_VERSION_TESTSUITE_SUPPORT = '9.0'; |
7 | 6 |
|
8 | 7 | if verLessThan('matlab',BASE_VERSION_MATLABUNIT_SUPPORT) |
9 | 8 | error('MATLAB:unitTest:testFrameWorkNotSupported','Running tests automatically is not supported in this relase.'); |
10 | 9 | end |
11 | 10 |
|
12 | | -import('matlab.unittest.TestRunner'); |
13 | | -import('matlab.unittest.TestSuite'); |
14 | | - |
15 | 11 | %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(); |
21 | 13 |
|
22 | 14 | % Create and configure the runner |
| 15 | +import('matlab.unittest.TestRunner'); |
23 | 16 | runner = TestRunner.withTextOutput; |
24 | 17 |
|
25 | 18 | % Add the requested plugins |
|
85 | 78 | fclose(fopen(tapFile,'w')); |
86 | 79 | tapToFile = matlab.unittest.plugins.ToFile(tapFile); |
87 | 80 |
|
| 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 | + |
88 | 90 |
|
89 | 91 | function mkdirIfNeeded(dir) |
90 | 92 | if exist(dir,'dir') ~= 7 |
|
0 commit comments