Title: RE: Access to HttpServletRequest.getInputStream() in Cactus
 
----- Original Message -----
Sent: Wednesday, May 09, 2001 2:53 AM
Subject: RE: Access to HttpServletRequest.getInputStream() in Cactus


 Fine,
  There might be cases where it's hard to simulate the
   webserver ( like redirects, or sessions ), but how
   can I solve this problem of providing the OutputStream for the
  ServletRequest ??? If we're using the WebServer's implementation
   I don't see how it can be over-ridden (since it hasn't been
    already).

Cactus provides to you the servlet output stream so that you can make asserts on it if you like (that's in the endXXX() method). What it does not provide at the current time (see my previous mail) is for your test case to pass data using the servlet input stream. In the current version it only provides API for you to set cookies, HTTP headers or HTTP parameters, using either GET or POST methods, so yes you can simulate whatever input stream you wish. However, I agree it would be simpler in some cases to be able to directly write to the servlet input stream.

Download the Cactus sample, have a look at them and post a question on this list if you want more details.

  
   Also, can we set up cactus to run as part of the build process ???
   I'm trying to introduce UI developers in our company to junit
   and extreme programming, and want to assure them that we definitely
   can unit test their code. Does running under tomcat pre-empt this
   from happenning  ???

 

Oh yes ! That's actually number one on the list of Cactus features and I would say that's really the best feature of Cactus ... Cactus is not just a framework for unit testing server-side code, it is also a build methodology (that uses Ant and some custom Ant tasks). Please have a look at the documentation on the cactus web site to see how it works and then download and try the cactus sample that is provided with the main distribution.

 --- jerome

 

Thanks.

Vincent.

Reply via email to