-
Notifications
You must be signed in to change notification settings - Fork 73
JUnitPlatformFeature
unexpectedly failed with a JUnitException
#541
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
Comments
I am reporting this here since |
@dnestoro Is there a chance at getting this triaged? |
Possibly fixed by #565 although I have not checked. |
|
We're seeing this exception on 0.10.3 as well. |
@stevenschlansker As a workaround, you can mark the overridden method with |
@danthe1st , thanks for the suggestion but ... which test case? The error message does not print out which test case causes the failure, and we have thousands of tests :( I suppose I can narrow the search to a test class that extends another, but still. If this issue really won't be fixed I will eventually invest the time to look at doing so... but given the number of users reporting this, I will hope for a fix in the next release for now :) |
@stevenschlansker |
Unfortunately this issue still exists in 0.10.4. |
If you care sufficiently about the issue, you can probably contribute a fix (though you'd probably need to sign the OCA). I wouldn't really expect it to be fixed without anyone interested in it to be honest (and it's possible to work around the issue). |
Upgrading installed java to 23.0.1-graal solved the issue for me. Also dependencies need to be updated junit-platform-commons to 1.11.4 and junit-jupiter-engine and junit-jupiter-api to 5.11.4. |
@luis100 The issue still happens with my reproducer using the latest versions
|
For anyone experiencing this: You can add the following to the native-maven-plugin <buildArgs>
<buildArg>-H:+ReportExceptionStackTraces</buildArg>
</buildArgs> This might make it easier to understand why the exception occurred. |
Thanks @Marcono1234.
|
Hi @danthe1st, The stack trace points out that the That method was renamed to Thus, it appears that the versions of This is also related to:
Aligning the versions of JUnit artifacts should hopefully resolve the problem for you. What happens if you use the JUnit BOM? |
@sbrannen I updated my reproducer to use JUnit 5.12.1 using the BOM (previously I only declared junit-jupiter-api without any other dependencies).
(before that, it was using It guess that the native-maven-plugin might overwrite the version in some way. |
Thanks for trying out the BOM. The log you shared shows that the versions of various JUnit artifacts are not being influenced by the JUnit BOM. For example, Basically, it looks like the classpath for the It probably will not be enough to sort things out, but what happens if you add an explicit dependency on |
And now that I think about it, this sounds very similar to what I reported several years ago... |
@sbrannen junit-platform-native has dependencies on junit 5.10.0. These are declared in this repository but I have no idea where it gets the version from. |
I think the versions are managed here. And as @lazar-mitrovic pointed out, it could be that the following logic needs to be revised. Lines 121 to 136 in de5af29
|
When I changed the version in my local ...
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.12.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-console</artifactId>
<version>1.12.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.12.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
So these versions are in fact used. It still not working isn't surprising as it's probably still set in some other places but I guess this confirms that the version declared there is actually the issue. Also when I run
These are multiple different versions of JUnit I didn't specify in my (reproducer) POM. |
Indeed, you get a different stack trace there. The reason is that Specifying the <dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.12.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
</dependency>
</dependencies> I tried the above with your original reproducer, and that works for me! 👍 Running Maven with
From that you can see that the appropriate JUnit 5.12.1/1.12.1 artifacts (that you requested) are on the class path before the JUnit 5.10.0/1.10.0 artifacts (hard coded in the plugin). In other words, if you override all artifacts that the plugin adds to the classpath, you effectively have a workaround for this issue. In light of the above, I am closing this as a: |
JUnitPlatformFeature
unexpectedly failed with a JUnitException
Before reporting
Describe the bug
When overriding an
@Test
method and without marking the overridden method with@Test
, compilation of the test fails withError: Feature defined by org.graalvm.junit.platform.JUnitPlatformFeature unexpectedly failed with a(n) org.junit.platform.commons.JUnitException. Please report this problem to the authors of org.graalvm.junit.platform.JUnitPlatformFeature.
.To Reproduce
@Test
method@Test
mvn test
See this minimal reproducer (CI log here)
Expected behavior
Native compilation of tests succeed and the tests run successfully.
Logs
Full logs here
System Info (please complete the following information):
Linux
graalvm-community-jdk-21.0.1_linux-x64_bin
21
native-maven-plugin:0.9.28
Additional context
Full reproducer here
The text was updated successfully, but these errors were encountered: