Hi all,

I am new to groovy and the syntax is very confusing and error prone and 
written a template to work with Email-Extn plugin. I want to add the test 
result in the tabular format as below. Can anyone help me in this regard?

Regards
Pradeep

For exp if 1 test executed then i want a table in the email-body as 
follows: 

TestName | Test Status | Pass | Fail | Total
     
abc          |  Pass          |  1     |  0 |  1

<table cellspacing="0" cellpadding="2" border="1">
<thead>
 <tr bgcolor="#F3F3F3">
  <td class="header">Test Name</td>
  <td class="header">Test Status</td>
  <td class="header">Pass</td>
  <td class="header">Fail</td>
  <td class="header">Total</td>
 </tr>
</thead>
</table>

<% 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) { %>
 <TABLE width="100%">
 <TR><TD class="bg1" 
colspan="2"><B>${junitResultList.first().displayName}</B></TD></TR>
 <% junitResultList.each{
  junitResult -> %>
     <% junitResult.getChildren().each { packageResult -> %>
        <TR><TD class="bg2" colspan="2"> ${packageResult.getName()} 
${packageResult.getFailCount()},${packageResult.getPassCount()},${packageResult.getSkipCount()},${packageResult.getPassCount()+packageResult.getFailCount()+packageResult.getSkipCount()}</TD></TR>
        <% packageResult.getFailedTests().each{ failed_test -> %>
          <TR bgcolor="white"><TD class="test_failed" 
colspan="2"><B><li>Failed: ${failed_test.getFullName()} </li></B></TD></TR>
        <% }
      }
 } %>
 </TABLE>
 <BR/>
<%
} %>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/cc06fcf9-7be4-40ad-8437-a5da816206b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to