You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by "Ball, Roger F" <rf...@qwest.com> on 2002/12/10 20:56:00 UTC

Keeping the same session

Howdy
	I am trying to run several tests on the same servlet and use the
same session for each test. The first test performs a custom login and
creates a session for the user. I would like to keep the same session for
the other tests that are performed. How do I keep the same session for all
tests in a suite without changing the target servlet?

Thanks

Roger Ball

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Keeping the same session

Posted by Vincent Massol <vm...@octo.com>.
Hi Roger,

Have a look at http://jakarta.apache.org//cactus/faq.html#faq4

In short, Cactus is a unit testing tool and a best practice is to keep
each test independent of the others. Thus the real nice way of doing
what you want is to write a setUp() method that logs your user in by
setting whatever is needed in the HTTP session for example. setUp() will
be executed on the server side before each test.

Of course, if you also want to write a test for unit testing your login
use case, you should write it in a different test case class (ideally
you should have one test case per fixture).

Now, that said, there is an option in Cactus 1.5 to keep the HTTP
session between different tests but I would not recommend it in your
case. If you really want to do that, you can check the Cactus unit test
suite in CVS which shows how to use it.

Thanks
-Vincent

> -----Original Message-----
> From: Ball, Roger F [mailto:rfball@qwest.com]
> Sent: 10 December 2002 19:56
> To: 'cactus-user@jakarta.apache.org'
> Subject: Keeping the same session
> 
> Howdy
> 	I am trying to run several tests on the same servlet and use the
> same session for each test. The first test performs a custom login and
> creates a session for the user. I would like to keep the same session
for
> the other tests that are performed. How do I keep the same session for
all
> tests in a suite without changing the target servlet?
> 
> Thanks
> 
> Roger Ball
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>