Migration from jUnit to TestNG

If we choose to make TestNG as the testing library in our automation framework , we can easily do that with the Eclipse/IntelliJ Plugins:

Excellent report on converting an entire project from jUnit to TestNG https://developers.opengamma.com/blog/2011/04/04/converting-opengamma-junit-testng

Use caseJUnit 4TestNGComment
Method is a test@Test@TestSimply change the import
Class is a testN/A@TestWe decided to stick with
per method annotations
in the end
Test is disabled@Ignore@Test(enabled=false)@Ignore on the class
disables all tests
 in the class, whereas @Test
(enabled = false) on the class
doesn't override @Test
on a method
An exception is expected@Test
Simple spelling change
Test timeout@Test(timeout
@Test(timeOut=20000)Simple spelling change
Run before/after each test method@Before/@After@BeforeMethod/
Clearer annotation name
Run before/after each test method@BeforeClass
JUnit requires a static method,
TestNG allows either a static
or an instance method
Run before/after
each entire test suite


Popular posts from this blog

Trim / Remove spaces in Xpath?

Complete list of Serenity properties

XPATH for IE / internet explorer