Create new JBoss Tools Documentation Jira issue

This will launch the Jboss Tools Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.orgCommunity Documentation

Chapter 15. Using TestNG project

15.1. What is TestNG?
15.2. Other relevant resources on the topic
15.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.

Tip

OpenOn is available in testNG XML files opened in JBoss XML Editor


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.


Thus with Seam tooling you can easily take advantage of TestNG framework. As you can see, it generates its own TestNG project as a separate module within which you can easily monitor the tests execution and their output.