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 @Testable on fields #2168

Closed
rweisleder opened this issue Jan 30, 2020 · 4 comments
Closed

Allow @Testable on fields #2168

rweisleder opened this issue Jan 30, 2020 · 4 comments

Comments

@rweisleder
Copy link
Contributor

rweisleder commented Jan 30, 2020

Background

Currently, it's only possible to annotate classes and methods with @Testable to indicate that those are testable.

In ArchUnit we have a custom engine to execute defined architecture rules as tests. The user has to annotate the elements with @ArchTest. The engine executes all rules that are annotated @ArchTest, no matter if they are methods or fields.

Example project: archunit-example/example-junit5
Example test class: CodingRulesTest

When I open the mentioned test class in my IDE, the IDE only recognizes the class itself and the one method as testable. The fields are not recognized as testable.

Suggestion

It should be possible to (meta)-annotate fields with @Testable. With this enhancement, IDEs have the chance to identify testable fields.

@sbrannen
Copy link
Member

It should be possible to (meta)-annotate fields with @Testable. With this enhancement, IDEs have the chance to identify testable fields.

It is already possible to meta-annotate fields with @Testable.

So, if an IDE doesn't find @Testable as a meta-annotation on fields, you would need to bring that up with the maintainers of the IDE.

As for allowing @Testable to be declared directly on a field, I don't see any problem with allowing that.

@junit-team/junit-lambda, thoughts?

@sbrannen
Copy link
Member

Tentatively slated for 5.7 M1 for team discussion

@marcphilipp
Copy link
Member

Team decision: Allow @Testable to be used on fields directly.

@marcphilipp
Copy link
Member

LGTM! 👍

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

4 participants