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

Spock extension method specSkipped is not called when the Specification is ignored. #1662

Closed
renatoathaydes opened this issue May 4, 2023 · 0 comments · Fixed by #1811
Closed
Labels

Comments

@renatoathaydes
Copy link
Contributor

Describe the bug

Adding @Ignore at the Specification class level should cause Spock to call the following method on Spock extensions:

void specSkipped( SpecInfo spec )

To Reproduce

Register a Spock extension and implement the specSkipped method.

Run the following Spec:

@Ignore
class MySpec extends Specification {
    def 'feature'() {
        expect: true
    }
}

Expected behavior

The specSkipped method should be called for MySpec.

Actual behavior

The extension is never called.

Java version

N/A

Buildtool version

N/A

What operating system are you using

Mac

Dependencies

N/A

Additional context

No response

kriegaex added a commit to kriegaex/spock that referenced this issue May 6, 2023
SpecNode.nodeSkipped overrides JUnit 5 platform's Node.nodeSkipped. It
fetches the spec info and then calls IRunListener.specSkipped for all
run listeners registered on the spec.

Note: We cannot use context.getRunner() here like in SpecNode.around,
because the runner is null when the JUnit platform calls nodeSkipped.

Fixes spockframework#1662.
kriegaex added a commit to kriegaex/spock that referenced this issue May 6, 2023
SpecNode.nodeSkipped overrides JUnit 5 platform's Node.nodeSkipped. It
fetches the spec info and then calls IRunListener.specSkipped for all
run listeners registered on the spec.

Note: We cannot use context.getRunner() here like in SpecNode.around,
because the runner is null when the JUnit platform calls nodeSkipped.

Fixes spockframework#1662.
kriegaex added a commit to kriegaex/spock that referenced this issue May 6, 2023
FeatureNode.nodeSkipped overrides JUnit 5 platform's Node.nodeSkipped.
It fetches the feature info and then calls IRunListener.featureSkipped
for all run listeners registered on the spec.

Relates to spockframework#1662.
kriegaex added a commit to kriegaex/spock that referenced this issue May 6, 2023
- In 'runFeature', the 'if (currentFeature.isSkipped())' code block is
  unnecessary, because it will never be executed, as 'runFeature' also
  will not be executed for skipped features.

- In 'runSpec', add 'if (spec.isExcluded()) return;' analogous to
  the existing 'if (currentFeature.isExcluded()) return;' in
  'runFeature', logically aligning the code structures in both methods.

Relates to spockframework#1662.
kriegaex added a commit to kriegaex/spock that referenced this issue May 6, 2023
FeatureNode.nodeSkipped overrides JUnit 5 platform's Node.nodeSkipped.
It fetches the feature info and then calls IRunListener.featureSkipped
for all run listeners registered on the spec.

Relates to spockframework#1662.
kriegaex added a commit to kriegaex/spock that referenced this issue May 6, 2023
- In 'runFeature', the 'if (currentFeature.isSkipped())' code block is
  unnecessary, because it will never be executed, as 'runFeature' also
  will not be executed for skipped features.

- In 'runSpec', add 'if (spec.isExcluded()) return;' analogous to
  the existing 'if (currentFeature.isExcluded()) return;' in
  'runFeature', logically aligning the code structures in both methods.

Relates to spockframework#1662.
kriegaex added a commit to kriegaex/spock that referenced this issue May 6, 2023
leonard84 added a commit to leonard84/spock that referenced this issue Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant