이전 포스트에 이어집니다.
junit task를 다음과 같이 변경할 수 있습니다.
<target name="test" depends="compile">
<mkdir dir="report/html"/>
<junit printsummary="on" haltonfailure="on">
<classpath refid="test.classpath">
</classpath>
<formatter type="xml"/>
<batchtest todir="report">
<fileset dir="dst">
<include name="**/*Test*"/>
</fileset>
</batchtest>
</junit>
</target>
리포팅 기능을 강화한 설정입니다.
report 폴더에 TEST-*.xml 파일이 생성이 됩니다.
이 파일을 이용해서 다음과 같은 문서를 생성할 수 있습니다.
추가되는 junitreport 코드는 다음과 같습니다. 굵게 표시해 놓았습니다.
<target name="test" depends="compile">
<mkdir dir="report/html"/>
<junit printsummary="on" haltonfailure="on">
<classpath refid="test.classpath">
</classpath>
<formatter type="xml"/>
<batchtest todir="report">
<fileset dir="dst">
<include name="**/*Test*"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="report">
<fileset dir="report">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="report/html"/>
</junitreport>
</target>
이제 남은 작업은 소스와 테스트코드 분리 설정과 그 후에 okjsp사이트에 적용하는 것입니다.
샘플 첨부합니다.
참고서적:
이클립스 프로젝트 필수 유틸리티, 민진우, 이인선 , 한빛미디어, 2009, p251~255