配置ant运行cactus测试
类路径的设置
我们要按照下面的图设置客户端(ant junit任务中)设置classpath,并把右半部分所示的类放到服务器或者webapp的类路径上
客户端cactus.properties
我们知道,cactus需要redirector 代理才能工作,我们除了把这些代理考到相应的webapp的类路径(对于filter和servlet代理)或webapp路径(对于jsp代理)外,我们还需要告诉客户端测试实例到哪里去找这些代理,下面是cactus.properties的内容:
cactus.contextURL = http://localhost:8080/test
其中test为被测试webapp的上下文路径。
cactus.properties也必须放在ant junit任务的classpath中。
服务器(假设为tomcat 4.12)server.xml的设置
我们必须在server.xml中添加cactus redirector代理,使得这些代理能接受客户端测试实例传过来的请求。详细添加办法请参见cactus 文档。
有了正确的junit 类路径的设置,其他的就合正常的junit测试一样。