我正在尝试在我的 Silk4j 项目中使用 TestNG 框架,但到目前为止无法使用 TestNG 运行我的测试,但可以使用 JUnit 运行。
我确实尝试了一种解决方案:
- 我已将所有 testNG 注释用于测试方法
- 在 Project > Properties > Java Build Path 中添加了 TestNG 库
如果我尝试使用上面的方法以 TestNG 身份运行我的测试,我会得到这个
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
不太确定我在这里缺少什么,这里的任何帮助都会很有帮助