cornercorner
FeaturesPluginsDocs & SupportCommunityPartners

TestNG

TestNG support

Adds support for creating, running, debugging and displaying results for TestNG tests in Ant and Maven based projects in NetBeans 6.5 and/or later except of NetBeans module projects.


Contents


Plugin Sources

Note: sources are not compatible with release65 sources

Plugin Binaries

Note: latest binaries are no longer compatible with 6.5.

Creating Tests

TestNG Test can be created:

  • using New File -> TestNG -> TestNG Test Case wizard
  • directly from the editor using TestNG -> Create Test... action in editor's context menu

The template for the test can be further configured in Tools -> Templates

Running/Debugging Tests

Because of tight integration of JUnit testing framework in NetBeans most IDE-wide tests related actions do not work for TestNG tests. Following table gives an overview about supported ways to run/debug tests in NetBeans 6.5 (better integration is planned for 7.0):

Action Ant projects - disabled compile on save Ant projects - enabled compile on save Maven projects
Run all tests in a project Test (Alt+F6) Test (Alt+F6) Test (Alt+F6)
Run test Run File (Shift+F6) TestNG -> Run Test Class Run File (Shift+F6)
Run test method TestNG -> Run Test Method TestNG -> Run Test Method TestNG -> Run Test Method
Re-run failed test(s) TestNG -> Re-run Failed Tests TestNG -> Re-run Failed Tests TestNG -> Re-run Failed Tests
Debug test TestNG -> Debug Test Class TestNG -> Debug Test Class TestNG -> Debug Test Class
Debug test method TestNG -> Debug Test Method TestNG -> Debug Test Method TestNG -> Debug Test Method

Note: TestNG here refers to TestNG action group in editor's context menu

TestNG Results Window

Results window provides almost the same set of features as the JUnit one + adds ability to re-run only failed tests from a previous run, run/debug only particular test suite/test case directly from the results window and open test suite or test method in the editor. On-line reporting and showing results in this window in Maven projects is not supported yet.

Image:resultsWindow_TestNG.png

Issues


  • no outputtab -> test source navigation in case of a fail in @Test(expectedExceptions={Exception.class})
  • new testng test wizard should not allow user to create a test in source packages
    (f. in 37ef1c5d7b81)
  • debug junit test opens testng output window
  • should get rid of junit libs in a project if testng test is the first test created there?
  • testng test file template(s) should have its own category in new project wizard (or need to convince Marian to rename JUnit category to sth more generic ie. Test (?))
    (f. in 7b07d6e97a05)
  • no way to pass system properties to testng tests yet (testng task does not support systempropertyset)
  • create some WEB app., EJB module or AppClient and some java class (or servlet and so one) and test for it, then try build this project --> it fails
    (f. in 601cb4c52cf1)
  • have some java class in <default package> and try to create test --> test will not be created and it will finish with the exception
    (f. in 8604ebee632c).

Related stuff