-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
When the following surefire plugin config is used
<threadCount>2</threadCount>
<parallel>classes</parallel>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
then the output from the tests is partially directed to the 'xxxtest-output.txt file and partially to stdout. At first I thought this was a surefire plugin bug and filed this ticket (https://issues.apache.org/jira/browse/SUREFIRE-1230). The ticket has steps to reproduce the issue.
However, I debugged the issue a bit and found that when I run cukes, the JUnit4RunListener.testStarted method in Surefire is called after each step definition (i.e test) is executed. When I run plain junit based unittests, that method is called before test is executed. This is the correct behaviour, i.e the 'testStarted' method should be called prior to the test.
Surefire sets the logger inside the 'testStarted' method. Since Cucumber calls this after running the tests, the logs are redirected partially to stdout and partially to the file.