商讯信箱
用户名: @
密  码:   注册|忘记密码
登录
个人用户经销商
您的位置:首页 > 技术频道 > 正文

ant+cactus+tomcat5.5容器内单元测试

作者:佚名  2007-08-28
【IT168技术文档】

一、下载并解压缩cactus
    下载地址为http://java.chinaitlab.com/tools/45970.html 。将cactus的lib目录下的cactus-ant-1.7.1.jar复制到ant的lib目录。

二、配置cactus
    cactus的配置很简单,新建一个cactus.properties文件,并把它放在ant脚本中的cactus任务的classpath下,文件中包括如下内容

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
    具体的做法结合ant脚本再进一步解释。

三、运行ant脚本

  ant脚本主要执行以下任务

1、设定classpath
<path id="project.classpath"> <fileset dir="${lib.dir}"> <include name="*.jar"/> </fileset> <!-- cactus.properties文件就需要放在lib.dir所对应的路径中 --> <pathelement location="${lib.dir}"/> <pathelement location="${tomcat.home}/common/lib/jsp-api.jar"/> <pathelement location="${tomcat.home}/common/lib/servlet-api.jar"/> </path>
1 2 3
【内容导航】
第1页: cactus 第2页: 定义相关任务
第3页: 运行测试
©版权所有。未经许可,不得转载。
[责任编辑:阿雪]
[an error occurred while processing this directive]