ALM/Test Automation

Cactus 실행용 ANT 스크립트

Terry Cho 2007. 9. 13. 12:22

<project name="CactusTest" default="cactus-test" >

 <!--
 =============================================================================================
 기본 환경 정보 설정
 =============================================================================================
 -->
 <!-- 기본 디렉토리 정보 -->
 <property name="project.name" value="Cactus"/>
 <property name="lib" value="./lib"/>
 <property name="src" value="./src"/>
 <property name="build" value="./build"/>
 <property name="packaging" value="./pack"/>
 <property name="conf" value="./conf"/>

 <property name="cactus.home" value="D:\dev\lib\jakarta-cactus-13-1.7.2"/>
 <property name="cactus.testlog" value="c:\temp\test-report"/>
 <property name="tomcat.home" value="D:\dev\apache-tomcat-5.5.23\"/>

 <!-- jar 파일 경로 -->
 <property name="cactus.jar" value="${cactus.home}/lib/cactus-1.7.2.jar"/>
 <property name="cactus-ant.jar" value="${cactus.home}/lib/cactus-ant-1.7.2.jar"/>
 <property name="commons-httpclient.jar" value="${cactus.home}/lib/commons-httpclient-2.0.2.jar"/>
 <property name="commons-logging.jar" value="${cactus.home}/lib/commons-logging-1.0.4.jar"/>
 <property name="aspectjrt.jar" value="${cactus.home}/lib/aspectjrt-1.2.1.jar"/>
 <property name="cargo.jar" value="${cactus.home}/lib/cargo-0.5.jar"/>
 <property name="servletapi.jar" value="${lib}/servletapi-2.3.jar"/>
 <property name="junit.jar" value="${lib}/junit-3.8.1.jar"/>

 <!-- class path 설정 -->
 <path id="cactus.classpath">
     <pathelement location="${cactus.jar}"/>
     <pathelement location="${cactus-ant.jar}"/>
     <pathelement location="${commons-httpclient.jar}"/>
  <pathelement location="${commons-logging.jar}"/>
  <pathelement location="${aspectjrt.jar}"/>
  <pathelement location="${cargo.jar}"/>
  <pathelement location="${junit.jar}"/>
 </path>
 <!--
 =============================================================================================
 Task 정의
 =============================================================================================
 -->
 <!-- Cactus task 정의 -->
 <taskdef resource="cactus.tasks" classpathref="cactus.classpath"/>
 
 <!-- Clean -->
 <target name="clean">
  <delete dir="${build}"/>
  <mkdir dir="${build}" />
  <mkdir dir="${packaging}" />
 </target>
 <!--
 =============================================================================================
 컴파일
 =============================================================================================
 -->
 <!-- 소스 컴파일 -->
 <target name="compile"  >
  <javac srcdir="${src}" destdir="${build}">
   <classpath>
    <path refid="cactus.classpath"/>
    <pathelement location="${servletapi.jar}"/>
   </classpath>
  </javac>
 </target>
 <!--
 =============================================================================================
 패키징
 ${build}에 생성된 클래스들과, ${conf}에 있는 web.xml 설정 정보를 모아서 하나의 WAR파일로 패키징 한다.
 =============================================================================================
 -->
 <!-- WAR 패키징 -->
 <target name="packaging" depends="compile" >
  <war warfile="${packaging}/${project.name}.war"  webxml="${conf}/web.xml" >
   <classes dir="${build}" />
   <lib dir="${lib}"/>
  </war>
 </target>
 
 <!--
 =============================================================================================
 배포
 LOCAL Machine으로 배포하는 스크립트로 tomcat의 /webapps 디렉토리에 war파일을 복사한다.
 =============================================================================================
 -->
 <!-- 배포 -->
 <target name="deploy" depends="packaging" >
  <copy file="${packaging}/${project.name}.war" todir="${tomcat.home}/webapps"/>
 </target>
 
 <!--
 =============================================================================================
 테스트
 =============================================================================================
 -->  
 <!-- Cactus 테스트 -->
 <target name="cactus-test">
   <!-- Run the tests -->
    <cactus  warfile="${packaging}/${project.name}.war" fork="yes"
     printsummary="yes"
        failureproperty="tests.failed">
   <classpath>
    <path refid="cactus.classpath"/>
    <pathelement location="${servletapi.jar}"/>
    <pathelement location="${build}"/>
   </classpath>
      <containerset>
       <!--
       <tomcat5x dir="D:\dev\apache-tomcat-5.5.23" port="8080" />
        -->
       <generic name="local tomcat" port="8080">
            <startup target="dummy"/>
            <shutdown target="dummy"/>
       </generic>
   
      </containerset>

      <formatter type="brief" usefile="false"/>
      <formatter type="xml"/>
      <batchtest todir="${cactus.testlog}">
        <fileset dir="./src">
          <include name="**/Test*.java"/>
        </fileset>
      </batchtest>
    </cactus>
    <!-- JUnit(cactus) 테스트 리포트 생성 -->
    <junitreport todir="${cactus.testlog}">
   <fileset dir="${cactus.testlog}" includes="TEST*.xml"/>
     <report todir="${cactus.testlog}" format="frames"/>
    </junitreport>
     
    <fail if="tests.failed"> cactus Test failed</fail>
 </target>
 <target name="dummy">
 </target>
 
 
</project>
   

그리드형

'ALM > Test Automation' 카테고리의 다른 글

단위 테스트 1회 (JUnit)  (1) 2007.11.23
Test Coverage 분석툴  (0) 2007.11.08
Cactus 빌드 스크립트 샘플  (0) 2007.09.12
Unit Testing WebLogic Workshop 8.1 Applications & JWebUnit  (0) 2007.08.27
JUnitEE vs Catcus  (0) 2007.08.27