Skip to content

Commit

Permalink
Support attachments (close #189)
Browse files Browse the repository at this point in the history
Strings, buffers and streams can be attached to results and embedded into reports. Currently, only the JSON formatter will output those attachments (as binary64 strings).

    this.Before(function (scenario, callback) {
      scenario.attach("some string, stream or buffer");
      callback();
    });

    // works with After hooks too:
    this.After(function (scenario, callback) {
      scenario.attach("some string, stream or buffer");
      callback();
    });

Squashed commit of the following:

commit 59d0ae4
Author: Simon Dean <[email protected]>
Date:   Tue Aug 12 22:16:01 2014 +0100

    Stop pretty formatter from outputting undefined step name. Add hidden attribute to JSON formatter

commit 25d26ca
Author: Simon Dean <[email protected]>
Date:   Sat Aug 9 21:39:27 2014 +0100

    Removed dependency on strip-ansi.  Fixed some undefined steps in Ruby cucumber tests

    strip-ansi did not work under node v0.6 and v0.8

commit 436d4bd
Author: Simon Dean <[email protected]>
Date:   Sat Aug 9 19:16:44 2014 +0100

    Hide successful hook steps from the pretty formatter, summary formatter and stats journal

commit a322e3d
Author: Simon Dean <[email protected]>
Date:   Sat Aug 9 10:14:38 2014 +0100

    Remove name from hook steps

commit b552866
Author: Simon Dean <[email protected]>
Date:   Wed Aug 6 20:18:20 2014 +0100

    No longer testing Stream.Readable functionality in node v0.6 and v0.8

    Stream.Readable is not available in node v0.6 and v0.8 so it is not possible to test Stream.Readable functionality under those versions of node

commit 72c76d8
Author: Simon Dean <[email protected]>
Date:   Wed May 28 23:51:51 2014 +0100

    Support attachments, also known as embeddings
  • Loading branch information
jbpros committed Aug 13, 2014
1 parent 54ea729 commit 3cbe290
Show file tree
Hide file tree
Showing 54 changed files with 4,552 additions and 1,062 deletions.
591 changes: 591 additions & 0 deletions features/attachments.feature

Large diffs are not rendered by default.

69 changes: 52 additions & 17 deletions features/cli.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ Feature: Command line interface
module.exports = cucumberSteps;
"""
When I run `cucumber.js features/a.feature`
Then it should pass with:
Then it outputs this text:
"""
.
1 scenario (1 passed)
1 step (1 passed)
"""
And the exit status should be 0

Scenario: run a single scenario within feature
Given a file named "features/a.feature" with:
Expand All @@ -45,15 +46,15 @@ Feature: Command line interface
module.exports = cucumberSteps;
"""
When I run `cucumber.js features/a.feature:2`
Then it should pass with:
Then it outputs this text:
"""
.
1 scenario (1 passed)
1 step (1 passed)
"""

And the exit status should be 0

Scenario: run a single feature without step definitions
Given a file named "features/a.feature" with:
Expand All @@ -63,14 +64,21 @@ Feature: Command line interface
When a step is undefined
"""
When I run `cucumber.js features/a.feature`
Then it should pass with:
Then it outputs this text:
"""
U
1 scenario (1 undefined)
1 step (1 undefined)
You can implement step definitions for undefined steps with these snippets:
this.When(/^a step is undefined$/, function (callback) {
// Write code here that turns the phrase above into concrete actions
callback.pending();
});
"""
And the exit status should be 0

Scenario: run feature with non-default step definitions file location specified (-r option)
Given a file named "features/a.feature" with:
Expand All @@ -87,14 +95,15 @@ Feature: Command line interface
module.exports = cucumberSteps;
"""
When I run `cucumber.js features/a.feature -r step_definitions/cucumber_steps.js`
Then it should pass with:
Then it outputs this text:
"""
.
1 scenario (1 passed)
1 step (1 passed)
"""
And the exit status should be 0

Scenario: run feature with step definitions in required directory (-r option)
Given a file named "features/a.feature" with:
Expand All @@ -111,26 +120,30 @@ Feature: Command line interface
module.exports = cucumberSteps;
"""
When I run `cucumber.js features/a.feature -r step_definitions`
Then it should pass with:
Then it outputs this text:
"""
.
1 scenario (1 passed)
1 step (1 passed)
"""
And the exit status should be 0

Scenario: display Cucumber version
When I run `cucumber.js --version`
Then I see the version of Cucumber
And the exit status should be 0

Scenario: display help
When I run `cucumber.js --help`
Then I see the help of Cucumber
And the exit status should be 0

Scenario: display help (short flag)
When I run `cucumber.js -h`
Then I see the help of Cucumber
And the exit status should be 0

Scenario: run a single failing feature
Given a file named "features/a.feature" with:
Expand All @@ -147,14 +160,21 @@ Scenario: run a single failing feature
module.exports = cucumberSteps;
"""
When I run `cucumber.js features/a.feature`
Then it should fail with:
Then it outputs this text:
"""
F
(::) failed steps (::)
forced error
Failing scenarios:
<current-directory>/features/a.feature:2 # Scenario:
1 scenario (1 failed)
1 step (1 failed)
"""
And it should exit with code "1"

And the exit status should be 1

Scenario: run a single failing feature with an empty hooks file
Given a file named "features/a.feature" with:
Expand All @@ -174,14 +194,21 @@ Scenario: run a single failing feature
"""
"""
When I run `cucumber.js features/a.feature`
Then it should fail with:
Then it outputs this text:
"""
F
(::) failed steps (::)
forced error
Failing scenarios:
<current-directory>/features/a.feature:2 # Scenario:
1 scenario (1 failed)
1 step (1 failed)
"""
And it should exit with code "1"

And the exit status should be 1

Scenario: run a single failing feature with an AfterFeatures hook
Given a file named "features/a.feature" with:
Expand All @@ -207,10 +234,18 @@ Scenario: run a single failing feature
module.exports = hooks;
"""
When I run `cucumber.js features/a.feature`
Then it should fail with:
Then it outputs this text:
"""
F
(::) failed steps (::)
forced error
Failing scenarios:
<current-directory>/features/a.feature:2 # Scenario:
1 scenario (1 failed)
1 step (1 failed)
"""
And it should exit with code "1"
And the exit status should be 1
Loading

0 comments on commit 3cbe290

Please sign in to comment.