2017-03-15 24 views
1

Antバージョン1.9.7とJUnit 4.12を使用しています。私のbuild.xmlのは、次のようになります。Ant JUnitでテストの詳細が表示されない

[junit] Running at.abc.def.ghi.ABCTest 
[junit] Tests run: 5, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.065 sec 
Test at.abc.def.ghi.ABCTest FAILED 

しかし、これ以上の詳細:

<target name="run-junit" depends="init, compile, compile-junit"> 
    <junit printsummary="yes" > 
     <formatter type="xml"/> 
     <classpath><pathelement location="lib/junit-4.12.jar"/></classpath> 
     <batchtest fork="yes" todir="${out.dir}"> 
      <fileset dir="${bin.dir}"> 
       <include name="**/*Test.class"/> 
      </fileset> 
     </batchtest> 
    </junit> 
</target> 

コンソールでant run-junitを実行している、それはちょうど私に与えていません。どうすれば解決できますか? 、それぞれの詳細については、テストに失敗し得る代わりに<formatter type="xml"/><formatter type="plain" usefile="false"/>を使用するには

答えて

1

<junit printsummary="yes"> 
    <formatter type="plain" usefile="false"/> 
    <classpath><pathelement location="lib/junit-4.12.jar"/></classpath> 
    <batchtest fork="yes" todir="${out.dir}"> 
     <fileset dir="${bin.dir}"> 
      <include name="**/*Test.class"/> 
     </fileset> 
    </batchtest> 
</junit> 

「プレーン」フォーマッタを使用するには、次のような出力が得られます。

[junit] Running TestMyTest1 
[junit] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.014 sec 
[junit] 
[junit] Testcase: testMyTest took 0.003 sec 
[junit]  FAILED 
[junit] expected:<firefox> but was:<null> 
[junit] junit.framework.AssertionFailedError: expected:<firefox> but was:<null> 
[junit]  at TestMyTest1.testMyTest(TestMyTest1.java:17) 
[junit] 
[junit] Test TestMyTest1 FAILED 
+0

おかげで、私がしようとしますこの!両方を持つことは可能ですか? –

+0

@今春春天はい、 ''は複数の ''要素を受け入れます。 –

+0

ありがとうございます。私は永遠のようにこれを探しました... –

関連する問題