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

Bump to JUnit 5.11 M1, add FieldSource tests & rely on JUnit Platform for test method discovery #329

Closed
wants to merge 6 commits into from

Conversation

mannodermaus
Copy link
Owner

No description provided.

@mannodermaus mannodermaus self-assigned this Apr 28, 2024
@mannodermaus mannodermaus changed the title Bump to JUnit 5.11 M1, try out FieldSource and clean up some internal method names Bump to JUnit 5.11 M1, add FieldSource tests & rely on JUnit Platform for test method discovery Apr 28, 2024
Comment on lines 22 to 28
protected val jupiterTestAnnotations = listOf(
Test::class.java,
TestFactory::class.java,
RepeatedTest::class.java,
TestTemplate::class.java,
ParameterizedTest::class.java,
)
Copy link

@bddckr bddckr May 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this hardcoded list, should the finder look for symbols annotated with @Testable (or another annotation that is itself annotated @Testable instead? See the Jupiter docs:

In order to facilitate test discovery within IDEs and tools prior to launching the JUnit Platform, TestEngine implementations are encouraged to make use of the @Testable annotation. For example, the @Test and @TestFactory annotations in JUnit Jupiter are meta-annotated with @testable. Consult the Javadoc for @Testable for further details.

https://junit.org/junit5/docs/current/user-guide/#test-engines-custom

This should help to support other test frameworks' TestEngines.

Copy link
Owner Author

@mannodermaus mannodermaus May 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea behind this declaration is to allow introspection of Jupiter's annotations by name, even for devices that don't support Java 8 yet. If we look inside of these annotations too much, we risk crashing because of unsupported features (e.g. when detecting @Repeatable in the meta-annotations). I do like the idea of opening up the scope beyond just Jupiter for devices that do support JUnit 5, though, so I cleaned it up a little in the latest commits. Now the annotations are only looked up for old devices and the newer ones only use what the discovery process of the platform returns to it, removing redundancy. ✨

That being said, most of the engines I was able to test require APIs that aren't available on Android (Spek, Cucumber). But hey: At least our Android bridge tried to load them in the first place - I call that a first step win. 🤷‍♂️

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation! That all makes sense to me!

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

Successfully merging this pull request may close these issues.

2 participants