Add a new @PendingFeatureIf annotation / extension to allow features to be conditionally pending#988
Add a new @PendingFeatureIf annotation / extension to allow features to be conditionally pending#988leonard84 merged 4 commits intospockframework:masterfrom ryangardner:add-pendingfeatureif
Conversation
- Allow features to be conditionally 'pending' similar to @IgnoreIf
Codecov Report
@@ Coverage Diff @@
## master #988 +/- ##
=========================================
Coverage 74.02% 74.02%
Complexity 3437 3437
=========================================
Files 383 383
Lines 10630 10630
Branches 1297 1297
=========================================
Hits 7869 7869
Misses 2299 2299
Partials 462 462
Continue to review full report at Codecov.
|
|
Hi, thanks for your contribution. We are currently working on spock-2.0, until that is merged to master we won't merge PRs. |
|
Hm, why don't you want to use |
|
The behavior of The scenario where we had conditional pending features is for a UI automation suite that hits multiple environments. (could be more than two, but for simplicity sake, lets assume a dev and prod environment) A new feature is deployed but only active on the dev environment. We have some UI tests that actively run against that new feature - if we mark them as Some time passes - and the feature is released to production. The test suite still passes - with the tests running when we execute it against our dev environment but the tests are still ignored when running against the production environment. If some developer checks in code that breaks that feature - but only breaks it in prod - our regression suite wont detect it because the test is ignored. In a perfect world, we'd remember to remove that The same thing that might motivate you to sometimes use If there's a way to combine |
|
|
||
| [source,groovy] | ||
| ---- | ||
| @PendingFeatureIf({ System.getProperty("targetEnvironment").startsWith("production") }) |
There was a problem hiding this comment.
Take a look at PreconditionContext we have a shorthand for that sys, and I would just use == 'prod'
And just merge those two blocks
| import java.lang.annotation.Target; | ||
|
|
||
| /** | ||
| * If a passed in closure evaluates to true, this will be treated as a {@link PendingFeature} |
There was a problem hiding this comment.
Use similar wording to IgnoreIf -> ... if the given condition holds.
| * | ||
| * Otherwise it will be treated like a normal feature. | ||
| * | ||
| * The closure follows the same rules as those used by {@link IgnoreIf} |
There was a problem hiding this comment.
I would just copy the block with the information regarding the PreconditionContext from @Requires
|
@ryangardner do you have time to fix the comments soon, I'd like to use the annotation in #1075, but if you need more time then we'll merge that pr without it. |
|
@ryangardner We want to merge #1075 this week. If you are unable to address the change requests made by Leonard by that time, we can understand that. Just let us know :). |
|
@ryangardner I made required changes and it is now merged. Thanks for your PR. |
|
oh, thanks! I just saw the most recent message but the notifications for this issue got swallowed up in my inbox for some reason |
In our specific case we have some geb-based tests that target different deployed environments and occasionally it is convenient to have tests marked as being conditionally Pending.
I could see other places this might be useful - (features that are implemented on one OS but not another, etc)
This change is