You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by pradeep <bu...@gmail.com> on 2016/11/22 08:46:25 UTC

groovy email template script help.

Hi,

I have written a groovy template script to be integrated to the E-mail Extn
plugin in Jenkins for sending customised reports.

The idea is to to parse the jUNIT Test reports from Jenkins and add the test
results in a tabular format. The problem is the "Test Pass Count", "Test
Fail Count", "Test status" is not reflected in a table result. I tried to
add some of the JUNIT parse code and tried to add to the table but it gives
lot of syntax errors. Can anyone please help me in this regard?

In short  I need to have table with Test Name, Test Status,Pass, Fail, Total
values populated in the table.

Regards
Bubunia





 

  	Test Name 
  	Test Status
  	Pass
  	Fail
  	Total
 





<% def junitResultList = it.JUnitTestResult
try {
 def cucumberTestResultAction =
it.getAction("org.jenkinsci.plugins.cucumber.jsontestsupport.CucumberTestResultAction")
 junitResultList.add(cucumberTestResultAction.getResult())
} catch(e) {
        //cucumberTestResultAction not exist in this build
}
if (junitResultList.size() > 0) { %>
 

 
${junitResultList.first().displayName}
 <% junitResultList.each{
  junitResult -> %>
     <% junitResult.getChildren().each { packageResult -> %>
        
 ${packageResult.getName()}
${packageResult.getFailCount()},${packageResult.getPassCount()},${packageResult.getSkipCount()},${packageResult.getPassCount()+packageResult.getFailCount()+packageResult.getSkipCount()}
        <% packageResult.getFailedTests().each{ failed_test -> %>
          
<li>Failed: ${failed_test.getFullName()} </li>
        <% }
      }
 } %>
 

 <BR/>
<%
} %>





--
View this message in context: http://groovy.329449.n5.nabble.com/groovy-email-template-script-help-tp5736878.html
Sent from the Groovy Users mailing list archive at Nabble.com.