Skip to content

Move @Testable to a new junit-platform-commons-api artifact #4446

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

Open
1 task
yuuki3655 opened this issue Apr 3, 2025 · 2 comments
Open
1 task

Move @Testable to a new junit-platform-commons-api artifact #4446

yuuki3655 opened this issue Apr 3, 2025 · 2 comments

Comments

@yuuki3655
Copy link

yuuki3655 commented Apr 3, 2025

The @Testable annotation is a useful tool for TestEngine developers to facilitate the integration of custom tests executed by our own test engine with IDEs.

You can define the following annotation class for your test engine.

@MustBeDocumented
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.FUNCTION)
@Testable
annotation class MyTest

Then, you can use it from your test case.

@MyTest
fun myTest() {  }

However, it introduces a transitive dependency on junit-platform-commons, which includes a number of unnecessary utility classes for this use case, such as LruCache.

Deliverables

  • Create a new Maven artifact named junit-platform-commons-api and move the @Testable annotation to it.
@sbrannen sbrannen changed the title Move the @Testable annotation to a new junit-platform-commons-api artifact Move @Testable to a new junit-platform-commons-api artifact Apr 4, 2025
@sbrannen
Copy link
Member

sbrannen commented Apr 4, 2025

Hi @yuuki3655,

I understand the desire to have a "lightweight" artifact that only contains @Testable; however, it's very late in the game to be making a change like that which could potentially break projects, build tools, and IDEs.

In addition, publishing a new artifact that contains a single annotation does not seem to warrant such a risk.

In light of that, I am inclined to decline this request; however, we will discuss it within the team.

@marcphilipp
Copy link
Member

I just tried this out myself to see what IntelliJ currently supports. It seems it only works if junit-platform-commons is on the compile classpath of the project using the @MyTest annotation. I had hoped it would be sufficient to use compileOnly("org.junit.platform:junit-platform-commons") in the project declaring MyTest but even implementation isn't sufficient.

@yuuki3655 I don't know how this feature is implemented in IntelliJ but maybe you could ask them if they could consider annotations to be annotated with @Testable even if the type is not on the compile classpath?

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

3 participants