생각보다 쉽게 풀리지 않습니다. 테스트 코드와 애플리케이션 코드의 분리는 아직 적용하기 전입니다. classpath를 두 가지로 놓아 둔 것이 특징이라면 특징이겠죠. 멋지게 나오는 리포트까지 몇 번 더 진화를 시켜야하겠습니다.

<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
     2009. 6. 9. 오전 8:23:18
     junit   
     test case report
     kenu
====================================================================== -->
<project name="junit" default="compile">
    <description>
            test case report
    </description>
    <path id="classpath1">
        <fileset dir="lib">
            <include name="**/*.jar"/>
        </fileset>
    </path>
    <path id="test.classpath">
        <fileset dir="lib">
            <include name="**/*.jar"/>
        </fileset>
        <path location="dst"></path>
    </path>

    <!-- =================================
          target: default             
         ================================= -->
    <target name="compile" description="test case report">
        <mkdir dir="dst"/>
        <javac srcdir="src" destdir="dst" debug="on">
            <classpath refid="classpath1">
            </classpath>
        </javac>
    </target>

    <!-- - - - - - - - - - - - - - - - - -
          target: depends                     
         - - - - - - - - - - - - - - - - - -->
    <target name="test" depends="compile">
        <junit>
            <classpath refid="test.classpath">
            </classpath>
            <test name="test.UnitTest"></test>
        </junit>
    </target>

</project>


이클립스 프로젝트 파일 첨부합니다.


findbugs-ant.jar 파일을 $ANT_HOME/lib 에 복사한 뒤에 findbugs task를 사용할 수 있습니다.
파일이 많아지면 timeout이나 memory 이슈가 생길 수 있습니다.

참고용으로 적어봅니다.


        <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" />
        <target name="findbugs" depends="compile">
                <findbugs home="${findbugs.home}" output="xml" outputFile="findbugs.xml"
                        jvmargs="-Xms512M -Xmx1024M " timeout="1800000">
                        <auxClasspath path="${findbugs.home}/lib/Regex.jar" />
                        <sourcePath path="WebContent/WEB-INF/src" />
                        <class location="WebContent/WEB-INF/classes" />
                </findbugs>
        </target>


조대협님 감사합니다. ^^

+ Recent posts