Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cucumber: background fails still exits with code 0

I was wondering about something, cucumber returns an exit code 0 (which means "ok" as far as i know) when a Background fails.

Now failing steps shouldn't probably be in the Background (at best in a 'before'-hook i guess??). But does anybody know with what philosophy it returns this exit code? Is it a bug or a feature?

Appendix: A more concrete example: Lets say this code passes:

 Feature: Figuring out how Cucumber works

 As a developer
 I want to find out why cuccies fail, but my build doesnt
 In order to have more confidence in my build

 Background: logging in into the system
   Given I am logged in

 Scenario: creating a new test set
   When I do something
   Then I should see "you've done something"

It returns with exit code 0. Lets make it fail:

 Background: logging in into the system
   Given I am logged in

 Scenario: creating a new test set
   Then I should see "there's no way you see this"
   When I do something
   Then I should see "you've done something"

The output shows a failing step and it returns with exit code 1 When I move the failing step to the Background:

 Background: logging in into the system
   Given I am logged in
   Then I should see "there's no way you see this"

 Scenario: creating a new test set
   When I do something
   Then I should see "you've done something"

The output still shows it failed, but it returns with exit code 0

like image 942
Len Avatar asked Dec 01 '25 10:12

Len


1 Answers

I've asked the Cucumber guys (their mailing list) and they agree its a bug

http://groups.google.com/group/cukes/browse_thread/thread/e56699f0fabfc75f

like image 131
Len Avatar answered Dec 03 '25 01:12

Len



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!