我在JBuilder下自动生成了一个TestCase,具体的代码如下:public void testDoGet() throws ServletException, IOException {
    HttpServletRequest request = null;
    HttpServletResponse response = null;
    simpleServlet.doGet(request, response);
    /**@todo fill in the test code*/
  }但具体怎么写就不知道了,而且运行这个测试还会报错。所以希望使用过Cactus的朋友们能给予指点。

解决方案 »

  1.   

    你的request和response是null当然会出错了。这两个对象是容器返回的,你大概无法测试的。
      

  2.   

    我是进行容器内测试,继承的是org.apache.cactus.ServletTestCase:import org.apache.cactus.*;
    import javax.servlet.*;
    import java.io.*;
    import javax.servlet.http.*;public class TestSimpleServlet extends ServletTestCase {  .....}
      

  3.   

    用cactus进行测试不是一句话能说得清楚的,我自己写了些文档,如果搂主要看的话,可以发邮件到[email protected]把你邮箱email给我,我给你发~
      

  4.   

    guozhanxian(蝈蝈):
    我给你发邮件已经好多天了,你怎么没信了?
      

  5.   

    guozhanxian(蝈蝈):
    非常不好意思,我没注意把你的邮件给删了,麻烦你再给我发一遍好吗?谢谢!