junit-team / junit5

✅ The 5th major version of the programmer-friendly testing framework for Java and the JVM
https://junit.org
Other
6.32k stars 1.46k forks source link

Provide built-in support for GraalVM native images #3040

Open sbrannen opened 1 year ago

sbrannen commented 1 year ago

Overview

The GraalVM Native Build Tools (NBT) project provides support for running tests within a native image using the JUnit Platform. Since JUnit 5 has never provided built-in support for running in a native image, the NBT team implemented an internal PluginConfigProvider mechanism for contributing native image configuration for the JUnit Platform, JUnit Jupiter, and JUnit Vintage projects.

The JUnitPlatformFeature also registers reflection for all test classes.

Rationale

The code in the above classes is very specific to JUnit 5 and can therefore be better maintained by the JUnit team. In addition, having the native image configuration directly in JUnit 5 artifacts will allow the JUnit team to proactively integration test support for GraalVM native images, thereby avoiding issues such as #3035.

Deliverables

wilkinsona commented 1 year ago

+1 for this. The breaking change in 5.10 that requires --initialize-at-build-time for two classes would be avoided if appropriate native-image.properties files were were included in the relevant jars.