Make Gherkin test runner behave more like Ruby's Cucumber#2
Closed
fourpastmidnight wants to merge 2 commits into
Conversation
| return $errorRecord | ||
| } | ||
|
|
||
| function Set-StepPending { |
Owner
Author
There was a problem hiding this comment.
Consider removing this function and adding a -Pending parameter to GherkinStep in Gherkin.ps1. See #1.
dc0bcb2 to
eb95df0
Compare
48fc7c3 to
fe174f6
Compare
eb95df0 to
4a36fca
Compare
fe174f6 to
ac0ba5e
Compare
4a36fca to
2b0c48c
Compare
ac0ba5e to
66d6c6e
Compare
2b0c48c to
257fd32
Compare
66d6c6e to
4851e3c
Compare
257fd32 to
e6410a8
Compare
4851e3c to
0a84607
Compare
e6410a8 to
c4e7dab
Compare
0a84607 to
e6f8553
Compare
c4e7dab to
97300c4
Compare
e6f8553 to
ca0015d
Compare
97300c4 to
52caeee
Compare
In Cucumber, when you write a Feature file and then run cucmuber on it without implementing any steps whatsoever, the result is that the scenario (and steps) are considered 'undefined'. For Pester, we currently treat these as Inconclusive (which is fine--we can synonomize Inconclusive with Undefined). However, there's no explicit mechanism to mark a step as pending. This commit adds a Set-StepPending "assertion" which is similar in nature to the Set-TestInconclusive "assertion". This will mark that step as 'Pending'. This commit only adds the Set-StepPending function. The next series of commits will update Pester's Gherkin implementation to use it.
52caeee to
0a1a877
Compare
ca0015d to
ba42aec
Compare
This commit contains work-in-progress towards the following:
* Adding the ability for Gherkin-style Pester tests to recognize and
report undefined steps and scenarios
* Undefined steps are steps in a feature file for which no
PowerShell script block has been written.
* TODO: Still need to add output that shows a "suggested"
implementation
* TODO: If any preceding step definitions are undefined, then
any defined steps in the scenario should be skipped.
* If at least one scenario step is undefined, then the scenario as a
whole is undefined.
* Added the ability for Gherkin-style Pester tests to recognize pending
steps and scenarios
* Pending steps are steps whose implementation explicitly sets the
step to pending (via the new Set-StepPending function), which is
similar to cucumber's pending function.
* Once a pending step has been encountered, all other steps in the
scenario are skipped -- afterall, even if other steps are
implemented, how can the test possibly pass if there's a pending
step?
* If at least one scenario step is pending, then the scenario is
also Pending.
* If a scenario step fails, all other steps are skipped. Afterall,
what's the point in running the rest of the scenario if a previous step
has failed? The scenario has still failed.
* As alluded, if at least one step has failed, then the scenario has
failed.
* Customized the output of Gherkin style tests to match that of
cucumber.
* Mostly a stylistic change, which is optional
* HOWEVER, the 'Inconclusive' state is used for 'Undefined'. Gherkin
doesn't actually make use of an Inconclusive state, and since Pester
expects certain states, all of which are used in Gherkin _except_
Inconclusive, it made sense to usurp this and use it for Undefined.
* NOTE: I'm actually not happy about having to do this. The
mental mapping that needs to take place when working on the
Pester code, while simple now, will become much more complex as
time goes on. Something more extensible needs to be implemented.
* For the stylistic changes, I'm setting up the codebase to allow
"output theming". But, this is in its very infancy and is not well
thought out yet.
0a1a877 to
26fb0a8
Compare
Owner
Author
|
Closing this PR. This has been accomplished with a PR against the main project (pester#1276). |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This represents an early first pass at updating the Gherkin implementation within Pester. This branch sits atop of PR pester#1142/Issue pester#1124 in the upstream Pester repository.
I would've just created a PR on the main repository, but I didn't want to waste CI build resources on this at the moment--as there are two tests that need to be fixed up due to the changes in this branch, and this is too early for merging consideration into the upstream project anyway.
@ignoretag pester/Pester#1115 at the upstream repository.Set-PendingStep. Cucumber does this when it gives you a "suggested" step implementation for an undefined step.I'm unhappy with a few things: namely in
Output.ps1, I basically copied the existingWrite-PesterResultfunction to aWrite-GherkinResultfunction and modified it for Gherkin. But pursuant to our conversation on pester#1115, this is where that "extensibility" model that has been discussed would come in handy, if possible. And this is what I plan to investigate next after cleaning up a few things with the current branch state.