本文介绍了TestNG 错误-java.lang.NoSuchMethodError: org.testng.TestRunner.addListener(Ljava/lang/Object;)V的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我安装的 testNG 版本是 (6.9.11).我的 pom .xml 有 (6.14.3).Eclipse 版本 neon 4.6.3
I have installed testNG version is (6.9.11).My pom .xml has (6.14.3).Eclipse version neon 4.6.3
当我通过 TestNG 运行课程时出现以下错误.有人可以帮我吗?
I am getting the below error when I run the class through TestNG.Can anyone please help me on this ?
java.lang.NoSuchMethodError: org.testng.TestRunner.addListener(Ljava/lang/Object;)V
at org.testng.remote.support.RemoteTestNG6_9_10$1.newTestRunner(RemoteTestNG6_9_10.java:32)
at org.testng.remote.support.RemoteTestNG6_9_10$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG6_9_10.java:61)
at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:713)
at org.testng.SuiteRunner.init(SuiteRunner.java:260)
at org.testng.SuiteRunner.<init>(SuiteRunner.java:198)
at org.testng.TestNG.createSuiteRunner(TestNG.java:1295)
at org.testng.TestNG.createSuiteRunners(TestNG.java:1273)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1128)
at org.testng.TestNG.runSuites(TestNG.java:1049)
at org.testng.TestNG.run(TestNG.java:1017)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:137)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:58)
推荐答案
试试这个.
将 TestNG 库添加到项目中.
Adding the TestNG Library into the project.
右键单击项目
Right Click on the Project
构建路径
配置构建路径
库(标签页)
转到添加库"并点击按钮.
Go to "Add Library" and click the button.
添加TestNG"库,然后单击确定"/下一步".
Add the 'TestNG' Library and click Ok/Next.
TestNG 库将添加到您的项目中.
TestNG Library will be added to your project.
重启项目
这篇关于TestNG 错误-java.lang.NoSuchMethodError: org.testng.TestRunner.addListener(Ljava/lang/Object;)V的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!