stefanbirkner / system-rules

A collection of JUnit rules for testing code which uses java.lang.System.
http://stefanbirkner.github.io/system-rules
Other
546 stars 71 forks source link

Running more than one test class at a time breaks tests #67

Open mrmanc opened 6 years ago

mrmanc commented 6 years ago

I just added this library to a project and found that while the tests passed in the IDE, the tests failed when running via Maven.

Removing the configuration from my pom.xml which runs tests in parallel causes the tests to pass. Removing the rule usage from one of the two tests I added it to also causes the tests to pass.

Is this likely to be some collision of static code?

Maven configuration:

…
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.20.1</version>
                <configuration>
                    <parallel>classes</parallel>
                    <useUnlimitedThreads>true</useUnlimitedThreads>
                    <reportsDirectory>../target/surefire-reports</reportsDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>