我是 Selenium 的新手,使用已配置的 ReportNG 运行我的第一个 TestNG。我已经执行了以下所有必需的步骤。请帮助您的输入。谢谢!
- 将以下 JAR 添加到项目 guice 3.0 Velocity 1.4 报告 1.1.4
- 禁用 TestNG 的默认侦听器
向 xml 添加了 ReportNG 侦听器
XML 文件:
将 .xml 作为 TestNG 套件运行后,出现以下错误。类定义看起来不错...下面的快照...
package SeleniumProject;
<<Import statements go here>>
public class Test1DemoautBookTicket {
--------
}
Error:
java.lang.NoClassDefFoundError:
org/apache/commons/collections/ExtendedProperties
at org.apache.velocity.runtime.RuntimeInstance.<init>
(RuntimeInstance.java:160)
at org.apache.velocity.runtime.RuntimeSingleton.<clinit>
(RuntimeSingleton.java:95)
at org.apache.velocity.app.Velocity.setProperty(Velocity.java:117)
at org.uncommons.reportng.AbstractReporter.<init>(AbstractReporter.java:62)
at org.uncommons.reportng.HTMLReporter.<init>(HTMLReporter.java:83)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.testng.internal.ClassHelper.newInstance(ClassHelper.java:50)
at org.testng.TestNG.initializeConfiguration(TestNG.java:914)
at org.testng.TestNG.run(TestNG.java:1022)
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)
Caused by: java.lang.ClassNotFoundException:
org.apache.commons.collections.ExtendedProperties
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)
... 16 more
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="FirstSelenium">
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter"/>
<listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
</listeners>
<test name="Test1">
<classes>
<class name="SeleniumProject.Test1DemoautBookTicket"></class>
</classes>
</test>
</suite>