Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write testng report into html.jelly?

Tags:

hudson

testng

I use email-ext-plugin to generate report in hudson, and check the templete html.jelly in $HUDSON_ROOM\plugins\email-ext\WEB-INF\classes\hudson\plugins\emailext\templates\html.jelly, but i don't how to add the testng testing result into this jelly file.

the junit script in html.jelly, could someone know the script meaning for example, what's the meaning of it.JUnitTestResult? where the "it" object variable come from?

<j:set var="junitResultList" value="${it.JUnitTestResult}" />
<j:if test="${junitResultList.isEmpty()!=true}">
  <TABLE width="100%">
    <TR><TD class="bg1" colspan="2"><B>JUnit Tests</B></TD></TR>
    <j:forEach var="junitResult" items="${it.JUnitTestResult}">
      <j:forEach var="packageResult" items="${junitResult.getChildren()}">
        <TR><TD class="bg2" colspan="2"> Name: ${packageResult.getName()} Failed: ${packageResult.getFailCount()} test(s), Passed: ${packageResult.getPassCount()} test(s), Skipped: ${packageResult.getSkipCount()} test(s), Total: ${packageResult.getPassCount()+packageResult.getFailCount()+packageResult.getSkipCount()} test(s)</TD></TR>
        <j:forEach var="failed_test" items="${packageResult.getFailedTests()}">
          <TR bgcolor="white"><TD class="test_failed" colspan="2"><B><li>Failed: ${failed_test.getFullName()} </li></B></TD></TR>
        </j:forEach>
      </j:forEach> 
    </j:forEach>  
  </TABLE>  
<BR/>
</j:if>
like image 722
user1755647 Avatar asked Dec 04 '25 19:12

user1755647


1 Answers

it is a reference to the ScriptContentBuildWrapper class.

${it.JUnitTestResult} returns a List<TestResult> object.

like image 61
Josh Unger Avatar answered Dec 08 '25 15:12

Josh Unger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!