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 Vincent Massol <vm...@octo.com> on 2002/05/02 12:37:27 UTC

RE: endxxx and beginxxx

Hi Ken,

> -----Original Message-----
> From: ken adjei [mailto:kencactus@yahoo.com]
> Sent: 02 May 2002 11:38
> To: cactus-user@jakarta.apache.org
> Subject: endxxx and beginxxx
> 
> 
> Does any know why the Junit TestRunner doesn't run these two methods
> endxxxx and beginxxx methods, because from the examples of the cactus,
> there assertion methods in them.  Why is it that Junit doesn't use
them ?
> 

The only thing the JUnit TestRunner does is to run all TestCase in a
suite. Thus it runs the ServletTestCase/JspTestCase/FilterTestCase who
all run beginXXX, testXXX and endXXX. You should read the "how it works"
tutorial if you're interested in how it works. If you're just interested
in running tests, you should read the "TestCase Howto" tutorial.

> The reason for this, is because I have populated the request object
with
> attributes in the beginxxx method  and was expecting to be able to
> retrieve it i endxxx methods
> 
> I'm sorry but i find the cactus documentation to be abit misleading

Can you point to me to which documentation in particular you are
referring to so that we can improve it ?

> because I thought these methods work like the setUp and tearDown
methods
> in Junit

why do you think that ?

> 
> 
> 
> Can any one advise hopefully give me a better explaination
> 
> 


Thanks
-Vincent


> 
> cheers
> 
> k
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness


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


RE: endxxx and beginxxx

Posted by ken adjei <ke...@yahoo.com>.
Ok I have read the how works document and I interpreted the sections where it said 
the Junit TestRunner  calls a TestCase.runTest() method. This method looks for a beginxxx(WebRequest) method and executes it if one is found. 
This is executed on the client side (i.e. not in a server engine). The WebRequest parameter passed to the beginXXX() method is used to set the HTTP headers, the HTTP parameters, ... that will be sent in step 2 to the Redirector proxy. 
2.The YYYTestCase.runTest() method then opens an HTTP connection to the Redirector proxy. All the parameters set up in the beginXXX() method are sent in the HTTP request (HTTP headers, HTTP parameters, ...) 

q)myComment(I would take this to be like a setUp in that you are doing a fixture) please correct me if I'm wrong

 

8.If no exception occurred, the YYYTestCase.runTest() method looks for an endXXX(org.apache.cactus.WebResponse) or endXXX(com.meterware.httpunit.WebResponse) method and executes it if found. At this stage, you have the opportunity to check returned HTTP headers, Cookies and the servlet output stream in the endXXX() method, again using JUnit asserts and helper utility classes provided by Cactus. 

 
intentional


---------------------------------
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness

RE: endxxx and beginxxx

Posted by "Rajagopal. V" <ra...@yahoo.com>.
>From the ServletTestCase JAvaDocs
> q)
> 
> I also need to know after the begin method is
> called, can you use httpservletRequest object in the
> textxxx methods to get the values you set up in the
> begin methods which should have being sent to
> redirector proxy on the server 
> 
request
public HttpServletRequestWrapper request

Valid HttpServletRequest object that you can access
from the testXXX(), setUp and tearDown() methods. If
you try to access it from either the beginXXX() or
endXXX() methods it will have the null value. 

Cheers
Raj


__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

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


RE: endxxx and beginxxx

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

> -----Original Message-----
> From: ken adjei [mailto:kencactus@yahoo.com]
> Sent: 02 May 2002 14:24
> To: Cactus Users List
> Subject: RE: endxxx and beginxxx
> 
> 
> Ok I have read the how to document and I interpreted the sections
where it
> said
> the Junit TestRunner  calls a TestCase.runTest() method. This method
looks
> for a beinxxx(WebRequest) method and executes it if one is found.
> This is executed on the client side (i.e. not in a server engine). The
> WebRequest parameter passed to the beginXXX() method is used to set
the
> HTTP headers, the HTTP parameters, ... that will be sent in step 2 to
the
> Redirector proxy.
> 2.The YYYTestCase.runTest() method then opens an HTTP connection to
the
> Redirector proxy. All the parameters set up in the beginXXX() method
are
> sent in the HTTP request (HTTP headers, HTTP parameters, ...)
> 
> q)myComment(I would take this to be like a setUp in that you are doing
a
> fixture) please correct me if I'm wrong
> 

I'm not sure exactly what you mean but I'll say yes ... 

> 
> 
> 8.If no exception occurred, the YYYTestCase.runTest() method looks for
an
> endXXX(org.apache.cactus.WebResponse) or
> endXXX(com.meterware.httpunit.WebResponse) method and executes it if
> found. At this stage, you have the opportunity to check returned HTTP
> headers, Cookies and the servlet output stream in the endXXX() method,
> again using JUnit asserts and helper utility classes provided by
Cactus.
> 
> q)
> 
> I also need to know after the begin method is called, can you use
> httpservletRequest object in the textxxx methods to get the values you
set
> up in the begin methods which should have being sent to redirector
proxy
> on the server
> 

Answer is yes. You should have a look at the Cactus sample in sample/ of
the cactus distribution. You'll see how to write test cases.

Thanks
-Vincent

> 
> 
> 
> 
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness


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


RE: endxxx and beginxxx

Posted by ken adjei <ke...@yahoo.com>.
Ok I have read the how to document and I interpreted the sections where it said 
the Junit TestRunner  calls a TestCase.runTest() method. This method looks for a beinxxx(WebRequest) method and executes it if one is found. 
This is executed on the client side (i.e. not in a server engine). The WebRequest parameter passed to the beginXXX() method is used to set the HTTP headers, the HTTP parameters, ... that will be sent in step 2 to the Redirector proxy. 
2.The YYYTestCase.runTest() method then opens an HTTP connection to the Redirector proxy. All the parameters set up in the beginXXX() method are sent in the HTTP request (HTTP headers, HTTP parameters, ...) 

q)myComment(I would take this to be like a setUp in that you are doing a fixture) please correct me if I'm wrong

 

8.If no exception occurred, the YYYTestCase.runTest() method looks for an endXXX(org.apache.cactus.WebResponse) or endXXX(com.meterware.httpunit.WebResponse) method and executes it if found. At this stage, you have the opportunity to check returned HTTP headers, Cookies and the servlet output stream in the endXXX() method, again using JUnit asserts and helper utility classes provided by Cactus. 

q)

I also need to know after the begin method is called, can you use httpservletRequest object in the textxxx methods to get the values you set up in the begin methods which should have being sent to redirector proxy on the server 

 



---------------------------------
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness