服务器

位置:IT落伍者 >> 服务器 >> 浏览文章

Ant+Cactus+Tomcat5.5容器内单元测试[4]


发布日期:2020年01月03日
 
Ant+Cactus+Tomcat5.5容器内单元测试[4]

RunServerTests是通过直接启动容器服务起来运行测试因此速度稍慢且配置较麻烦但能测试各种资源

<target name=test depends=testprepare

description=Run tests on Tomcat >

<! Start the servlet engine wait for it to be started run the

unit tests stop the servlet engine wait for it to be stopped

The servlet engine is stopped if the tests fail for any reason >

<! 是服务器的端口号${projectname}cactified是项目的路径和上一步的cactifywar 的destfile相对应 >

<runservertests

testURL=http://localhost:/${projectname}cactified/ServletRedirector?Cactus_Service=RUN_TEST

startTarget=_StartTomcat

stopTarget=_StopTomcat

testTarget=_Test/>

</target>

<! _Test就是一个普通的junit任务 >

<target name=_Test>

<junit printsummary=yes fork=yes>

<classpath>

<path refid=projectclasspath/>

<pathelement location=${targetclassesjavadir}/>

<pathelement location=${targetclassestestdir}/>

</classpath>

<formatter type=brief usefile=false/>

<formatter type=xml/>

<batchtest>

<fileset dir=${srctestdir}>

<! Due to some Cactus synchronization bug the unit tests need

to run before the sample tests >

<include name=**/Test*java/>

<exclude name=**/Test*Alljava/>

</fileset>

</batchtest>

</junit>

</target>

[] [] [] []

               

上一篇:Ant+Cactus+Tomcat5.5容器内单元测试[1]

下一篇:Ant+Cactus+Tomcat5.5容器内单元测试[3]