Can't able to run TestNG its show an error below I mentioned



  • [RemoteTestNG] detected TestNG version 6.14.2
    org.testng.TestNGException: 
    Cannot instantiate class testing.test
        at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:30)
        at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:423)
        at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:336)
        at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:125)
        at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:190)
        at org.testng.TestClass.getInstances(TestClass.java:95)
        at org.testng.TestClass.initTestClassesAndInstances(TestClass.java:81)
        at org.testng.TestClass.init(TestClass.java:73)
        at org.testng.TestClass.<init>(TestClass.java:38)
        at org.testng.TestRunner.initMethods(TestRunner.java:389)
        at org.testng.TestRunner.init(TestRunner.java:271)
        at org.testng.TestRunner.init(TestRunner.java:241)
        at org.testng.TestRunner.<init>(TestRunner.java:192)
        at org.testng.remote.support.RemoteTestNG6_12$1.newTestRunner(RemoteTestNG6_12.java:33)
        at org.testng.remote.support.RemoteTestNG6_12$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG6_12.java:66)
        at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:713)
        at org.testng.SuiteRunner.init(SuiteRunner.java:260)
        at org.testng.SuiteRunner.<init>(SuiteRunner.java:198)
        at org.testng.TestNG.createSuiteRunner(TestNG.java:1295)
        at org.testng.TestNG.createSuiteRunners(TestNG.java:1273)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:1128)
        at org.testng.TestNG.runSuites(TestNG.java:1049)
        at org.testng.TestNG.run(TestNG.java:1017)
        at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
        at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
        at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
    Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:24)
        ... 25 more
    Caused by: java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases
        at com.google.common.base.Preconditions.checkState(Preconditions.java:847)
        at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:125)
        at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:43)
        at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:168)
        at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:346)
        at org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:168)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:103)
        at testing.test.<init>(test.java:8)
        ... 30 more
    


  • If you read the stacktrace you have provided you will see that

    The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver.

    So set up path to your webdriver in the code that is executed in your testng configuration to fix the issue.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2