修改pom.xml
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.1.0</version>
</dependency>
注意要添加guice,否则会报错

修改testng.xml,添加listner
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter"/>
<listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
</listeners>
运行testng.xml
生成了一份html和一份xml的报告,就这么简单

留下个问题
由于使用数据驱动,使得结果打印的函数名都是入口函数testMain,这个看起来不直观。应该要打印出实际invoke的函数名才行。

解决方案见另一篇帖子:www.jianshu.com/p/4ecf169c5…