Item11169: Tests that consist only of verify
type tests don't run when part of a suite
Priority: Normal
Current State: Closed
Released In: n/a
Target Release: n/a
The Unit Test framework does not detect any tests when tests that consist only of verify style tests are run in combination with other tests.
For example, Changing the execution order of
VCStoreTests
and
VCMetaTests
moves the problem
../bin/TestRunner.pl -clean VCStoreTests.pm VCMetaTests.pm
Options: -clean
exporting FOSWIKI_ASSERTS=1 for extra checking; disable by exporting FOSWIKI_ASSERTS=0
Assert checking on 1
Starting CWD is /var/www/foswiki/trunk/core/test/unit
Running VCStoreTests
VCStoreTests::verify_NoHistory_implicitSave_RcsWrap
VCStoreTests::verify_NoHistory_getRevisionAtTime_RcsWrap
VCStoreTests::verify_Inconsistent_implicitSave_RcsWrap
VCStoreTests::verify_Inconsistent_saveAttachment_RcsLite
...
Running VCMetaTests
*** No tests in VCMetaTests
Unit test run Summary:
All tests passed (22)
1..448
../bin/TestRunner.pl -clean VCMetaTests.pm VCStoreTests.pm
Options: -clean
exporting FOSWIKI_ASSERTS=1 for extra checking; disable by exporting FOSWIKI_ASSERTS=0
Assert checking on 1
Starting CWD is /var/www/foswiki/trunk/core/test/unit
Running VCMetaTests
VCMetaTests::verify_notopic_RcsWrap
...
VCMetaTests::verify_rename_RcsLite
VCMetaTests::verify_checkin_attachment_RcsLite
Running VCStoreTests
*** No tests in VCStoreTests
Unit test run Summary:
All tests passed (10)
1..379
--
GeorgeClark - 05 Oct 2011
Found the issue - In
FoswikiStoreTestCase.pm - The code that loaded the Store algorithms also pushed the algorithm onto the group list for the verify groups. Once the algorithm was loaded, it would not be pushed onto the list for the next test. I'll commit fix once the test suite runs.
--
GeorgeClark - 05 Oct 2011
Fix not 100% - Tests now all work, but get redefined warnings. Here is the fix.
diff --git a/UnitTestContrib/test/unit/FoswikiStoreTestCase.pm b/UnitTestContrib/test/unit/FoswikiStoreTestCase.pm
index 43206e5..e407882 100644
--- a/UnitTestContrib/test/unit/FoswikiStoreTestCase.pm
+++ b/UnitTestContrib/test/unit/FoswikiStoreTestCase.pm
@@ -43,25 +43,30 @@ sub set_up_for_verify {
sub fixture_groups {
my @groups;
+ #print STDERR "fixture_groups called\n";
foreach my $dir (@INC) {
+ #print STDERR "Examining dir $dir\n";
if ( opendir( D, "$dir/Foswiki/Store" ) ) {
foreach my $alg ( readdir D ) {
+ #print STDERR "Examining $alg\n";
next unless $alg =~ s/^(.*)\.pm$/$1/;
- next if defined &$alg;
- $ENV{PATH} =~ /^(.*)$/ms;
- $ENV{PATH} = $1;
- next if $alg =~ /RcsWrap/ && !rcs_is_installed();
- ($alg) = $alg =~ /^(.*)$/ms;
- eval "require Foswiki::Store::$alg";
- die $@ if $@;
- no strict 'refs';
- *$alg = sub {
- my $this = shift;
- $Foswiki::cfg{Store}{Implementation} =
- 'Foswiki::Store::'.$alg;
- $this->set_up_for_verify();
- };
- use strict 'refs';
+ unless (defined &$alg) {
+ $ENV{PATH} =~ /^(.*)$/ms;
+ $ENV{PATH} = $1;
+ next if $alg =~ /RcsWrap/ && !rcs_is_installed();
+ ($alg) = $alg =~ /^(.*)$/ms;
+ eval "require Foswiki::Store::$alg";
+ die $@ if $@;
+ no strict 'refs';
+ *$alg = sub {
+ my $this = shift;
+ $Foswiki::cfg{Store}{Implementation} =
+ 'Foswiki::Store::'.$alg;
+ $this->set_up_for_verify();
+ };
+ use strict 'refs';
+ }
+ #print STDERR "Pushed $alg to groups\n";
push(@groups, $alg);
}
--
GeorgeClark - 05 Oct 2011