@RunWith makes Maven ignore my test with my own runner

I am transitioning from using only Intellij to manage my Intellij / Maven build system. When I run my integration test "MapSimulationTest" with my own runner via @RunWith (KmlParameterizedRunner.class) Intellij handles the situation correctly, the directory specified by the system property "user.dir" is checked against .kml files and each is tested.

The problem is Surefire is ignoring @RunWith, any suggestions?

This is what the maven log shows ...

----------------------------------------------- --- ----- TESTS -------------------------------------------- ------ ----- Run com.tqicorp.guru.MapSimulationTest Spaces: 0, Errors: 0, Errors: 0, Skipped: 0, Elapsed Time: 0.061 sec.

+2


a source to share


4 answers


I am using surefire and @RunWith with Spring test runner and it works fine with maven 2.2.1.



To track down the problem, you can try to create a simple Junit test using the @Test annotation rather than the old testXXX method. Run "mvn test" and check if your test is running. If so, it will rule out any old junit possibility in your path. If it fails, run "mvn site" and search for the dependency report for junit and check the version. It's amazing how easily unwanted versions can appear!

+2


a source


You might be doing this already, but it can happen if your maven dependency is using an older version of junit (3.x) instead of junit 4.x where these annotations are respected. Check your pom.xml to see if the right version is junit articfact



+1


a source


Try to check if you are using the latest version of the maven-surefire plugin; I was burned in the past by bugs with my trusty mustache until I moved those bugs, which were fixed in a newer version of the plugin, and I just had to update.

+1


a source


This can happen if you have a TestNG dependency. Remove dependency and Maven will look for @ org.junit.Test annotations in your classes, if TestNG dependency is present then Maven looks for @ org.testng.annotations.Test annotation.

+1


a source







All Articles