The Workable Configuration for TestNG, Maven 2, SureFire, and Ecplise

Submitted by kai on Wed, 2007-05-02 22:19. ::

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!

Minho Cho
Submitted by Minho Cho (not verified) on Wed, 2007-05-30 14:12.

Kai - been reading on your blog - are you open minded to a new opportunity?

Give me a call back at 775-746-1508 if you are.

Thanks

Post new comment



The content of this field is kept private and will not be shown publicly.


*

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • WikiText is converted to HTML (supported WikiText formatting will show in the long tip format).
Verify comment authorship
Captcha Image: you will need to recognize the text in it.
*
Please type in the letters/numbers that are shown in the image above.