wood burning stoves 2.0*
The moose likes Testing and the fly likes Cactus question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Cactus question" Watch "Cactus question" New topic
Author

Cactus question

Serge Adzinets
Ranch Hand

Joined: Nov 26, 2002
Posts: 166
Hi all,
I'm learning how to test with cactus and got a question.
To test my servlet I need to call it's service methods several times with different parameters. Smth like this:
public void testMyServlet() {
MyServlet myServlet = new MyServlet();
myServlet.service(request, response);
//set request params
myServlet.service(request, response);
assertEquals(...);
}
But I can't find how I can reassign parameters once given to the request in the beginXXX() method.
Any ideas?


Best Regards,<br />Serge
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30116
    
150

Serge,
I don't think you can reassign the parameters, but you don't need to. Since you can have a separate beginXXX method for each testXXX method, you can set the parameters you want in each beginXXX. If you find a test needs more than one set of parameters, you can refactor it into two tests.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cactus question
 
Similar Threads
RequestDispather
Problem to initialize the request parameter of the HttpServlet from any JUnit test class
How to add custom parameters request Object in Cactus testin
Cactus Problem
Cactus error