Join 500+ Software Testing professionals. Solve problem and get your problem solved. Register Now!

0
How to convert JUnit tests to TestNG

Solved 1 Answers 127 Views Selenium
0 1
We are widely using JUnit for our selenium tests. Now we have plans to migrate to TestNG. Is there any effective way of doing the same?

1 Answer

0
Best answer
0

Using Eclipse:

You can easily convert JUnit 3 and JUnit 4 tests to TestNG.

Your first option is to use the Quick Fix function:

 

image 
Convert from JUnit 3

image 
Convert from JUnit 4

You can also convert packages or entire source folders with the conversion refactoring:

image

The refactoring wizard contains several pages:

image

This page lets you generate a testng.xml automatically. You can configure whether to include your test classes individually or by package, the suite and test name and also whether these tests should run in parallel.

image

This page gives you an overview of the changes that are about to be performed. You can also decide to exclude certain files from the refactoring.

When you are done, press the "Finish" button. Like all Eclipse refactorings, you can undo all these changes in one click:

image

 
answered by
selected by

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
...