spockframework / spockframework/spock
Allow @IgnoreIf to be used as meta-annotation
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 483
- PR merge metrics
- No merged PRs in 30d
Description
Is your feature request related to a problem?
We have many long-running integration tests annotated with custom @IntegrationSpec, that are not to be run as part of the standard build.
Hence, we want to exclude the long-running tests if a slow-test system property is defined.
The annotation looks like this:
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@DataJpaTest
@AutoConfigureEmbeddedDatabase
@IgnoreIf(value = { System.getProperty("slow-test") != "true" })
@interface IntegrationSpec {}
When using the @IgnoreIf as a meta-annotation the way above, it is ignored by Spock.
Describe the solution you'd like
The @ignoreIf annotation allows inheritance. However, it would be cleaner if the @ignoreIf could be used as a meta-annotation so that the tests can extend Specification rather than a custom implementation, that would exist only because of the need for @IgnoreIf being applied to it.
Describe alternatives you've considered
At the moment, we use Groovy @AnnotationCollector to work around the problem. However, IntelliJ has got issues whenever recompiling the code.
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named in the issue. Start by reproducing the shown @IntegrationSpec example and tracing how Spock handles @IgnoreIf and meta-annotations; done means @IgnoreIf works through the custom annotation while specifications can still extend Specification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy, java
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100