别人写的 testNG 的一个插件,只要配置一下监听,就可以实时查看测试运行的汇总情况和详细情况,感觉跟平台类的 dashboard 配合在一起(链接潜入)很好玩
作者发布地址:https://github.com/startingwithseleniumwebdriver/RealTimeReport
以 maven test 为例,reportng 和这个 realtime-report 代码我自己动了点,主要是为了报告输出路径好控制,所以,请不要纠结我的 package 路径
package com.fudax.report.realtime.filehandler;
public class FileNameConstants {
/*
* Folder name constants
*/
public static final String ROOT_FOLDER = System.getProperty("realtimeReportDir");
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<suiteXmlFiles>
<file>task/testng.xml</file>
</suiteXmlFiles>
<properties>
<property>
<name>usedefaultlisteners</name>
<value>false</value>
</property>
<property>
<name>listener</name>
<value>com.fudax.report.HTMLReporter,
org.testng.reporters.FailedReporter,com.fudax.report.realtime.listener.RealTimeTestResultListener</value>
</property>
</properties>
<reportsDirectory>${basedir}/report</reportsDirectory>
<systemProperties>
<property>
<name>realtimeReportDir</name>
<value>${basedir}/report/realtime</value>
</property>
</systemProperties>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>2.20.1</version>
</dependency>
</dependencies>
</plugin>
[...]
</plugins>