I'll agree there.  You don't want to couple each test method together with
the same session.  This would be a bad thing.

I highly recommend creating a super class for all of your "TestCase"
classes.  Place simple login, navigation to certain areas in your
application.

See Ya,

Nick

> -----Original Message-----
> From: Martijn Dashorst [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 29, 2004 1:11 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [Jwebunit-users] Running tests in single session
> 
> 
> Sreekant wrote:
> 
> >Infact i did get it working with static declarations. But my 
> question was
> >how do we set our test methods or test cases to run in a single HTTP
> >session. For example, i test my Logon page in my first 
> method and then i
> >have test methods for each of the requests i would like to 
> do with my first
> >page, like profile creation, modifications .., e.t.c,. As 
> each of the test
> >methods are running in different sessions i had to add my 
> logon code in all
> >the methods... which I am pretty sure is not the right way 
> to write a web
> >application test case. Do i have to set all the session 
> variables as hidden
> >HTML parameters? how does it work?
> >  
> >
> It is *the* rule of all JUnit tests (the parent of jWebUnit, so to 
> speak) that each test (i.e. each test*() method) should run 
> independently.
> 
> This way, if one test fails, the other tests won't fail 
> necessarily. Say 
> if testX() fails, then testY() can run independently.
> 
> In the jWebUnit case, this means that you will get a new 
> browser session 
> for each test. And that is A Good Thing.
> 
> What you can do, to ease the pain, is create some 
> navigational methods 
> to navigate through your site:
> 
> public void navigateToFoo() {
> beginAt("somePage");
> clickLinkWithText("Bar");
> clickLinkWithText("Foo");
> assertTitle("Foo page");
> }
> 
> public void testFoo1() {
> navigateToFoo();
> assertSomething();
> }
> 
> public void testFoo2() {
> navigateToFoo();
> assertSomeOtherThing();
> }
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email sponsored by Black Hat Briefings & Training.
> Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
> digital self defense, top technical experts, no vendor pitches, 
> unmatched networking opportunities. Visit www.blackhat.com
> _______________________________________________
> Jwebunit-users mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jwebunit-users
> 


- - - - - - 
This e-mail message is intended only for the use of the individual or entity
identified in the alias address of this message and may contain confidential
and privileged information. Any unauthorized review, use, disclosure or
distribution of this e-mail message is strictly prohibited. If you have
received this e-mail message in error, please notify the sender immediately
by reply e-mail and delete this message from your system. Thank you.


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Jwebunit-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to