Below are some of my impressions.
JUnit has “rules” that reduce the amount of template code. For example, a rule can start a servlet container before a test and stop it after, create and enter an instance of Selenium, and so on. This makes the tests more elegant.
TestNG supports groups (and their dependencies). This is extremely useful for integration testing - for example, you can enable specific groups in certain environments. JUnit 4.8 introduces "categories" that may be somewhat similar.
Spring Test has a very good approach with “test run listeners” that can “prepare” your test instances. This is somewhat similar to JUnit rules. Spring Test is also an agnostig test framework, i.e. your tests will be almost the same on JUnit or TestNG. There are also “profiles” that are similar to TestNG groups.
Here is a sample of the tested Selenium JSF application based on TestNG. Also look at my Hifaces20 Testing , you might find some useful ideas.
source share