简体   繁体   English

如何使用testng-results.xml生成可通过电子邮件发送的格式执行报告

[英]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.

相关问题 自动化完成后,在硒中生成testng-results.xml - Generate testng-results.xml in selenium after automation completed 如何使用 xslt 将值从 XML 附加到 TestNG 可通过电子邮件发送的 HTML 报告 - How to append values from XML to TestNG emailable HTML report using xslt 如何将 testng-results.xml 文件保存到 test-output 文件夹以外的不同文件夹? - how to save the testng-results.xml file to different folder other than test-output folder? TestNG可通过电子邮件发送的报告中的原始HTML - Raw html in TestNG Emailable Report 如何通过编程方式将所有Testng可通过电子邮件发送的报告合并为单个报告 - How to merge all the testng emailable report into single report through programatically TestNG可通过电子邮件发送的报告0kb - TestNG Emailable Report 0kb 自定义报告程序在TestNG执行后以编程方式生成Junit xml报告 - Custom reporter to generate Junit xml report programmatically after TestNG execution Testng Test Suite xml-停止执行并生成报告 - Testng Test Suite xml - Stop execution and generate report TestNG-如何在testng自定义可通过电子邮件发送的报告中打印运行时的testng参数? - TestNG - How to print run time testng parameters in testng custom emailable report? 按时间顺序排列testng emailable-report.html? - testng emailable-report.html in chronological order?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM