zoukankan      html  css  js  c++  java
  • 在junit格式的结果信息中只包含错误信息的修改方法

    文件名称:suiteJunit.vm

    文件路径:srcfitnesse esources emplates

     添加如下黑体部分内容:

    <?xml version="1.0"?>
    #set( $String = "" )
    #macro( format $s )$String.format("%.3f", $s)#end
    #set($suiteTotalRunTimeSeconds = $suiteExecutionReport.totalRunTimeInMillis / 1000.0 )
    <testsuite name="#escape($suiteExecutionReport.rootPath)" tests="$suiteExecutionReport.pageHistoryReferences.size()" failures="$suiteExecutionReport.finalCounts.wrong" disabled="$suiteExecutionReport.finalCounts.ignores" errors="$suiteExecutionReport.finalCounts.exceptions" time="#format($suiteTotalRunTimeSeconds)">
      #foreach ($reference in $suiteExecutionReport.pageHistoryReferences)
        #set($classname = $formatter.getClassName($reference))
        #set($runTimeSeconds = $reference.RunTimeInMillis / 1000.0 )
        #if($reference.testSummary.exceptions > 0 || $reference.testSummary.wrong > 0 )
        <testcase name="#escape($reference.pageName)" assertions="$reference.testSummary.right" time="#format($runTimeSeconds)">
            #if($reference.testSummary.exceptions > 0)
              <error message="$reference.testSummary.exceptions exceptions"/>
            #end
            #if($reference.testSummary.wrong > 0)
          <failure message="$reference.testSummary.wrong errors"/>    
          #end 
          <system-out>$reference.pageName?pageHistory&amp;resultDate=$reference.resultDate</system-out>
        </testcase> 
       #end       
      #end
    </testsuite>

     测试:

    http://localhost:8001/FitNesse.SuiteAcceptanceTests.SuiteWikiPageResponderTests?responder=suite&format=junit

    全部成功情况:

    <?xml version="1.0"?>
    <testsuite name="FitNesse.SuiteAcceptanceTests.SuiteWikiPageResponderTests" tests="6" failures="0" disabled="0" errors="0" time="4.539">
                                          </testsuite>

    部分失败情况:

    <?xml version="1.0"?>
    <testsuite name="FitNesse.SuiteAcceptanceTests.SuiteWikiPageResponderTests" tests="6" failures="1" disabled="0" errors="0" time="5.039">
              <testcase name="FitNesse.SuiteAcceptanceTests.SuiteWikiPageResponderTests.TestBreadCrumbs" assertions="13" time="0.918">
                          <failure message="1 errors"/>    
                <system-out>FitNesse.SuiteAcceptanceTests.SuiteWikiPageResponderTests.TestBreadCrumbs?pageHistory&amp;resultDate=20160929211032</system-out>
        </testcase> 
                                       </testsuite>
  • 相关阅读:
    POJ 2778 DNA Sequence(AC自动机+矩阵)
    Challenge & Growth —— 从这里开始
    京东云
    [Done] Codeforces Round #562 (Div. 2) 题解
    HDU 3486 Interviewe
    Codeforces Round #529 (Div. 3) 题解
    Wannafly 挑战赛 19 参考题解
    第十六届上海大学程序设计联赛春季赛暨上海高校金马五校赛 题解
    2018年长沙理工大学第十三届程序设计竞赛 题解
    POJ 3017 Cut the Sequence
  • 原文地址:https://www.cnblogs.com/moonpool/p/5921956.html
Copyright © 2011-2022 走看看