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
tosetUp()
methods and@AfterTest
totearDown()
methods - Adding
@Test
to all public methods whose names start withtest
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 ...
Get Next Generation Java™ Testing: TestNG and Advanced Concepts now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.