1

我是 Selenium 的新手,使用已配置的 ReportNG 运行我的第一个 TestNG。我已经执行了以下所有必需的步骤。请帮助您的输入。谢谢!

  1. 将以下 JAR 添加到项目 guice 3.0 Velocity 1.4 报告 1.1.4
  2. 禁用 TestNG 的默认侦听器
  3. 向 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>
4

1 回答 1

0

我从jar-download.com下载了 ReportNG jar 。在这些文件中还有一个名为velocity-dep-1.4.jar的文件。在将其添加到项目之前,我遇到了与您相同的错误。

(似乎没有必要禁用默认侦听器。)

于 2018-02-02T21:04:18.710 回答