cactus.sysproperties=cactus.contextURL
#cactus-sample-servlet-cactified就是你的测试应用所在路径,8080是端口号
cactus.contextURL = http://localhost:8080/cactus-sample-servlet-cactified
cactus.servletRedirectorName = ServletRedirector
cactus.jspRedirectorName = JspRedirector
cactus.filterRedirectorName = FilterRedirector
<!-- cactus.properties文件就需要放在lib.dir所对应的路径中 -->
description="Generate the runtime war">
webxml="${src.webapp.dir}/WEB-INF/web.xml">
<!-- 别忘了打包测试类 -->
<!-- 别忘了打包各种相关的jar文件 -->
< lib dir="project.classpath"/>
depends="war, compile.cactus, test.prepare.logging">
<!-- Cactify the web-app archive -->
destfile="${tomcat.home}/webapps/${project.name}-cactified.war"
>
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 -->
<!-- 8080是服务器的端口号,${project.name}-cactified是项目的路径,和上一步的cactifywar 的destfile相对应 -->
testURL="http://localhost:8080/${project.name}-cactified/ServletRedirector?Cactus_Service=RUN_TEST"
startTarget="_StartTomcat"
stopTarget="_StopTomcat"
testTarget="_Test"/>
<!-- _Test就是一个普通的junit任务 -->[@more@]
<!-- Due to some Cactus synchronization bug, the 'unit' tests need
to run before the 'sample' tests -->
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9650775/viewspace-921946/ ,如需转载,请注明出处,否则将追究法律责任。