-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Failing steps are now properly handled and following steps in scenario are skipped - Second core.feature scenario is passing - Progress formatter is now available and used by default - We still miss stack trace output on failure
- Loading branch information
Showing
12 changed files
with
1,063 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,30 @@ | ||
#!/usr/bin/env node | ||
var fs = require('fs'); | ||
var Cucumber = require('./lib/cucumber'); | ||
var supportCodePath = process.ARGV[3] ? process.cwd() + '/' + process.ARGV[3] : './features/step_definitions/cucumber_steps'; | ||
var supportCode = require(supportCodePath); | ||
var cucumber = Cucumber(fs.readFileSync(process.ARGV[2]), supportCode); | ||
var progressFormatter = Cucumber.Listener.ProgressFormatter; | ||
cucumber.attachListener(progressFormatter()); | ||
cucumber.start(function() {}); | ||
var fs = require('fs'); | ||
var Cucumber = require('./lib/cucumber'); | ||
var supportCodePath = process.ARGV[3] ? process.cwd() + '/' + process.ARGV[3] : './features/step_definitions/cucumber_steps'; | ||
var supportCode = require(supportCodePath); | ||
var cucumber = Cucumber(fs.readFileSync(process.ARGV[2]), supportCode); | ||
var formatter = Cucumber.Listener.ProgressFormatter(); | ||
cucumber.attachListener(formatter); | ||
cucumber.start(function(succeeded) { | ||
var code = succeeded ? 0 : 1; | ||
var exitFunction = function() { | ||
process.exit(code); | ||
}; | ||
|
||
// --- exit after waiting for all pending output --- | ||
var waitingIO = false; | ||
process.stdout.on('drain', function() { | ||
if (waitingIO) { | ||
// the kernel buffer is now empty | ||
exitFunction(); | ||
} | ||
}); | ||
if (process.stdout.write("")) { | ||
// no buffer left, exit now: | ||
exitFunction(); | ||
} else { | ||
// write() returned false, kernel buffer is not empty yet... | ||
waitingIO = true; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
Feature: progress formatter | ||
In order to get quick feedback when doing BDD | ||
As a developer | ||
I want to use a "progress" formatter | ||
|
||
Scenario: one scenario, one step, passing | ||
Given a step definition matching /a passing step/ | ||
When I run the following feature with the "progress" formatter: | ||
""" | ||
Feature: | ||
Scenario: | ||
Given a passing step | ||
""" | ||
Then the listener should output the following: | ||
""" | ||
. | ||
1 scenario (1 passed) | ||
1 step (1 passed) | ||
""" | ||
|
||
Scenario: one scenario, two steps, passing | ||
Given a step definition matching /a passing step/ | ||
When I run the following feature with the "progress" formatter: | ||
""" | ||
Feature: | ||
Scenario: | ||
Given a passing step | ||
And a passing step | ||
""" | ||
Then the listener should output the following: | ||
""" | ||
.. | ||
1 scenario (1 passed) | ||
2 steps (2 passed) | ||
""" | ||
|
||
Scenario: two scenarios, five steps, passing | ||
Given a step definition matching /a passing step/ | ||
When I run the following feature with the "progress" formatter: | ||
""" | ||
Feature: | ||
Scenario: | ||
Given a passing step | ||
And a passing step | ||
Scenario: | ||
Given a passing step | ||
And a passing step | ||
When a passing step | ||
""" | ||
Then the listener should output the following: | ||
""" | ||
.. | ||
2 scenarios (2 passed) | ||
5 steps (5 passed) | ||
""" | ||
|
||
Scenario: one scenario, one step, failing | ||
Given a step definition failing with message "boom" matching /a failing step/ | ||
When I run the following feature with the "progress" formatter: | ||
""" | ||
Feature: | ||
Scenario: | ||
Given a failing step | ||
""" | ||
Then the listener should output the following: | ||
""" | ||
F | ||
1 scenario (1 failed) | ||
1 step (1 failed) | ||
""" | ||
|
||
Scenario: one scenario, two steps, second failing | ||
Given a step definition matching /a passing step/ | ||
And a step definition failing with message "boom" matching /a failing step/ | ||
When I run the following feature with the "progress" formatter: | ||
""" | ||
Feature: | ||
Scenario: | ||
Given a passing step | ||
When a failing step | ||
""" | ||
Then the listener should output the following: | ||
""" | ||
.F | ||
1 scenario (1 failed) | ||
2 steps (1 failed, 1 passed) | ||
""" | ||
|
||
Scenario: one two-step passing scenario, one two-step scenario with latest step failing | ||
Given a step definition matching /a passing step/ | ||
And a step definition failing with message "boom" matching /a failing step/ | ||
When I run the following feature with the "progress" formatter: | ||
""" | ||
Feature: | ||
Scenario: | ||
Given a passing step | ||
When a passing step | ||
Scenario: | ||
Given a passing step | ||
When a failing step | ||
""" | ||
Then the listener should output the following: | ||
""" | ||
...F | ||
2 scenarios (1 failed, 1 passed) | ||
4 steps (1 failed, 3 passed) | ||
""" | ||
|
||
Scenario: one failing scenario with a skipped step | ||
Given a step definition matching /a passing step/ | ||
And a step definition matching /a skipped step/ | ||
And a step definition failing with message "boom" matching /a failing step/ | ||
When I run the following feature with the "progress" formatter: | ||
""" | ||
Feature: | ||
Scenario: | ||
Given a passing step | ||
When a failing step | ||
Then a skipped step | ||
""" | ||
Then the listener should output the following: | ||
""" | ||
.F- | ||
1 scenario (1 failed) | ||
3 steps (1 failed, 1 skipped, 1 passed) | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.