Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git://github.com/yannk/Test-Cukes

  • Loading branch information...
commit 03ddcf4daa26ff36e6a55401642012988e7d70e5 2 parents 7ac1509 + e489a48
Kang-min Liu authored
Showing with 26 additions and 3 deletions.
  1. +6 −3 lib/Test/Cukes.pm
  2. +20 −0 t/runtest.t
9 lib/Test/Cukes.pm
View
@@ -36,10 +36,13 @@ sub runtests {
my $skip_reason = "";
my $gwt;
- SKIP:
+
for my $step_text (@{$scenario->steps}) {
my ($pre, $step) = split " ", $step_text, 2;
- Test::Cukes->skip($step, 1) if $skip;
+ if ($skip) {
+ Test::Cukes->builder->skip($step_text);
+ next;
+ }
$gwt = $pre if $pre =~ /(Given|When|Then)/;
@@ -51,7 +54,7 @@ sub runtests {
eval { $cb->(@matches); };
Test::Cukes->builder->ok(!$@, $step_text);
- if ($@) {
+ if ($skip == 0 && $@) {
Test::Cukes->builder->diag($@);
$skip = 1;
$skip_reason = "Failed: $step_text";
20 t/runtest.t
View
@@ -12,6 +12,12 @@ Feature: foo
Given I will say the word 'cake'
When it is my birthday
Then we will eat 28 cakes
+
+ Scenario: Failed assertion leads to skipping remaining steps
+ Given anything
+ When I fail this step
+ Then I skip this one
+
FEATURE_TEXT
my @passed;
@@ -47,4 +53,18 @@ Then qr/we will eat (\d+) (.+)/ => sub {
. " correctly passed to the step functions";
};
+
+Given qr/anything/ => sub {
+ assert "Anything is ok";
+ ok 1, "passed Given";
+};
+
+When qr/fail/ => sub {
+ assert 0 == 1;
+};
+
+Then qr/skip/ => sub {
+ ok 0, "This shoudln't be executed at all!";
+};
+
runtests;
Please sign in to comment.
Something went wrong with that request. Please try again.