Home > functions > internal > unit-test > dsUnitRun_autogen_all.m

dsUnitRun_autogen_all

PURPOSE ^

% Run all autogen tests

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% Run all autogen tests
 result_localfn = runtests('dsUnitTest_autogen_all_localfn');
 result = runtests('dsUnitTest_autogen_all');

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Run all autogen tests
0002 % result_localfn = runtests('dsUnitTest_autogen_all_localfn');
0003 % result = runtests('dsUnitTest_autogen_all');
0004 
0005 import matlab.unittest.TestSuite
0006 import matlab.unittest.TestRunner
0007 import matlab.unittest.selectors.HasTag
0008 import matlab.unittest.plugins.CodeCoveragePlugin
0009 import edu.stanford.covert.test.Coverage
0010 
0011 %% Rename autogen_newSave to autogen
0012 finalDir = fullfile(dsGetConfig('ds_unitTestData_path'), 'autogen');
0013 if ~exist(finalDir, 'dir')
0014   newDir = fullfile(dsGetConfig('ds_unitTestData_path'), 'autogen_newSave');
0015   movefile(newDir, finalDir);
0016 end
0017 
0018 %% Rename autogenDirs_newSave to autogenDirs
0019 finalDir = fullfile(dsGetConfig('ds_unitTestData_path'), 'autogenDirs');
0020 newDir = fullfile(dsGetConfig('ds_unitTestData_path'), 'autogenDirs_newSave');
0021 if ~exist(finalDir, 'dir') && exist(newDir, 'dir')
0022   movefile(newDir, finalDir);
0023 end
0024 
0025 %% Make Test Suite
0026 fullSuite = TestSuite.fromPackage('dsUnit');
0027 fullSuite = fullSuite.selectIf(~HasTag('query'));
0028 fullSuite = fullSuite.selectIf(HasTag('autogen'));
0029 
0030 %% code coverage runner
0031 runner = TestRunner.withTextOutput;
0032 runner.addPlugin(CodeCoveragePlugin.forFolder(fullfile(dsGetConfig('ds_root_path'), 'functions')))
0033 runner.addPlugin(CodeCoveragePlugin.forPackage('ds'))
0034 
0035 %% Run Test Suite
0036 % result = run(fullSuite); % test suite without code covereage or parallel
0037 result = runner.run(fullSuite); % runner for code coverage
0038 
0039 %% Run Test Suite in Parallel
0040 % runner = matlab.unittest.TestRunner.withTextOutput;
0041 % result = runInParallel(runner,fullSuite); % runner in parallel, no code coverage
0042 
0043 %% XML Coverage Output
0044 testCoverageDir = fullfile(dsGetConfig('ds_root_path'), 'testCoverage');
0045 mkdirSilent(testCoverageDir)
0046 reportPath = fullfile(testCoverageDir, 'dsAllAutogenTestCoverage.xml');
0047 report = Coverage( fullfile(dsGetConfig('ds_root_path'), 'functions') );
0048 report.exportXML(reportPath);

Generated on Tue 12-Dec-2017 11:32:10 by m2html © 2005