I am trying to use TestNG framework in my Silk4j project but unable to run my tests so far from eclipse with TestNG but could run using JUnit.
I did try one solution:
- I have used all testNG annotations for test methods
- Added TestNG libraries in Project > Properties > Java Build Path
If I try to run my tests as TestNG with the above, I get this
java.lang.NoClassDefFoundError: com/google/inject/Module
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethods(Unknown Source)
at com.borland.silktest.jtf.internal.ReflectionBasedScriptContextFactory.findScriptElementWithAnnotation(ReflectionBasedScriptContextFactory.java:33)
at com.borland.silktest.jtf.internal.AbstractScriptContextFactory.createScriptContextFromStackTrace(AbstractScriptContextFactory.java:42)
at com.borland.silktest.jtf.internal.Agent.getScriptContext(Agent.java:398)
at com.borland.silktest.jtf.internal.Agent.find(Agent.java:847)
at com.borland.silktest.jtf.internal.Agent.find(Agent.java:836)
at com.borland.silktest.jtf.AbstractTestObject.find(AbstractTestObject.java:710)
at com.vmware.fvt.pages.CertificateWarning.getContinue(CertificateWarning.java:15)
at com.vmware.fvt.tests.CertificateSecurityWarning.verifyCeritificateWarning(CertificateSecurityWarning.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: java.lang.ClassNotFoundException: com.google.inject.Module
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 35 more
Not really sure what I am missing here, any help here will be really helpful
Silk4j has a lot of dependencies that need to be in the classpath. In your case you need to add Google Guice to the classpath