[Jifty-commit] r3807 - in Test-WWW-Declare: lib/Test/WWW t
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Aug 6 13:17:08 EDT 2007
Author: sartak
Date: Mon Aug 6 13:17:08 2007
New Revision: 3807
Modified:
Test-WWW-Declare/ (props changed)
Test-WWW-Declare/lib/Test/WWW/Declare.pm
Test-WWW-Declare/t/04-fail.t
Log:
r29952 at caladan: sartak | 2007-08-06 13:16:50 -0400
a session now fails iff one or more of its flows failed
Modified: Test-WWW-Declare/lib/Test/WWW/Declare.pm
==============================================================================
--- Test-WWW-Declare/lib/Test/WWW/Declare.pm (original)
+++ Test-WWW-Declare/lib/Test/WWW/Declare.pm Mon Aug 6 13:17:08 2007
@@ -13,6 +13,7 @@
never always lack lacks);
our $BUILDER = Test::Builder->new();
our $WWW_MECHANIZE;
+our $FLOWS_FAILED;
our %mechs;
=begin private
@@ -249,8 +250,9 @@
$BUILDER->skip($reason);
}
elsif ($@) {
+ $FLOWS_FAILED++;
$BUILDER->ok(0, $name);
- Carp::croak $@;
+ $BUILDER->diag($@);
}
else {
$BUILDER->ok(1, $name);
@@ -263,6 +265,7 @@
$mechs{$title} ||= Test::WWW::Mechanize->new();
local $WWW_MECHANIZE = $mechs{$title};
+ local $FLOWS_FAILED = 0;
eval { $coderef->() };
@@ -270,9 +273,16 @@
my $reason = $1;
$BUILDER->skip($reason);
}
- elsif ($@) {
+ elsif ($@ || $FLOWS_FAILED) {
$BUILDER->ok(0, $title);
- $BUILDER->diag($@);
+ if ($@)
+ {
+ $BUILDER->diag($@);
+ }
+ else
+ {
+ $BUILDER->diag("session '$title' failed because $FLOWS_FAILED flows failed");
+ }
}
else {
$BUILDER->ok(1, $title);
Modified: Test-WWW-Declare/t/04-fail.t
==============================================================================
--- Test-WWW-Declare/t/04-fail.t (original)
+++ Test-WWW-Declare/t/04-fail.t Mon Aug 6 13:17:08 2007
@@ -1,5 +1,5 @@
#!perl
-use Test::WWW::Declare::Tester tests => 5;
+use Test::WWW::Declare::Tester tests => 7;
use warnings;
use strict;
@@ -12,16 +12,22 @@
click href qr{bad};
content should match qr{This is a good page}i;
};
+
+ flow "should be run" => check {
+ get "http://localhost:$PORT/";
+ content should match qr{This is an index};
+ };
};
}
);
shift @results; # Test::Tester gives 1-based arrays
-is(@results, 2, "had two tests");
+is(@results, 3, "had three tests");
ok(!$results[0]{ok}, "1st test failed");
-ok(!$results[1]{ok}, "2nd test failed");
+ok( $results[1]{ok}, "2nd test passed");
+ok(!$results[2]{ok}, "3rd test failed");
is($results[0]{name}, "basic connectivity", "1st test was flow");
-is($results[1]{name}, "check logins", "2nd test was session");
-
+is($results[1]{name}, "should be run", "2nd test was flow");
+is($results[2]{name}, "check logins", "3rd test was session");
More information about the Jifty-commit
mailing list