Cactus是apache的一个开源测试框架,它是建立在junit 的基础上,它的功能比junit 强大的多,它可以做服务器端的测试,特别是Container 内的测试,它是一个自动测试框架,经过一段时间的研究,将我的心得写下来供大家参考。
首先需要的资源如下:
1 . Eclipse SDK Version: 3.1.2
2. 需要的类库有:aspectjrt-1.2.1.jar, cactus-1.7.1.jar ,commons-httpclient-2.0.2.jar,commons-digester.jar,httpunit-1.6.jar, junit.jar。
3. 将服务器与eclipse集成(可选,集成进来的主要目的是可以实现debug)
下面是需要编写的文件资源:
1。cactus.properties
################################################################################
# Configuration file for Cactus.
# Each project using Cactus need to have such a file put in the CLASSPATH
# (Meaning the directory containgin this file should be in the CLASSPATH, not
# the file itself of course ... :) )
# Defines the URLs that will be used by Cactus to call it's redirectors
# (Servlet and JSP). You need to specify in these URLs the webapp context
# that you use for your application. In the example below, the context is
# "test".
cactus.servletRedirectorURL = http://localhost:7001/cactus/ServletRedirector
cactus.jspRedirectorURL = http://localhost:7001/cactus/JspRedirector
cactus.filterRedirectorURL = http://localhost:7001/cactus/FilterRedirector
# Name of Cactus property that specify the URL up to the webapp context.
# This is the base URL to call for t