O'Reilly logo

Next Generation Java™ Testing: TestNG and Advanced Concepts by Hani Suleiman, Cédric Beust

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix D. Migrating from JUnit

In this appendix, we explain how existing JUnit 3 tests can be migrated to TestNG. Whether you choose to use the command line or an IDE, the migration tools will typically perform the following operations on existing tests:

  • Adding the relevant TestNG imports
  • Adding @BeforeTest to setUp() methods and @AfterTest to tearDown() methods
  • Adding @Test to all public methods whose names start with test

The tool modifies your source files, but none of these changes alter the code inside test methods in any way, which makes this process fairly nonintrusive. You still have the choice of not overwriting your sources if you want to verify the results yourself (this is described below).

JUnitConverter

JUnitConverter is a tool ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required