The Workable Configuration for TestNG, Maven 2, SureFire, and Ecplise
I started to use TestNG for testing in Java today. and it took me a while to find out that the workable Configuration for TestNG, Maven 2's Surefire, is:
- TestNG 5.1,
- Surefire 2.3
The real important thing is to specify <classifier>jdk15</classifier> for JDK 1.5+, or <classifier>jdk14</classifier> for JDK 1.4 in your pom file. The reference can be found here
If you don't specify the classifier, it seems to run in jdk14 mode. so all of my tests using annotations didn't run with Maven.
If you run your TestNG tests within Eclipse using the TestNG plugin, make sure that you select the correct annotation compliance level in your Eclipse run/debug configurations.
Another gotcha is Surefire 2.3 doesn't work with TestNG 5.2+.
If you still have problems, you should check out the discussion on combo of TestNG/Surefire that works
Happy testing!











