英文:
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"));
}
英文:
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”));
}
专注分享java语言的经验与见解,让所有开发者获益!
评论