[英]how to generate emailable format execution report using testng-results.xml
I just want to create an emailable template execution report by using the testng-results.xml files through JAVA or testng listeners. 我只想通过JAVA或testng侦听器使用testng-results.xml文件来创建可通过电子邮件发送的模板执行报告。 I have existing testng-results.xml file which I need to make it as emailable reports.
我有现有的testng-results.xml文件,需要将其作为可通过电子邮件发送的报告。 Is there any way to do that.
有没有办法做到这一点。 I just need some input and ideas to kick start this activity.
我只需要一些投入和想法就可以开始这项活动。
Any leads. 任何线索。
Use XSLT template , the most efficient and easy way to generate to any report format from xml. 使用XSLT模板 ,这是从xml生成任何报告格式的最有效,最简单的方法。
In my project, we are generating different category of html reports from testng-results.xml for fast regression analysis. 在我的项目中,我们从testng-results.xml生成不同类别的html报告,以进行快速回归分析。 Also we had generated json report using xslt from testng-results.xml to see aggregate result.
我们还使用了来自testng-results.xml的xslt生成了json报告,以查看聚合结果。
We use gradle build tool to run xslt and generate report after completion of test like, 我们使用gradle构建工具运行xslt并在测试完成后生成报告,例如,
configurations{ xslt }
dependencies {
xslt 'net.sf.saxon:saxon:8.7'
}
task generateReport << {
File reportDir=new File("${projectDir}/HTML_Reports")
if(reportDir.exists()){
reportDir.deleteDir()
}
reportDir.mkdir()
ant.xslt(in: "${testReportDir.absolutePath}/test/testng-results.xml",
style: "${projectDir.absolutePath}/src/test/resources/xslt_config/emailablereport.xsl",
out: "${reportDir.absolutePath}/index.html",
classpath: configurations.xslt.asPath) {
param(name: 'paramXSLT.environment', expression: "${env}")
}
You can also run xsl in maven using this plugin 您也可以使用此插件在Maven中运行xsl
For run xsl in java program refer this post 对于在Java程序中运行xsl,请参阅这篇文章
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.