0

The question is a classic and has been asked several times. But those questions and their answers are a few years old now.

So what are the differences of JUnit and TestNG in their current versions? Are there still important features of TestNG missing in JUnit? How easy is PowerMock integration? What about tool support (quality of IDE and CI server plugins).

Or, asked the other way around: are there any good reasons to prefer JUnit over TestNG?

Community
  • 1
  • 1
deamon
  • 89,107
  • 111
  • 320
  • 448

2 Answers2

4

After some more research I've found the following advantages of TestNG compared to JUnit:

  • support for multi threading tests
  • better test parameterization
  • more detailed reports
  • better grouping of tests
  • test prioritization
  • dependencies between tests (useful for integration test and gui tests)
  • much better documentation
  • additional setup/teardown levels (@Before/AfterSuite, @Before/AfterTest, @Before/AfterGroup)
  • tends to be faster in execution

References:

http://kaczanowscy.pl/tomek/sites/default/files/testng_vs_junit.txt.slidy_.html#(1) http://kaczanowscy.pl/tomek/sites/default/files/2013_junit_and_testng.html#(1) http://softwaretestingguide4u.blogspot.de/2013/01/junit-4-vs-testng.html http://architects.dzone.com/articles/how-i-learned-stop-worrying-0 http://www.intertech.com/Blog/Post/Java-QA-Tools-for-Unit-Testing.aspx http://roadtoautomation.blogspot.de/2013/02/testng-vs-junit-4.html

deamon
  • 89,107
  • 111
  • 320
  • 448
0

The answers basically stay the same. The tool and IDE support are very good as both have been established for many years, so it's basically a matter of taste.

PowerMock might integrate a little easier with TestNG, but I have never used it with Junit.

IMO TestNG still has the advantage of the data providers and of being able to configure your tests on several levels.

jabbrwcky
  • 598
  • 5
  • 6