[
https://issues.apache.org/jira/browse/SUREFIRE-1314?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15963401#comment-15963401
]
Mikhail Stepura edited comment on SUREFIRE-1314 at 4/10/17 7:40 PM:
--------------------------------------------------------------------
I've added a test case to reproduce the problem into
{{Surefire1146RerunFailedAndParameterized}} -
https://github.com/Mishail/maven-surefire/commits/SUREFIRE-1314
When I run
{code}
INFO] Running jiras.surefire1146.ErrorInBeforeClassTest
Running JUnit 4.12
success false
Description.isTest(): false
Description.getChildren: [test(jiras.surefire1146.ErrorInBeforeClassTest)]
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.003 s
<<< FAILURE! - in jiras.surefire1146.ErrorInBeforeClassTest
[ERROR] jiras.surefire1146.ErrorInBeforeClassTest Time elapsed: 0.003 s <<<
FAILURE!
java.lang.AssertionError
at
jiras.surefire1146.ErrorInBeforeClassTest.beforeClass(ErrorInBeforeClassTest.java:19)
{code}
So description a {{BeforeClass}} failure has {{getChildren}} as an non-empty
list (it contains all the tests in a class), so {{isTest()}} return false.
was (Author: mishail):
I've added a test case to reproduce the problem into
{{Surefire1146RerunFailedAndParameterized}} -
https://github.com/Mishail/maven-surefire/commits/SUREFIRE-1314
When I run
```
INFO] Running jiras.surefire1146.ErrorInBeforeClassTest
Running JUnit 4.12
success false
Description.isTest(): false
Description.getChildren: [test(jiras.surefire1146.ErrorInBeforeClassTest)]
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.003 s
<<< FAILURE! - in jiras.surefire1146.ErrorInBeforeClassTest
[ERROR] jiras.surefire1146.ErrorInBeforeClassTest Time elapsed: 0.003 s <<<
FAILURE!
java.lang.AssertionError
at
jiras.surefire1146.ErrorInBeforeClassTest.beforeClass(ErrorInBeforeClassTest.java:19)
```
So description a {{BeforeClass}} failure has {{getChildren}} as an non-empty
list (it contains all the tests in a class), so {{isTest()}} return false.
> rerunFailingTestsCount doesn't work for errors in BeforeClass methods
> ---------------------------------------------------------------------
>
> Key: SUREFIRE-1314
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1314
> Project: Maven Surefire
> Issue Type: Bug
> Components: Junit 4.x support
> Affects Versions: 2.19.1
> Reporter: Mikhail Stepura
> Assignee: Tibor Digana
>
> We're using {{surefire.rerunFailingTestsCoun}} property for our integration
> tests, and everything working fine when an error/failure happens in a test
> method (i.e. {{@Test}} ), and those test methods are re-executed later, as
> expected.
> But if an error happens in a {{BeforeClass}} class method, then those test
> classes are not re-executed.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)