jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@octo.com>
Subject RE: Concatenating two cactus tests?
Date Fri, 22 Feb 2002 22:20:41 GMT
Balki,

In your test for testB, you need to add the cookie to the request, in
beginXXX(). It is all about unit testing, i.e. about testing in
isolation. You know the cookie name and you know values with which you
wan to test. Thus, you can set the cookie in beginXXX().

What you need to really understand is that Cactus is not about testing a
full use case interaction, like the one you describe, but rather about
testing _separately_ (read independently) the 2 test cases. For example
:

beginTestA(...)
{
  // set what is needed WRT the HTTP request
...
}

testTestA()
{
  // set what is need WRT container objects
...  
  // Execute the test
...
  // Assert server side objects
...
}

endTestA(...)
{
  // Assert HTTP related response values
...
}

And same for TestB.

Do you have a use case in mind where this would not work ?

Thanks
-Vincent

> -----Original Message-----
> From: BALA KRISHNA [mailto:ebalki2002@yahoo.com]
> Sent: 22 February 2002 21:55
> To: cactus-user@jakarta.apache.org
> Subject: RE: Concatenating two cactus tests?
> 
> Hi vincent,
> 
> >This is what I call "functional unit testing" on the
> >Cactus main page
> >(at the bottom of the page :
> >http://jakarta.apache.org/cactus).
> 
> How to do functional unit testing of a testB (say test
> for validateSession of a user who already logged in)
> and requires data like cookies etc. which are
> available from response of testA(test for
> createSession)?
> 
> Here I see a need for concatenating two tests.
> 
> There are two ways to do this I think -
> 
> 1. I save the cookie value as system property (dont
> know any other way...??) in the endCreateSession().
> Then read this value and set cookie in the request of
> beginValidateSession().
> 
> 2. Use HttpUnit in beginCreateSession() and read the
> cookie from response of the conversation and set it in
> the request for the current test.
> 
> Do these make sense? I tried method 1. Has anyone
> tried method2? Is method 2 a better approach if it
> will work? Can you please comment on the above.
> 
> thanks,
> balki
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - Coverage of the 2002 Olympic Games
> http://sports.yahoo.com
> 
> --
> 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:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>


Mime
View raw message