Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make @PendingFeature repeatable (#1030) #1190

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
incorporate review feedback vol. 1
  • Loading branch information
Vampire committed Jul 14, 2020
commit a464c2833e761626cb0649b04d4c7881bd1076cc
12 changes: 10 additions & 2 deletions docs/extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ The main difference to `Ignore` is that the test are executed, but test failures
If the test passes without an error, then it will be reported as failure since the `PendingFeature` annotation should be removed.
This way the tests will become part of the normal tests instead of being ignored forever.

Groovy has the `groovy.transform.NotYetImplemented` annotation which is similar but behaves a differently.
Groovy has the `groovy.transform.NotYetImplemented` annotation which is similar but behaves differently.

* it will mark failing tests as passed
* if at least one iteration of a data-driven test passes it will be reported as error
Expand All @@ -172,13 +172,21 @@ Groovy has the `groovy.transform.NotYetImplemented` annotation which is similar
include::{sourcedir}/extension/PendingFeatureDocSpec.groovy[tag=example-a]
----

You can also list one or multiple exceptions that are expected and cause the test to be skipped.
If other exceptions occur, the test fails as if no annotation would be present.

[source,groovy,indent=0]
----
include::{sourcedir}/extension/PendingFeatureDocSpec.groovy[tag=example-b]
----

It is also supported to have multiple `@PendingFeature` annotations or a mixture of `@PendingFeature` and
`@PendingFeatureIf`, for example to ignore certain exceptions only under certain conditions or show different
reasons for different exceptions.

[source,groovy,indent=0]
----
include::{sourcedir}/extension/PendingFeatureDocSpec.groovy[tag=example-b]
include::{sourcedir}/extension/PendingFeatureDocSpec.groovy[tag=example-c]
----

=== PendingFeatureIf
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.spockframework.docs.extension

import org.spockframework.runtime.extension.builtin.PreconditionContext
import spock.lang.PendingFeature
import spock.lang.PendingFeatureIf
import spock.lang.Specification
Expand All @@ -15,6 +14,17 @@ class PendingFeatureDocSpec extends Specification {
}

// tag::example-b[]
@PendingFeature(exceptions = [
UnsupportedOperationException,
IllegalArgumentException
])
def "I throw one of two exceptions"() {
// end::example-b[]
expect:
throw new IllegalArgumentException()
}

// tag::example-c[]
@PendingFeature(
exceptions = UnsupportedOperationException,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe include an example that has a list of exceptions

reason = 'operation not yet supported')
Expand All @@ -25,7 +35,7 @@ class PendingFeatureDocSpec extends Specification {
value = { os.windows },
reason = 'Does not yet work on Windows')
def "I have various problems in certain situations"() {
// end::example-b[]
// end::example-c[]
expect:
throw new IllegalArgumentException()
}
Expand Down