1.3 reportNg之result.html.vm修改

1、reportNg之result.html.vm修改

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="$messages.locale.language" lang="$messages.locale.language">
<head>
##    $meta.getReportTile()==$meta.ReportTitle;$result.getTestContext().name==$result.TestContext.name
##    velocity模板中不会将reference解释为对象的实例变量。例如:$foo.Name将被解释为Foo对象的getName()方法,而不是Foo对象的Name实例变量
  <title>$meta.getReportTitle() - $result.getTestContext().name</title>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  <meta name="description" content="TestNG unit test results." />
  <link href="reportng.css" rel="stylesheet" type="text/css" />
##    $meta.stylesheetPath==$meta.getStylesheetPath()
##  #if ($meta.stylesheetPath)
##  <link href="custom.css" rel="stylesheet" type="text/css" />
##  #end
  <script type="text/javascript" src="reportng.js"></script>
</head>
<body>
##引擎会先检查getTestContext().getname(),接着会检查getTestContext.getName()方法,所以TestContext.name、testContext.name、TestContext.Name、testcontext.Name得到的结果是一致的
<h1>$result.TestContext.Name</h1>

<p>
    ##testDuration表示测试持续总时间
##  $messages.getString("testDuration"): $utils.formatDuration($utils.getDuration($result.testContext))s
    $messages.getString("testDuration");$utils.formatDuration($utils.getDuration($result.TestContext))s

</p>
#set ($id = 0)
#if ($failedConfigurations.size() > 0)
  <table class="resultsTable configTable">
    <tr>
        <th colspan="1" class="header failedConfig th1">$messages.getString("failedConfiguration")</th>
        <th colspan="1" class="header failedConfig th2">$messages.getString("duration")</th>
        <th colspan="1" class="header failedConfig th3">$messages.getString("exception")</th>
        <th colspan="1" class="header failedConfig th5">$messages.getString("shot")</th>
        <th colspan="1" class="header failedConfig th6">$messages.getString("discription")</th>
        <th colspan="1" class="header failedConfig th4">$messages.getString("endTime")</th>
    </tr>
      #set ($id = 0)
    #foreach ($testClass in $failedConfigurations.keySet())
      <tr class="group">
        <td colspan="6">$testClass.name</td>
      </tr>
      #set ($classResults = $failedConfigurations.get($testClass))
      #parse("org/uncommons/reportng/templates/html/class-results.html.vm")
    #end

    #if ($skippedConfigurations.size() > 0)
      <tr><td colspan="6">&nbsp;</td></tr>
      <tr>
          <td colspan="1" class="header skippedConfig th1">$messages.getString("skippedConfiguration")</td>
          <th colspan="1" class="header skippedConfig th2">$messages.getString("duration")</th>
          <th colspan="1" class="header skippedConfig th3">$messages.getString("exception")</th>
          <th colspan="1" class="header skippedConfig th5">$messages.getString("shot")</th>
          <th colspan="1" class="header skippedConfig th6">$messages.getString("discription")</th>
          <th colspan="1" class="header skippedConfig th4">$messages.getString("endTime")</th>
      </tr>
      #set ($id = 0)
      #foreach ($testClass in $skippedConfigurations.keySet())
        <tr>
          <td colspan="6" class="group">$testClass.name</td>
        </tr>
        #set ($classResults = $skippedConfigurations.get($testClass))
        #parse ("org/uncommons/reportng/templates/html/class-results.html.vm")
      #end
    #end
  </table>
#end

#if ($failedTests.size() > 0)
  <table class="resultsTable">
    <tr>
        <th colspan="1" class="header failed th1">$messages.getString("failedTests")</th>
        <th colspan="1" class="header failed th2">$messages.getString("duration")</th>
        <th colspan="1" class="header failed th3">$messages.getString("exception")</th>
        <th colspan="1" class="header failed th5">$messages.getString("shot")</th>
        <th colspan="1" class="header failed th6">$messages.getString("discription")</th>
        <th colspan="1" class="header failed th4">$messages.getString("endTime")</th>
    </tr>
    #foreach ($testClass in $failedTests.keySet())
      <tr>
        <td colspan="6" class="group">$testClass.name</td>
      </tr>
      #set ($classResults = $failedTests.get($testClass))
      #parse ("org/uncommons/reportng/templates/html/class-results.html.vm")
    #end
  </table>
#end

#if ($skippedTests.size() > 0)
  <table class="resultsTable" width="100%">
    <tr>
        <th colspan="1" class="header skipped th1">$messages.getString("skippedTests")</th>
        <th colspan="1" class="header skipped th2">$messages.getString("duration")</th>
        <th colspan="1" class="header skipped th3">$messages.getString("exception")</th>
        <th colspan="1" class="header skipped th5">$messages.getString("shot")</th>
        <th colspan="1" class="header skipped th6">$messages.getString("discription")</th>
        <th colspan="1" class="header skipped th4">$messages.getString("endTime")</th>
    </tr>
    #foreach ($testClass in $skippedTests.keySet())
      <tr>
        <td colspan="6" class="group">$testClass.name</td>
      </tr>
      #set ($classResults = $skippedTests.get($testClass))
      #parse ("org/uncommons/reportng/templates/html/class-results.html.vm")
    #end
  </table>
#end

#if ($passedTests.size() > 0)
  <table class="resultsTable">
    <tr>
        <th colspan="1" class="header passed th1">$messages.getString("passedTests")</th>
        <th colspan="1" class="header passed th2">$messages.getString("duration")</th>
        <th colspan="1" class="header passed th3">$messages.getString("exception")</th>
        <th colspan="1" class="header passed th5">$messages.getString("shot")</th>
        <th colspan="1" class="header passed th6">$messages.getString("discription")</th>
        <th colspan="1" class="header passed th4">$messages.getString("endTime")</th>
    </tr>
    #foreach ($testClass in $passedTests.keySet())
      <tr>
        <td colspan="6" class="group">$testClass.name</td>
      </tr>
      #set ($classResults = $passedTests.get($testClass))
      #parse ("org/uncommons/reportng/templates/html/class-results.html.vm")
    #end
  </table>
#end
  
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值