JBoss.orgCommunity Documentation

Chapter 12. Using TestNG project

12.1. What is TestNG?
12.2. Other relevant resources on the topic
12.3. How to use the generated Seam-test project to run Seam tests?

With the help this chapter you will get to know with TestNG.

TestNG ("Testing, the Next Generation") is a Java unit testing framework that aims to overcome many limitations of JUnit. TestNG introduces some new functionalities that make it more powerful and easier to use, such as:

More information can be found on home page: www.testng.org

Next-Generation Testing with TestNG (An Interview with Cedric Beust)

TestNG: The next generation of unit testing

Test Categorization Techniques with TestNG

TestNG makes Java unit testing a breeze

In pursuit of code quality: JUnit 4 vs. TestNG


  • Add Seam Action to your project via File > New > Seam Action.


  • Fill out the wizard fields. New Seam Action wizard will create resources and place them in the appropriate folders dependent on EAR project structure.


  • When Action is created you will see actionPage.xhtml in Package Explorer view. ActionBean.java will be automatically opened in Java Editor.


  • Select ActionLocalTest.xml in Seam-test project and run the test with right click Run As > TestNG Suite.


The test process will start and its output will be written in Console View.


  • After running TestNG you will have the test results in test-output folder in Seam-test project (press F5 to refresh the Package Explorer view). Open index.html file with Web Browser or simply use the TestNG view.

The below view shows a successful run of the test.


You can see the test results in Web Browser.


After clicking on ActionLocal Tests link you will see the Results for ActionLocal Tests.


Select a result on the left-hand pane and its details will be displayed on the right-hand one.