'Running tests in parallel with maven failsafe plugin

I'm trying to get our integration api tests to run in parallel with maven failsafe plugin.

But when I run the tests, with this added parameters for failsafe plugin in POM, I have a problem with steps like this

 Run 1: Expected step: "A" got step: "B"
 Run 2: Expected step: "C" got step: "D"
 Run 3: Expected step: "E" got step: "F"

This is the POM. Can anyone advise please? Thanks.

            <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>${maven.failsafe.plugin.version}</version>
            <configuration>
                <parallel>classesAndMethods</parallel>
                <threadCount>4</threadCount>
                <perCoreThreadCount>false</perCoreThreadCount>
                <includes>
                    <include>runner/TestRunner.java</include>
                </includes>
                <encoding>${project.build.sourceEncoding}</encoding>
                <failIfNoTests>true</failIfNoTests>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>integration-test</goal>
                        <goal>verify</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source