[testng-dev] get Exception com.beust.jcommander.ParameterException when creating instance of TestNG

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[testng-dev] get Exception com.beust.jcommander.ParameterException when creating instance of TestNG

nir heifetz

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>");

          final String testsuite = args[0];
          final String testcase = args[1];

        try {
            autotestClass = Class.forName(testsuite);

        } catch (final ClassNotFoundException e) {
            throw new RuntimeException("class" + testsuite + " is not found ", e);

        TestListenerAdapter tla = new TestListenerAdapter();
        TestNG testng = new TestNG();
        testng.setTestClasses(new Class[] {autotestClass });

        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;



**I added the following to my gradle.build:**

dependencies {

compile "com.beust.jcommander:1.30

Thanks in advance

You received this message because you are subscribed to the Google Groups "testng-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.