From 4e4b75fda63c94fb22473aa01657d2f7627700d7 Mon Sep 17 00:00:00 2001 From: Andy Campbell Date: Fri, 19 Jan 2018 14:10:29 -0500 Subject: [PATCH 01/11] Create runALL_THE_TESTS.m --- runALL_THE_TESTS.m | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 runALL_THE_TESTS.m diff --git a/runALL_THE_TESTS.m b/runALL_THE_TESTS.m new file mode 100644 index 0000000..0220dac --- /dev/null +++ b/runALL_THE_TESTS.m @@ -0,0 +1,31 @@ +try + import('matlab.unittest.TestRunner'); + import('matlab.unittest.plugins.XMLPlugin'); + import('matlab.unittest.plugins.ToFile'); + import('matlab.unittest.plugins.CodeCoveragePlugin'); + import('matlab.unittest.plugins.codecoverage.CoberturaFormat'); + + ws = getenv('WORKSPACE'); + + suite = testsuite('scanreader'); + + % Create and configure the runner + runner = TestRunner.withTextOutput('Verbosity',3); + + % Add the XML plugin + resultsDir = fullfile(ws, 'testresults'); + mkdir(resultsDir); + + resultsFile = fullfile(resultsDir, 'testResults.xml'); + runner.addPlugin(XMLPlugin.producingJUnitFormat(resultsFile)); + + coverageFile = fullfile(resultsDir, 'cobertura.xml'); + runner.addPlugin(CodeCoveragePlugin.forPackage('scanreader',... + 'Producing', CoberturaFormat(coverageFile),'IncludingSubfolders',true)); + + results = runner.run(suite) +catch e + disp(getReport(e,'extended')); + exit(1); +end +quit('force'); From 20bef51a74e277dc805685c44c01eb2e41f29b0b Mon Sep 17 00:00:00 2001 From: Andy Campbell Date: Fri, 19 Jan 2018 14:11:15 -0500 Subject: [PATCH 02/11] Update runALL_THE_TESTS.m --- runALL_THE_TESTS.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runALL_THE_TESTS.m b/runALL_THE_TESTS.m index 0220dac..e610ae4 100644 --- a/runALL_THE_TESTS.m +++ b/runALL_THE_TESTS.m @@ -21,7 +21,7 @@ coverageFile = fullfile(resultsDir, 'cobertura.xml'); runner.addPlugin(CodeCoveragePlugin.forPackage('scanreader',... - 'Producing', CoberturaFormat(coverageFile),'IncludingSubfolders',true)); + 'Producing', CoberturaFormat(coverageFile),'IncludingSubpackages',true)); results = runner.run(suite) catch e From 181117c432105e8fbcaaaa3ce3e37aefd5771d2a Mon Sep 17 00:00:00 2001 From: Andy Campbell Date: Mon, 22 Jan 2018 14:58:13 -0500 Subject: [PATCH 03/11] Point to local data --- +scanreader/StackTest.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/+scanreader/StackTest.m b/+scanreader/StackTest.m index 19fa88d..d47e7cb 100644 --- a/+scanreader/StackTest.m +++ b/+scanreader/StackTest.m @@ -1,7 +1,7 @@ classdef StackTest < matlab.unittest.TestCase %STACKTEST Test stacks from different ScanImage versions. properties - dataDir = '/home/ecobost/Documents/scanreader/data' + dataDir = fullfile(getenv('WORKSPACE','data')); stackFile5_1 % 2 channels, 60 slices stackFile2016b % 1 channel, 1 slice, mroiEnable = false stackFile5_1Multifiles % second has 10 slices @@ -10,6 +10,7 @@ methods (TestClassSetup) function createfilenames(testCase) + testCase.assumeEqual(@() exist(testCase.dataDir), 7, 'The data folder could not be found'); testCase.stackFile5_1 = fullfile(testCase.dataDir, 'stack_5_1_001.tif'); testCase.stackFile2016b = fullfile(testCase.dataDir, 'stack_2016b.tif'); testCase.stackFile5_1Multifiles = {fullfile(testCase.dataDir, 'stack_5_1_001.tif'), fullfile(testCase.dataDir, 'stack_5_1_002.tif')}; From bad77d8bae55762e419f95dedd0c5c5fe39eb288 Mon Sep 17 00:00:00 2001 From: Andy Campbell Date: Mon, 22 Jan 2018 15:04:41 -0500 Subject: [PATCH 04/11] Adjust to external data requirements. --- +scanreader/ScanTest.m | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/+scanreader/ScanTest.m b/+scanreader/ScanTest.m index 21931b5..43e47ab 100644 --- a/+scanreader/ScanTest.m +++ b/+scanreader/ScanTest.m @@ -2,7 +2,7 @@ classdef ScanTest < matlab.unittest.TestCase %SCANTEST Test scans from different ScanImage versions. properties - dataDir = '/home/ecobost/Documents/scanreader/data' + dataDir = fullfile(getenv('WORKSPACE'),'data')); scanFile5_1 % 2 channels, 3 slices scanFile5_2 % 2 channels, 3 slices scanFile2016bMultiroi % all rois have same dimensions, 1 channel 5 slices @@ -14,6 +14,8 @@ methods (TestClassSetup) function createfilenames(testCase) + testCase.assumeThat(exist(testCase.dataDir), IsEqualTo(7), ... + 'The data could not be found. It cant be checked into the repo due to size constraints.'); testCase.scanFile5_1 = fullfile(testCase.dataDir, 'scan_5_1_001.tif'); testCase.scanFile5_2 = fullfile(testCase.dataDir, 'scan_5_2.tif'); testCase.scanFile2016bMultiroi = fullfile(testCase.dataDir, 'scan_2016b_multiroi_001.tif'); @@ -333,9 +335,14 @@ function testexceptions(testCase) methods % Local functions - function assertequalshapeandsum(testCase, array, expectedShape, expectedSum) - testCase.verifyEqual(size(array), expectedShape) - testCase.verifyEqual(sum(array(:)), expectedSum) + function assertequalshapeandsum(testCase, array, expectedSize, expectedSum) + testCase.assertSize(array, expectedSize); + testCase.assertEqual(sum(array(:)), expectedSum); end end -end \ No newline at end of file +end + +% "import" functions +function c = IsEqualTo(varargin) +c = matlab.unittest.constraints.IsEqualTo(varargin{:}); +end From d97e24cd35a62c449af98b1c9b9e87754ab2aa6e Mon Sep 17 00:00:00 2001 From: Andy Campbell Date: Mon, 22 Jan 2018 15:14:20 -0500 Subject: [PATCH 05/11] Update StackTest.m --- +scanreader/StackTest.m | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/+scanreader/StackTest.m b/+scanreader/StackTest.m index d47e7cb..e267e57 100644 --- a/+scanreader/StackTest.m +++ b/+scanreader/StackTest.m @@ -10,7 +10,8 @@ methods (TestClassSetup) function createfilenames(testCase) - testCase.assumeEqual(@() exist(testCase.dataDir), 7, 'The data folder could not be found'); + testCase.assumeThat(exist(testCase.dataDir), IsEqualTo(7), ... + 'The data could not be found. It cant be checked into the repo due to size constraints.'); testCase.stackFile5_1 = fullfile(testCase.dataDir, 'stack_5_1_001.tif'); testCase.stackFile2016b = fullfile(testCase.dataDir, 'stack_2016b.tif'); testCase.stackFile5_1Multifiles = {fullfile(testCase.dataDir, 'stack_5_1_001.tif'), fullfile(testCase.dataDir, 'stack_5_1_002.tif')}; @@ -194,9 +195,14 @@ function test2016bmultiroi(testCase) methods % Local functions function assertequalshapeandsum(testCase, array, expectedShape, expectedSum) - testCase.verifyEqual(size(array), expectedShape) - testCase.verifyEqual(sum(array(:)), expectedSum) + testCase.assertSize(array, expectedShape) + testCase.assertEqual(sum(array(:)), expectedSum) end end end +% "Import" functions +function c = IsEqualTo(varargin) +c = matlab.unittest.constraints.IsEqualTo(varargin{:}); +end + From b05d901e05f6b68809633d49344ff6580960bc6a Mon Sep 17 00:00:00 2001 From: Andy Campbell Date: Mon, 22 Jan 2018 15:16:09 -0500 Subject: [PATCH 06/11] Update StackTest.m --- +scanreader/StackTest.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/+scanreader/StackTest.m b/+scanreader/StackTest.m index e267e57..ed237bb 100644 --- a/+scanreader/StackTest.m +++ b/+scanreader/StackTest.m @@ -1,7 +1,7 @@ classdef StackTest < matlab.unittest.TestCase %STACKTEST Test stacks from different ScanImage versions. properties - dataDir = fullfile(getenv('WORKSPACE','data')); + dataDir = fullfile(getenv('WORKSPACE'),'data'); stackFile5_1 % 2 channels, 60 slices stackFile2016b % 1 channel, 1 slice, mroiEnable = false stackFile5_1Multifiles % second has 10 slices From 6c4b44737d90c68c25031e672b40dfa7b986efba Mon Sep 17 00:00:00 2001 From: Andy Campbell Date: Mon, 22 Jan 2018 15:16:24 -0500 Subject: [PATCH 07/11] Update ScanTest.m --- +scanreader/ScanTest.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/+scanreader/ScanTest.m b/+scanreader/ScanTest.m index 43e47ab..ff5f785 100644 --- a/+scanreader/ScanTest.m +++ b/+scanreader/ScanTest.m @@ -2,7 +2,7 @@ classdef ScanTest < matlab.unittest.TestCase %SCANTEST Test scans from different ScanImage versions. properties - dataDir = fullfile(getenv('WORKSPACE'),'data')); + dataDir = fullfile(getenv('WORKSPACE'),'data'); scanFile5_1 % 2 channels, 3 slices scanFile5_2 % 2 channels, 3 slices scanFile2016bMultiroi % all rois have same dimensions, 1 channel 5 slices From 6ff18ad04f04b9d41e40c975b6379cc82344e8cf Mon Sep 17 00:00:00 2001 From: Andy Campbell Date: Mon, 22 Jan 2018 15:30:57 -0500 Subject: [PATCH 08/11] Update StackTest.m --- +scanreader/StackTest.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/+scanreader/StackTest.m b/+scanreader/StackTest.m index ed237bb..0d4478e 100644 --- a/+scanreader/StackTest.m +++ b/+scanreader/StackTest.m @@ -1,7 +1,7 @@ classdef StackTest < matlab.unittest.TestCase %STACKTEST Test stacks from different ScanImage versions. properties - dataDir = fullfile(getenv('WORKSPACE'),'data'); + dataDir = fullfile(getenv('WORKSPACE'),'data1'); stackFile5_1 % 2 channels, 60 slices stackFile2016b % 1 channel, 1 slice, mroiEnable = false stackFile5_1Multifiles % second has 10 slices From 3fe9c5dbd32e672944738b6765e839ffbfd74ea7 Mon Sep 17 00:00:00 2001 From: Andy Campbell Date: Mon, 22 Jan 2018 15:31:10 -0500 Subject: [PATCH 09/11] Update ScanTest.m --- +scanreader/ScanTest.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/+scanreader/ScanTest.m b/+scanreader/ScanTest.m index ff5f785..27760af 100644 --- a/+scanreader/ScanTest.m +++ b/+scanreader/ScanTest.m @@ -2,7 +2,7 @@ classdef ScanTest < matlab.unittest.TestCase %SCANTEST Test scans from different ScanImage versions. properties - dataDir = fullfile(getenv('WORKSPACE'),'data'); + dataDir = fullfile(getenv('WORKSPACE'),'data1'); scanFile5_1 % 2 channels, 3 slices scanFile5_2 % 2 channels, 3 slices scanFile2016bMultiroi % all rois have same dimensions, 1 channel 5 slices From 83720a1545de7acdb6cc4d35d85064cd1da5c8d2 Mon Sep 17 00:00:00 2001 From: Andy Campbell Date: Mon, 22 Jan 2018 15:38:23 -0500 Subject: [PATCH 10/11] Update ScanTest.m --- +scanreader/ScanTest.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/+scanreader/ScanTest.m b/+scanreader/ScanTest.m index 27760af..ff5f785 100644 --- a/+scanreader/ScanTest.m +++ b/+scanreader/ScanTest.m @@ -2,7 +2,7 @@ classdef ScanTest < matlab.unittest.TestCase %SCANTEST Test scans from different ScanImage versions. properties - dataDir = fullfile(getenv('WORKSPACE'),'data1'); + dataDir = fullfile(getenv('WORKSPACE'),'data'); scanFile5_1 % 2 channels, 3 slices scanFile5_2 % 2 channels, 3 slices scanFile2016bMultiroi % all rois have same dimensions, 1 channel 5 slices From 453476588bed623de500a5ec8ded1625c7d269ed Mon Sep 17 00:00:00 2001 From: Andy Campbell Date: Mon, 22 Jan 2018 15:38:36 -0500 Subject: [PATCH 11/11] Update StackTest.m --- +scanreader/StackTest.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/+scanreader/StackTest.m b/+scanreader/StackTest.m index 0d4478e..ed237bb 100644 --- a/+scanreader/StackTest.m +++ b/+scanreader/StackTest.m @@ -1,7 +1,7 @@ classdef StackTest < matlab.unittest.TestCase %STACKTEST Test stacks from different ScanImage versions. properties - dataDir = fullfile(getenv('WORKSPACE'),'data1'); + dataDir = fullfile(getenv('WORKSPACE'),'data'); stackFile5_1 % 2 channels, 60 slices stackFile2016b % 1 channel, 1 slice, mroiEnable = false stackFile5_1Multifiles % second has 10 slices