Here is the code: import com.beust.testng.TestNG; public class RunTestNG { public static void main(String[] args) { TestNG testng = new TestNG(); Class[] classes = new Class[]{Sample.class};//Sample is a ur TestNG class testng.setTestClasses(classes); testng.run(); }