我正在將我的構建從Ant移動到Gradle。 Ant允許JUnit任務創建具有不同格式的多個報告。 Gradle更具限制性 - 它生成一個HTML報告和一個XML報告。 XML報告是JUnit文本報告的超集,因此它可以從一個轉換到另一個。 XSLT會將XML轉換爲文本?下面是一個例子XML:XSLT將JUnit Xml格式轉換爲JUnit Plain格式
<?xml version="1.0" encoding="UTF-8"?>
<testsuite errors="0" failures="0" hostname="spina.stsci.edu" name="edu.stsci.CoSI.test.DependencySupressingConstraintJUnitTest" tests="6" time="0.14" timestamp="2012-02-27T18:08:03">
<properties />
<testcase classname="edu.stsci.CoSI.test.DependencySupressingConstraintJUnitTest" name="testSupressionWorks" time="0.01" />
<testcase classname="edu.stsci.CoSI.test.DependencySupressingConstraintJUnitTest" name="testSupressionWorksWithDependenciesDisabled" time="0.0020" />
<testcase classname="edu.stsci.CoSI.test.DependencySupressingConstraintJUnitTest" name="testPropagationIsDeferred" time="0.0010" />
<testcase classname="edu.stsci.CoSI.test.DependencySupressingConstraintJUnitTest" name="testPropagationIsDeferredWhenDependenciesAreSuppressed" time="0.0010" />
<testcase classname="edu.stsci.CoSI.test.DependencySupressingConstraintJUnitTest" name="testPropagationIsDeferredWhenDependenciesAreSuppressed2" time="0.0010" />
<testcase classname="edu.stsci.CoSI.test.DependencySupressingConstraintJUnitTest" name="testGarbageCollection" time="0.066" />
<system-out><![CDATA[Running Supressing Constraint
Running Supressing Constraint
Running Supressing Constraint
Change Me is: 2
Running Supressing Constraint
Change Me is: 5
]]></system-out>
<system-err><![CDATA[]]></system-err>
</testsuite>
這裏是我想它產生於文:
Testsuite: edu.stsci.CoSI.test.DependencySupressingConstraintJUnitTest
Tests run: 6, Failures: 0, Errors: 0, Time elapsed: 0.363 sec
------------- Standard Output ---------------
Running Supressing Constraint
Running Supressing Constraint
Running Supressing Constraint
Change Me is: 2
Running Supressing Constraint
Change Me is: 5
------------- ---------------- ---------------
Testcase: testSupressionWorks took 0.001 sec
Testcase: testSupressionWorksWithDependenciesDisabled took 0.001 sec
Testcase: testPropagationIsDeferred took 0 sec
Testcase: testPropagationIsDeferredWhenDependenciesAreSuppressed took 0.001 sec
Testcase: testPropagationIsDeferredWhenDependenciesAreSuppressed2 took 0 sec
Testcase: testGarbageCollection took 0.038 sec
某些細節並不重要(如秒的格式)。
那麼,這是什麼問題?我沒看到一個。 – 2012-02-27 18:33:48
@DimitreNovatchev,謝謝你指出我的遺漏。我在這裏從這個問題上領先:http://stackoverflow.com/questions/3671613/junit-report-single-page-xslt-for-email。如果這真的是一個不恰當的問題,我很樂意收回它。我認爲這可能是一般用途,因爲它與從一個構建系統遷移到另一個構建系統有關。 – Spina 2012-02-27 19:30:34
脊柱,這不是不恰當的 - 看起來你希望有人爲你做整個工作* - 並不是說你已經嘗試過自己,寫了一個改造,並且遇到了問題。這裏的人們願意*幫助*做這項工作,而不是做整個工作。更重要的是你學到了一些東西。當人們爲你完成整個工作時,你學習/理解的機會是微乎其微的。 – 2012-02-27 20:41:27