olamy opened a new issue, #3267:
URL: https://github.com/apache/maven-surefire/issues/3267
### Affected version
3.5.4
### Bug description
Given the following class:
```
package test;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.fail;
public class SomeTest {
@BeforeAll
public static void setUpClass() {
double r = Math.random();
if (r < 0.3) {
fail();
}
}
@Test
public void test1() {
}
}
```
It's failing randomly.
When success the file `target/surefire-reports/TEST-test.SomeTest.xml`
contains the correct method name
```
<testcase name="test1" classname="test.SomeTest" time="0.01"/>
```
When failing there is no method name
```
<testcase name="" classname="test.SomeTest" time="0.043">
<failure type="org.opentest4j.AssertionFailedError at
org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java"><![CDATA[org.opentest4j.AssertionFailedError
at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:34)
at org.junit.jupiter.api.Assertions.fail(Assertions.java:116)
at test.SomeTest.setUpClass(SomeTest.java:38)
at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at
org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
stack trace simplified
]]></failure>
</testcase>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]