1.下载reportng源码
git clone
https://github.com/dwdyer/reportng.git
2.修改AbstractReporter.java
package org.uncommons.reportng;
...
import java.io.OutputStream;
...
protected void generateFile(File file,
String templateName,
VelocityContext context) throws Exception
{
//Writer writer = new BufferedWriter(new FileWriter(file));
//encoding to utf-8
OutputStream out = new FileOutputStream(file);
Writer writer = new BufferedWriter(new OutputStreamWriter(out,"utf-8"));
try
{
Velocity.mergeTemplate(classpathPrefix + templateName,
ENCODING,
context,
writer);
writer.flush();
}
finally
{
writer.close();
}
}
3.编译源码
cd reportng
ant
PS:ant环境配置
1.下载ant源码包
2.解压到安装位置
unzip to D:\apache-ant-1.9.6
3.修改环境变量
set ANT_HOME D:\apache-ant-1.9.6
set Path %ANT_HOME%\bin
4.验证ant
cmd:ant -version
本文介绍如何下载并修改ReportNG源码以支持UTF-8编码,实现生成中文测试报告的过程。主要内容包括:下载ReportNG源码、修改AbstractReporter.java文件以支持UTF-8编码、编译ReportNG源码及配置Ant环境。
552

被折叠的 条评论
为什么被折叠?



