Failed to invoke configuration method pakagename.AppiumTest.setUp:null

790 views
Skip to first unread message

Gualberto Sumano

unread,
Dec 3, 2014, 9:28:06 PM12/3/14
to testng...@googlegroups.com

Hello, can someone guide me on what could be wrong I build testng through ant but the setup method is not invoke could it be because is locate in super class, but when I run it testng through testng.xml it works fine.

Help.

test:
   [testng] ...
   [testng] ... TestNG 6.8.2beta_20130330_0839 by Cédric Beust (ced...@beust.com)
   [testng] ...
   [testng] [TestRunner] Running the tests in 'RegressionTest' with parallel mode:false
   [testng] [RunInfo] Adding method selector: org.testng.internal.XmlMethodSelector@3ce5cd19 priority: 10
   [testng] [TestClass] Creating TestClass for [ClassImpl class=packagename.util.AppiumTest]
   [testng] [XmlMethodSelector] Including method packagename.util.setUp()
   [testng] [XmlMethodSelector] Including method packagename.util.tearDown()
   [testng] [TestNG] Running:
   [testng]   C:\AndroidAppiumWorkSpace\EclipseWork\AndroidTestSuite\testng.xml
   [testng] [SuiteRunner] Created 1 TestRunners
   [testng] [TestRunner] Running test RegressionTest on 1  classes,  included groups:[] excluded groups:[]
   [testng] ===== Test class
   [testng] packagename.AppiumTest
   [testng] ======
   [testng] [Invoker 257422151] Invoking @BeforeTest AppiumTest.setUp()[pri:0, instance packagename.util.AppiumTest@53330681]
   [testng] Failed to invoke configuration method packagename.util.AppiumTest.setUp:null
   [testng] ===== Invoked methods
   [testng] =====
   [testng] ===============================================
   [testng] Android testsuite
   [testng] Total tests run: 0, Failures: 0, Skips: 0
   [testng] Configuration Failures: 1, Skips: 1
   [testng] ===============================================
   [testng] [TestNG] Time taken by org.uncommons.reportng.JUnitXMLReporter@6a162595: 40 ms
   [testng] Exception in thread "main" java.lang.NoClassDefFoundError: com/google/inject/Injector
   [testng] at java.lang.Class.getDeclaredMethods0(Native Method)
   [testng] at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
   [testng] at java.lang.Class.privateGetPublicMethods(Unknown Source)
   [testng] at java.lang.Class.getMethods(Unknown Source)

Gualberto Sumano

unread,
Dec 4, 2014, 7:19:39 PM12/4/14
to testng...@googlegroups.com

I made a very simple test file to narrow down the problem but the test keeps failing I just don't understand why.   Anyone?

============test class ==========================
public class testngexample {

@Test
public static void f() {
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");

}
@BeforeClass
public void beforeClass() {
System.out.println("setup");
}

@AfterClass
public void afterClass() {
System.out.println("teardown");
}
}
============= error report when run with testng ant ==============================
java.lang.ExceptionInInitializerError
org.openqa.selenium.remote.internal.HttpClientFactory.getClientConnectionManager(HttpClientFactory.java:65)
org.openqa.selenium.remote.internal.HttpClientFactory.<init>(HttpClientFactory.java:55)
org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:98)
org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:81)
org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:93)
org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
packagename.testngexample.f(Unknown Source)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
org.testng.TestRunner.privateRun(TestRunner.java:767)
org.testng.TestRunner.run(TestRunner.java:617)
org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
org.testng.SuiteRunner.run(SuiteRunner.java:240)
org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
org.testng.TestNG.run(TestNG.java:1057)
org.testng.TestNG.privateMain(TestNG.java:1364)
org.testng.TestNG.main(TestNG.java:1333)
Caused by: java.lang.RuntimeException: Stub!
org.apache.http.conn.ssl.AbstractVerifier.<init>(AbstractVerifier.java:5)
org.apache.http.conn.ssl.AllowAllHostnameVerifier.<init>(AllowAllHostnameVerifier.java:5)
org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:124)
org.openqa.selenium.remote.internal.HttpClientFactory.getClientConnectionManager(HttpClientFactory.java:65)
org.openqa.selenium.remote.internal.HttpClientFactory.<init>(HttpClientFactory.java:55)
org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:98)
org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:81)
org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:93)
org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
packagename.testngexample.f(Unknown Source)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
org.testng.TestRunner.privateRun(TestRunner.java:767)
org.testng.TestRunner.run(TestRunner.java:617)
org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
org.testng.SuiteRunner.run(SuiteRunner.java:240)
org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
org.testng.TestNG.run(TestNG.java:1057)
org.testng.TestNG.privateMain(TestNG.java:1364)
org.testng.TestNG.main(TestNG.java:1333)


Hubert Grzeskowiak

unread,
Dec 5, 2014, 10:34:45 AM12/5/14
to testng...@googlegroups.com
Hi Gualberto,

are you sure the problem lies in TestNG and not in FirefoxDriver?
Please try out this:

public class MyTest {
   
public static void main(String[] args) {

       
WebDriver driver = new FirefoxDriver();

        driver
.get("http://www.nytimes.com")
   
}
}

If that runs fine then we can say it's not WebDriver for sure.

Cheers
Hubert Grzeskowiak

Gualberto Sumano

unread,
Dec 5, 2014, 2:14:35 PM12/5/14
to testng...@googlegroups.com
After 3 days of trying to fix the problem I finally fix it.  The problem only happen when I run a testng.xml file by ANT .   When I run it by Eclipse everything works.  I don't understand why but the order of how the ".jars" dependency are setup in the class path matters.  In Eclipse it worked because I remember setting in the build path to have  testng...jar to the top followed by selenium...jar and all other..jars that are needed.   So when I made the ant build.xml file the classpath include all my jars many which are not need and the order matter (don't understand why but it matter).   So to fix I created a fileset of only jars needed and in the order I wanted it.   

After that, everything worked.  

Hope it helps someone.    (I was using appium to test android using testng framework building running in ant)   

Hubert Grzeskowiak

unread,
Dec 9, 2014, 5:41:28 AM12/9/14
to testng...@googlegroups.com
Looks like you have some double libraries.


Am Donnerstag, 4. Dezember 2014 03:28:06 UTC+1 schrieb Gualberto Sumano:
Reply all
Reply to author
Forward
0 new messages