Ho creato un progetto Ant che include un test unitario con JUnit.JUnit & Ant: come visualizzare un messaggio di errore dettagliato sullo schermo?
L'obiettivo del test è come:
<target name="test">
<mkdir dir="target/test/reports"/>
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<pathelement location="${test.classes.dir}"/>
<pathelement location="${test.junit.jar}" />
<pathelement path="${classes.dir}"/>
<pathelement path="${java.class.path}"/>
</classpath>
<formatter type="plain"/>
<batchtest fork="yes" todir="${test.reports.dir}">
<fileset dir="${test.src.dir}">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
</junit>
</target>
Quando ho eseguito questo test, si mostrano sullo schermo solo la sintesi del test come:
Buildfile: F:\test\build.xml
test:
[junit] Running com.mycompany.myproject.myTest
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.013 sec
[junit] Running com.mycompany.myproject.myTest1
[junit] Tests run: 3, Failures: 1, Errors: 0, Time elapsed: 0.018 sec
BUILD FAILED
F:\test\build.xml:30: Test com.mycompany.myproject.myTest1 failed
Total time: 1 second
C'è qualche cosa che posso dire JUnit o Ant per visualizzare il risultato dettagliato sullo schermo?
Inoltre, se voglio scrivere qualcosa sullo schermo dell'unità sullo schermo, come posso farlo? Ho provato a inserire System.out.println() nel test ma non visualizza nulla sullo schermo.
Molte grazie.