有没有人尝试使用TestNG框架的Silk4j?

时间:2014-12-03 13:01:56

标签: eclipse silktest

我正在尝试在我的Silk4j项目中使用TestNG框架但是无法使用TestNG从eclipse运行我的测试,但是可以使用JUnit运行。

我尝试过一个解决方案:

  1. 我已将所有testNG注释用于测试方法
  2. 在Project>中添加了TestNG库。属性> Java构建路径
  3. 如果我尝试使用上面的测试运行我的测试,我得到了这个

    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
    

    不确定我在这里缺少什么,这里的任何帮助都会非常有帮助

1 个答案:

答案 0 :(得分:0)

Silk4j有很多需要在类路径中的依赖项。 在您的情况下,您需要将Google Guice添加到类路径