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

JUnit test discovery integration #253

Open
sgammon opened this issue Jan 14, 2024 · 0 comments
Open

JUnit test discovery integration #253

sgammon opened this issue Jan 14, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@sgammon
Copy link
Owner

sgammon commented Jan 14, 2024

Bazel's default method for running Java tests involves a custom runner and potentially a custom launcher; for native test cases, no launcher is needed at all, but the runner is still needed.

Additionally, GraalVM provides its own runner implementation which discovers JUnit tests in a native binary.

To invoke this code path properly, we probably need to introduce our own runner, which reads the Bazel runner from a new system property (bazel.graalvm.wrapped_testrunner), and then performs the following steps:

  • Load the class at bazel.graalvm.wrapped_testrunner, or fallback to default (com.google.testing.junit.runner.BazelTestRunner)
  • Read the test suite target from bazel.test_suite
  • Invoke initialization steps in org.graalvm.junit.platform.NativeImageJUnitLauncher, or otherwise repeat that code
  • Invoke initialization steps and pass control over to the wrapped runner

There is some other ceremony related to testing:

  • The native-image build for the test needs --features=org.graalvm.junit.platform.JUnitPlatformFeature
  • The runner class will need to be registered for reflection. Since this is dynamic, we will need a Feature for this as well
@sgammon sgammon added the enhancement New feature or request label Jan 14, 2024
@sgammon sgammon added this to the 1.0.0 milestone Jan 14, 2024
@sgammon sgammon self-assigned this Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

1 participant