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

Allow @IgnoreIf to be used as meta-annotation #1558

Open
lobodpav opened this issue Jan 16, 2023 · 2 comments
Open

Allow @IgnoreIf to be used as meta-annotation #1558

lobodpav opened this issue Jan 16, 2023 · 2 comments

Comments

@lobodpav
Copy link

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

@szpak
Copy link
Member

szpak commented Jan 16, 2023

Some previous discussion in #1309. Some open related Groovy issue - GROOVY-10041. Maybe it's good to re-consider the approach (or ask the Groovy team to fix it).

@lobodpav Do you have any other issues in Idea in mind (especially with the link to YouTrack)?

@lobodpav
Copy link
Author

Some previous discussion in #1309. Some open related Groovy issue - (https://issues.apache.org/jira/browse/GROOVY-10041)[GROOVY-10041]%5BGROOVY-10041%5D)

Thanks for the references. I did not bump into these.

Since the @AnnotationCollector is making issues for everyone, It might make sense to implement meta-annotation support for Spock annotations. It would be a better solution anyways - the @AnnotationCollector seems to me more like a workaround anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants