Migrating from JUnit

You can easily convert your JUnit tests with org.testng.JUnitConverter,  which you can invoke as follows:

Here is a sample use that will convert all the JUnit tests in the src/ directory to TestNG:

java org.testng.JUnitConverter -overwrite -annotation -srcdir src
Notes:

JUnitConverter also has an ant task, which you can invoke as follows:

<project name="test" default="init">
  <target name="init">
    <taskdef resource="testngtasks" />
  </target>
     
  <target name="junitconvert" depends="init">
    <junit-converter sourcedir="C:\dev\projects\test\java" outputdir="C:\dev\projects\temp" annotations="false" />
  </target>
</project>