我在 Eclipse 中使用 Selenium WebDriver + TestNG 和 java。我想使用 ReportNG 生成更好的报告,而不是普通的 TestNG 报告。我已经使用reportng-1.1.2.jar和velocity-dep-1.4.jar配置了构建路径。我还从“项目”>“属性”>“TestNG”>“禁用默认监听器”禁用了默认 TestNG 报告 目前,我已经创建了一个 testNg.xml 文件,该文件将我的测试作为完整的测试套件运行。 xml文件内容如下:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count="5" skipfailedinvocationCounts="false" verbose="1" preserve-order="true" name="testingXML" junit="false" parallel="false" annotations="JDK">
<test verbose="2" name="com.src.com.pcrm.pageobjects.*" junit="false" annotations="JDK">
<testng classpathref="test-path"
outputdir="${test-results.dir}"
haltonfailure="true"
useDefaultListeners="false"
listeners="org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter">
<xmlfileset dir="." includes="testng.xml"/>
<sysproperty key="org.uncommons.reportng.title" value="My Test Report"/>
</testng>
<classes>
<class name="com.pcrm.pageobjects.HomeTest"/>
<methods>
<include name="testManadatoryFieldsOnHomePage"/>
<include name="testIsLogoDisplayed"/>
<include name="testUrlCheck"/>
</methods>
但是当我执行这个 xml 文件时,它没有生成任何 ReportNG 报告。有什么问题吗?感谢帮助。
最佳答案
我最好的猜测是这是一个类路径问题。确保 ReportNG 和 Velocity JAR 位于类路径上。看这个related question有关使用 ReportNG 和 Selenium 的类似问题。
关于eclipse - ReportNG 带有 TestNG 的报告不是使用 WebDriver 生成的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12948907/