U E D R , A S I H C RSS

Ant/JUnit And Ftp

No older revisions available

No older revisions available



ant script 를 JUnit 과 FTP 를 연동하여 해당 웹 주소에 junit reporting 을 해주는 예.
여기서는 1002 의 집 컴퓨터 셋팅을 예로 들었음. 적당히 값을 고쳐서 이용하면 된다.

이를 cron job 이나 windows 의 '예약된 작업' 등 스케줄러와 같이 이용하면 편리하다.
만일 XP Process 를 따른다면, 전체 CustomerTest(AcceptanceTest) 갯수 / 통과하는 Test 갯수 등이 나오므로, 매번 작업의 진척도를 파악하기 쉽다.

~cpp 
<project name="servletspike" basedir="." default="reporttoftp">
    <property name="build" value="build"/>
    <property name="lib" value="lib"/>
    <property name="src" value="src"/>
    <property name="dist" value="dist"/>
    <property name="report" value="reports"/>
    <property name="distlibdir" value=""/>

    <property name="ftpuserid" value="userid"/>
    <property name="ftpuserpass" value="password"/>
    <property name="ftpserverurl" value="free1002.nameip.net"/>
    <property name="ftpserverport" value="21000"/>
    <property name="ftptestreportpath" value="/1002/web/htmlreport"/>

    <target name="init">
        <mkdir dir="${build}"/>
        <mkdir dir="${dist}"/>
        <mkdir dir="${report}"/>
        <mkdir dir="${checkoutdir}"/>
    </target>

    <target name="compile" depends="init" >
        <javac srcdir="${src}" destdir="${build}">
            <classpath>
                <pathelement location="${lib}/jsdk23.jar"/>
                <pathelement location="${lib}/junit.jar"/>
            </classpath>
        </javac>
    </target>

    <target name="dist" depends="compile">
        <copy todir="${dist}">
            <fileset dir="${build}"/>
        </copy>
        <copy todir="${distlibdir}">
            <fileset dir="${lib}"/>
        </copy>
    </target>

    <target name="unittest" depends="compile">
        <junit>
            <classpath>
                <pathelement location="${lib}/jsdk23.jar"/>
                <pathelement location="${build}"/>
            </classpath>

			<formatter type="xml"/>

			<batchtest fork="yes" todir="${report}">
				<fileset dir="${build}">
					<include name="Simple*"/>
				</fileset>
			</batchtest>

        </junit>
        <junitreport todir="${report}">
            <fileset dir="${report}">
                <include name="TEST-*.xml"/>
            </fileset>
            <report format="frames" todir="${report}/html"/>

        </junitreport>
    </target>

    <target name="reporttoftp" depends="unittest">
		<ftp server="${ftpserverurl}" port="${ftpserverport}"
			userid="${ftpuserid}" password="${ftpuserpass}"
            action="del" remotedir="${ftptestreportpath}">
			<fileset dir="${report}/html">
				<include name="*.*"/>
			</fileset>
		</ftp>

        <!-- <ftp server="${ftpserverurl}" port="${ftpserverport}"
            userid="${ftpuserid}" password="${ftpuserpass}"
            action="mkdir" remotedir="${ftptestreportpath}"/> -->
        <ftp server="${ftpserverurl}" port="${ftpserverport}"
            userid="${ftpuserid}" password="${ftpuserpass}"
            action="put" remotedir="${ftptestreportpath}">
            <fileset dir="${report}/html">
                <include name="*.*"/>
            </fileset>
        </ftp>
    </target>

    <target name="clean">
        
        
        
        
    </target>

</project>

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:31
Processing time 0.0213 sec