Skip to content
Snippets Groups Projects
Commit df3491e3 authored by Federico Felici's avatar Federico Felici Committed by Olivier Sauter
Browse files

further update of run_gdat_tests for good cov name

parent cf003cbb
No related branches found
No related tags found
1 merge request!110Add test coverage and update test scripts
...@@ -43,6 +43,9 @@ elseif numel(setpathsfile)>1 ...@@ -43,6 +43,9 @@ elseif numel(setpathsfile)>1
error('multiple setpaths_* files found!'); error('multiple setpaths_* files found!');
end end
%% Name
tbxname = 'gdat';
%% Generate test suite %% Generate test suite
testspath = fullfile(tbxpath,'tests'); testspath = fullfile(tbxpath,'tests');
...@@ -84,9 +87,15 @@ end ...@@ -84,9 +87,15 @@ end
%% run it %% run it
fprintf('Start test case: %s\n%s\n\n',test_case,datestr(now)); fprintf('Start test case: %s\n%s\n\n',test_case,datestr(now));
runner = matlab.unittest.TestRunner.withTextOutput; runner = matlab.unittest.TestRunner.withTextOutput;
%% Reports
if needXML || needCOV
prefix = sprintf('test_%s',tbxname);
suffix = version('-release');
end
if needXML if needXML
% Add some JUnit XML file with tests results % Add some JUnit XML file with tests results
xmlFile = fullfile(projectpath,sprintf('test_%s_%s.xml',test_case,version('-release'))); xmlFile = fullfile(projectpath,sprintf('%s_%s_%s.xml',prefix,test_case,suffix));
fprintf('\tGenerating JUnit XML report at %s\n',xmlFile); fprintf('\tGenerating JUnit XML report at %s\n',xmlFile);
p = XMLPlugin.producingJUnitFormat(xmlFile); p = XMLPlugin.producingJUnitFormat(xmlFile);
runner.addPlugin(p) runner.addPlugin(p)
...@@ -96,11 +105,11 @@ if needCOV ...@@ -96,11 +105,11 @@ if needCOV
switch lower(test_case) switch lower(test_case)
case 'coverage' case 'coverage'
% Produce HTML report % Produce HTML report
reportFolder = fullfile(projectpath,sprintf('test_%s_cov',version('-release'))); reportFolder = fullfile(projectpath,sprintf('%s_%s_cov',prefix,suffix));
reportFormat = matlab.unittest.plugins.codecoverage.CoverageReport(reportFolder); reportFormat = matlab.unittest.plugins.codecoverage.CoverageReport(reportFolder);
otherwise otherwise
% Produce XML file in Cobertura format (for Gitlab MR viz.) % Produce XML file in Cobertura format (for Gitlab MR viz.)
xmlFile = fullfile(projectpath,sprintf('test_%s_%s_cov.xml',test_case,version('-release'))); xmlFile = fullfile(projectpath,sprintf('%s_%s_%s_cov.xml',prefix,test_case,suffix));
reportFormat = matlab.unittest.plugins.codecoverage.CoberturaFormat(xmlFile); reportFormat = matlab.unittest.plugins.codecoverage.CoberturaFormat(xmlFile);
end end
p = matlab.unittest.plugins.CodeCoveragePlugin.forFolder(fileparts(mfilename('fullpath')),... p = matlab.unittest.plugins.CodeCoveragePlugin.forFolder(fileparts(mfilename('fullpath')),...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment