修改使用Selenium的ExtendReports的样式

huangapple 未分类评论45阅读模式
英文:

Change style of ExtendReports with selenium

问题

在Selenium中,我们是否有改变扩展报告样式的可行性。例如,通过以绿色突出显示,是否有办法将通过的测试用例颜色更改为其他颜色。

英文:

Do we have feasibility to change styling of Extend Report in selenium. As example, pass is highlighted in green , is there any way to change the colour of pass test cases to some other colour.

答案1

得分: 0

你可以在 extent-config.xml 文件中进行更改,并在运行 @BeforeSuite 下的脚本时加载它。

通过使用这个外部的 XML 文件(extent-config.xml),我们可以更改报告主题(标准或深色)、报告标题、文档标题等细节。我们使用 extent 对象并使用 loadConfig() 方法来加载这个 XML 文件。

@BeforeSuite
public void beforeSuite() {
    extentReport = new ExtentReports(System.getProperty("user.dir") + "/test-output/ExtentReport.html", true);
    extentReport.addSystemInfo("Host Name", "XYZ").addSystemInfo("Environment", "Dev").addSystemInfo("User Name", "ABC");
    extentReport.loadConfig(new File(System.getProperty("user.dir") + "\\extent-config.xml"));
}

参考链接:链接 链接2

英文:

You can do the changes in the extent-config.xml and load it at the time of running the scripts under @BeforeSuite

By using this external XML file (extent-config.xml), we could change the details such as Report Theme (either standard or dark), Report Title, Document Title etc., We use extent object and use loadConfig() method to load this XML file.

@BeforeSuite
public void beforeSuite() {
extentReport = new ExtentReports(System.getProperty(“user.dir”) + “/test-output/ExtentReport.html”,true);
extentReport.addSystemInfo(“Host Name”, “XYZ”).addSystemInfo(“Environment”, “Dev”).addSystemInfo(“User Name”, “ABC”);
extentReport.loadConfig(new File(System.getProperty(“user.dir”) + “\\extent-config.xml”));
}

Reference LINK LINK2

huangapple
  • 本文由 发表于 2020年5月4日 12:07:49
  • 转载请务必保留本文链接:https://java.coder-hub.com/61585029.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定