I just want to create an emailable template execution report by using the testng-results.xml files through JAVA or testng listeners. I have existing testng-results.xml file which I need to make it as emailable reports. 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.
In my project, we are generating different category of html reports from testng-results.xml for fast regression analysis. Also we had generated json report using xslt from testng-results.xml to see aggregate result.
We use gradle build tool to run xslt and generate report after completion of test like,
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
For run xsl in java program refer this post
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.