views:

212

answers:

3

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

The problem seems to be that Surefire ignores @RunWith, any suggestions?

Here is what the maven log shows...

------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.tqicorp.guru.MapSimulationTest Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.061 sec

+1  A: 

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

Fazal
This is not the case, I have excluded junit and junit-dep in libraries that have an older version of JUnit as a transient dependency (ie: jmock).
Benju
+1  A: 

I'm using surefire and @RunWith with the Spring test runner, and it is working fine with maven 2.2.1.

To track down the problem, you could try creating a simple Junit test using the @Test annotation, rather than the old style testXXX method. Run "mvn test" and see if your test is being executed. If it is, that will rule out any possibility of an old junit in your path. If it's not being executed, then run "mvn site", and search the dependencies report for junit, and check the version. It's amazing how easy unwanted versions can creep in!

mdma
+1  A: 

Try verifying you are using the latest version of the maven-surefire-plugin; I have been burned in the past by bugs with my surefire uasge until I relized these bugs had been fixed in a newer version of the plugin and I simply had to update.

Gweebz