[ https://issues.apache.org/jira/browse/SUREFIRE-1621?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alex Chacha updated SUREFIRE-1621: ---------------------------------- Description: Test classes/methods have to be made pubic in order for maven/surefire to execute them. Following will not execute (DebugTest.java) with surefire but will work with IntelliJ, eclipse, Gradle, etc that support JUnit5: {code:java} class DebugTest { @Test void failAlways() { assertTrue(false); } } {code} However changing it to following will work with Surefire but cause IDEs to flag public scope that can be changed to package-private: {code:java} public class DebugTest { @Test public void failAlways() { assertTrue(false); } } {code} JUnit 5 is supposed to support package-private declaration for test classes and test methods and IDEs like IntelliJ and eclipse are suggesting this, creating issues for people writing new tests that are not aware of the surefire anomaly. Also automatic code cleanup in some IDEs are changing the tests to be package-private and causing them to no longer run. Package-private tests are running correctly inside the IDEs and via Gradle, but being skipped with Maven+Surefire. from POM (basically a simple java project):( {code:java} <build> <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M3</version> </plugin> </plugins> </build> {code} and in dependencies: {code:java} <dependencies> ... <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> <version>5.3.2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M3</version> <scope>test</scope> </dependency> </dependencies> {code} was: Test classes/methods have to be made pubic in order for maven/surefire to execute them. Following will not execute (DebugTest.java) with surefire but will work with IntelliJ, eclipse, Gradle, etc that support JUnit5: class DebugTest { @Test void failAlways() { assertTrue(false); } } However changing it to following will work with Surefire but cause IDEs to flag public scope that can be changed to package-private: public class DebugTest { @Test public void failAlways() { assertTrue(false); } } JUnit 5 is supposed to support package-private declaration for test classes and test methods and IDEs like IntelliJ and eclipse are suggesting this, creating issues for people writing new tests that are not aware of the surefire anomaly. Also automatic code cleanup in some IDEs are changing the tests to be package-private and causing them to no longer run. Package-private tests are running correctly inside the IDEs and via Gradle, but being skipped with Maven+Surefire. from POM (basically a simple java project):( <build> <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M3</version> </plugin> </plugins> </build> and in dependencies: <dependencies> ... <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> <version>5.3.2</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M3</version> <scope>test</scope> </dependency> </dependencies> > package-private class/method supported in JUnit5 is not executed > ---------------------------------------------------------------- > > Key: SUREFIRE-1621 > URL: https://issues.apache.org/jira/browse/SUREFIRE-1621 > Project: Maven Surefire > Issue Type: Bug > Components: JUnit 5.x support > Affects Versions: 3.0.0-M3 > Environment: Java openJDK11, Maven 3.6.0 > Reporter: Alex Chacha > Priority: Major > > Test classes/methods have to be made pubic in order for maven/surefire to > execute them. > > Following will not execute (DebugTest.java) with surefire but will work with > IntelliJ, eclipse, Gradle, etc that support JUnit5: > > {code:java} > class DebugTest { > @Test > void failAlways() { assertTrue(false); } > } > {code} > > However changing it to following will work with Surefire but cause IDEs to > flag public scope that can be changed to package-private: > > {code:java} > public class DebugTest { > @Test > public void failAlways() { assertTrue(false); } > } > {code} > > JUnit 5 is supposed to support package-private declaration for test classes > and test methods and IDEs like IntelliJ and eclipse are suggesting this, > creating issues for people writing new tests that are not aware of the > surefire anomaly. Also automatic code cleanup in some IDEs are changing the > tests to be package-private and causing them to no longer run. > > Package-private tests are running correctly inside the IDEs and via Gradle, > but being skipped with Maven+Surefire. > > from POM (basically a simple java project):( > > {code:java} > <build> > <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory> > <plugins> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-surefire-plugin</artifactId> > <version>3.0.0-M3</version> > </plugin> > </plugins> > </build> > {code} > > > and in dependencies: > > {code:java} > <dependencies> > ... > <dependency> > <groupId>org.junit.jupiter</groupId> > <artifactId>junit-jupiter-api</artifactId> > <version>5.3.2</version> > <scope>test</scope> > </dependency> > <dependency> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-surefire-plugin</artifactId> > <version>3.0.0-M3</version> > <scope>test</scope> > </dependency> > </dependencies> > {code} > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)