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

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


Background is really like Before, with the only difference being, that it is run after Before. And since you're using Background/Before (in general) to set prerequisites for your Scenario(s) it wouldn't be very helpful, if the testing-process fails, which an error code different from 0 would suggest, just because you made a mistake in your prerequisites.

So my guess is, although i can't be sure, that this is a 'feature' and very much intended so.


Need Your Help

Dapper: Unit Testing SQL Queries

c# .net unit-testing tdd dapper

I am starting with Dapper, the micro-ORM, and i use the Dapper Rainbow. I want to test the queries and the data retrieved by them.

What is the application launched by canopy when running a python file with matplotlib?

matplotlib canopy

What is the application used by canopy when running a python file?