我有几个字段是从HTML
页解析并添加到我的report
中的:
extentTest.log(Status.INFO, String.format(
"Add new record into database (%s)",
"{\n" +
" Name = name, \n".replace("name", name) +
" Description = description, \n".replace("description", description) +
" Language = language, \n".replace("language", language) +
" Time = time, \n".replace("time", time) +
"}"));
因此,不要在我的HTML报告中以这种格式查看此内容:
Document{{
Name = 5967745223993a32646baab8,
Description = "bla bla,
Language = en,
Time = "2534
}}
是这样的(没有新行):
文档{{名称= 5967745223993a32646baab8,说明= MongoDB, 语言= zh, 时间=“ 2534}}
有什么建议吗?
答案 0 :(得分:4)
您需要对范围报告新行使用<br />
标记,而不是“ \ n”
extentTest.log(Status.INFO, String.format(
"Add new record into database (%s)","{<br />" +
" Name = name, <br />".replace("name", name) +
" Description = description, <br />".replace("description", description) +
" Language = language, <br />".replace("language", language) +
" Time = time, <br />".replace("time", time) +
"}"));