服务器

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

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


发布日期:2019年01月06日
 
Ant+Cactus+Tomcat5.5容器内单元测试[3]

在应用的webxml文件中添加测试所需的各种映射

cactus提供了两个task来完成这个工作CactifyWar和WebXmlMerge

CactifyWar的功能是自动在已经打包的应用的webxml文件中添加所需的映射WebXmlMerge是提供合并两个webxml文件的功能

<target name=testprepare

depends=war compilecactus testpreparelogging>

<! Cactify the webapp archive >

<cactifywar srcfile=${targetdir}/${projectname}war

destfile=${tomcathome}/webapps/${projectname}cactifiedwar

>

<classes dir=${targetclassesjavadir}/>

<classes dir=${targetclassestestdir}/>

<lib dir=projectclasspath/>

</cactifywar>

</target>

运行测试

cactus提供了cactus和RunServerTests两个task来运行测试

cactus task是通过复制容器服务器的最小文件并运行来运行测试因此需要制定容器服务器的类型启动速度稍快点另外配置比较方便但是无法测试象tomcat连接池等资源另外对tomcat的支持也不好

[] [] [] []

               

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

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