Skip to content

Test output logs incorrect when running Cucumber feature files in parallel #966

@mpalki1

Description

@mpalki1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions