i'm newbie in TestNG and trying to run TestNG suites from the command line when running the following code i get the exception
.AutoTestNGShellRunner.main(AutoTestNGShellRunner.java:43) Caused by: java.lang.ClassNotFoundException: com.beust.jcommander.ParameterException
import org.testng.ITestResult;
import org.testng.TestListenerAdapter;
import org.testng.TestNG;
import java.util.Arrays;
import java.util.List;
public class AutoTestNGShellRunner {
static Class<?> autotestClass;
public static void main(final String[] args) {
int rc;
if (args.length != 2) {
System.err.println("Usage: AutoTestNGShellRunner <TEST_SCENARIO_CLASS_NAME> <TEST_CASE>");
System.exit(-1);
}
final String testsuite = args[0];
final String testcase = args[1];
try {
autotestClass = Class.forName(testsuite);
} catch (final ClassNotFoundException e) {
e.printStackTrace();
throw new RuntimeException("class" + testsuite + " is not found ", e);
}
TestListenerAdapter tla = new TestListenerAdapter();
TestNG testng = new TestNG();
testng.setTestClasses(new Class[] {autotestClass });
testng.setTestNames(Arrays.asList(testcase));
testng.addListener(tla);
testng.run();
List<ITestResult> failedTestsResults = tla.getFailedTests();
final int failureCount = failedTestsResults.size();
if (failureCount == 0) {
Logging.getLogger().info(String.format("Test case %s passed\n", testcase));
rc = 0;
} else {
Logging.getLogger().error(String.format("Test case %s failed\n", testcase));
rc = -1;
}
System.exit(rc);
}
}
**I added the following to my gradle.build:**
dependencies {
compile "com.beust.jcommander:1.30
}
Thanks in advance