Ensure GraalVM native build tools support @Nested
tests in @ParameterizedClass
es
#4440
Labels
Milestone
@Nested
tests in @ParameterizedClass
es
#4440
Currently,
@Nested
test classes in enclosing@ParameterizedClass
es are not registered for reflection which causes errors like the following when running tests in the native image:In order to make reflection work, the
JUnitPlatformFeature
of native-build-tools traverses theTestPlan
and registers all classes fromTestIdentifier
instances with aClassSource
for reflection: https://github.com/graalvm/native-build-tools/blob/c4c34356af1427bf4957305b40111f253bc4762a/common/junit-platform-native/src/main/java/org/graalvm/junit/platform/JUnitPlatformFeature.java#L128-L148While that works for regular
@Nested
classes, children of@ParameterizedClass
are not part of theTestPlan
since they are created dynamically at runtime.I see two options for fixing this:
PostDiscoveryFilter
which would see the@Nested
classes in@ParameterizedClass
ones before they're pruned instead of inspecting theTestPlan
TestPlan
but register all inner classes (or all@Nested
-annotated inner classes) for reflection in addition to the top-level test classesDeliverables
@ParameterizedClass
graalvm/native-build-tools#711The text was updated successfully, but these errors were encountered: