0001
0002
0003
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
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
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
0026 fullSuite = TestSuite.fromPackage('dsUnit');
0027 fullSuite = fullSuite.selectIf(~HasTag('query'));
0028 fullSuite = fullSuite.selectIf(HasTag('autogen'));
0029
0030
0031 runner = TestRunner.withTextOutput;
0032 runner.addPlugin(CodeCoveragePlugin.forFolder(fullfile(dsGetConfig('ds_root_path'), 'functions')))
0033 runner.addPlugin(CodeCoveragePlugin.forPackage('ds'))
0034
0035
0036
0037 result = runner.run(fullSuite);
0038
0039
0040
0041
0042
0043
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);