我无法运行testng.xml,得到错误java.lang.NoSuchMethodError

时间:2017-12-02 02:23:26

标签: java xml selenium jboss testng

This 是我的项目结构

当我尝试运行testng.xml时,我收到以下错误:

[RemoteTestNG] detected TestNG version 6.8.2
java.lang.NoSuchMethodError: org.testng.internal.IConfiguration.getConfigurationListeners()Ljava/util/List;
    at org.testng.remote.support.RemoteTestNG6_5$1.newTestRunner(RemoteTestNG6_5.java:34)
    at org.testng.remote.support.RemoteTestNG6_5$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG6_5.java:63)
    at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:547)
    at org.testng.SuiteRunner.init(SuiteRunner.java:142)
    at org.testng.SuiteRunner.<init>(SuiteRunner.java:106)
    at org.testng.TestNG.createSuiteRunner(TestNG.java:1059)
    at org.testng.TestNG.createSuiteRunners(TestNG.java:1045)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:881)
    at org.testng.TestNG.run(TestNG.java:824)
    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)
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:"C:\Program Files (x86)\HP\Unified Functional Testing\bin\java_shared\classes";"C:\Program Files (x86)\HP\Unified Functional Testing\\bin\java_shared\classes\jasmine.jar"

这是因为testng版本冲突而发生的吗?过去很多天我一直坚持这个。

2 个答案:

答案 0 :(得分:0)

在控制台上:detected TestNG version 6.8.2 在您的文件夹结构中,它是:6.12

您应该更新TestNG jar并重新配置buildpath中的最新jar。您可以从here下载最新内容。

答案 1 :(得分:0)

您必须匹配您在 Eclipse 中安装的 TestNG 版本和您的 TestNG 依赖项。

您无法在 Eclipse 中安装 TestNG 软件 6.14 的情况下运行 7.1.0 的 TestNG 依赖项。

您可以从 here

安装兼容的 TestNG 版本

按照 these 步骤在 Eclipse 中安装/升级 TestNG 版本:

相关问题