Executing invalid command may result in false positives #97

Closed
thedjinn opened this Issue Dec 10, 2011 · 1 comment

Projects

None yet

2 participants

@thedjinn

Consider the following example:

Feature: Bad exec error handling

    Scenario: False positive
        When I run `thiscommanddoesnotexist`
        Then the output should contain "thiscommanddoesnotexist"

    Scenario: Example showing internal backtrace as command output in assertion error
        When I run `thiscommanddoesnotexist`
        Then the output should contain exactly ""

The executable that we are running does not exist, so whenever Ruby executes this command it will fail with ENOENT. However, the output (stderr) of this invocation is a backtrace that is internal to Cucumber creating a possibility for false positives.

My suggestion is to check if executing the child process command results in an exception and to raise that exception on the "When" step instead of silently continuing.

@mattwynne
Member

You need to use the step:

When I successfully run `cmd/that/i/expect/to/work`
@mattwynne mattwynne closed this Nov 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment