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 "JONES,TIM (HP-PaloAlto,ex1)" <ti...@hp.com> on 2003/04/02 00:26:35 UTC

Automating multiple requests

I am a relatively new user of cactus.  In trying to test a controller
servlet, I am trying to automate the setting of request components as much
as possible.   Here is my understanding of how things work and the issue:

 - When the test case is executed, beginXXX() is called on the client side.
This can be used to set all manner of request objects (cookies, headers,
etc).  For our needs, the most important piece is the URL itself, with
attendent query parameters.
 - Next, the testXXX() method is called on the server, with access to
implicit container objects initialized with the request created in
beginXXX().

The controller servlet is a little complex (and messy), containing methods
to parse the URL in several ways, extract parameters, extract encoded
strings, extract cookies and based up these items set one of several
different request scope attributes.

That said, it would be nice if there was a way to specify a set of URL
components (things passed to setURL()), and for each item in the set,
initialize the WebRequest object, and have a set of test cases called on the
server.  Something like:

create group of URL components
foreach item in group {
    foreach testXXX method {
        setURL in beginXXX
        testcase executed on server side
        assertions made (passed from client side?)
    }
} 

Does this make sense?  Is anyone aware of any tool/framework that might
help, or some idea on how to accomplish this?

Thanks in advance,

Tim

RE: Automating multiple requests

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Tim,

If I understand you correctly, you want to write data-driven test cases
with Cactus, right?

There are certainly lots of ways to achieve this. One of them is by
having a single beginXXX() method and a single testXXX() method and call
them several times from a TestSuite, taking the data from an XML file
for example.

There was a message sent to the cactus list today about JTestCase
(https://sourceforge.net/projects/jtestcase). I haven't checked it but
you may want to have a look at it.

Hope it helps, 
-Vincent

> -----Original Message-----
> From: JONES,TIM (HP-PaloAlto,ex1) [mailto:timothy.jones@hp.com]
> Sent: 02 April 2003 00:27
> To: 'cactus-user@jakarta.apache.org'
> Subject: Automating multiple requests
> 
> I am a relatively new user of cactus.  In trying to test a controller
> servlet, I am trying to automate the setting of request components as
much
> as possible.   Here is my understanding of how things work and the
issue:
> 
>  - When the test case is executed, beginXXX() is called on the client
> side.
> This can be used to set all manner of request objects (cookies,
headers,
> etc).  For our needs, the most important piece is the URL itself, with
> attendent query parameters.
>  - Next, the testXXX() method is called on the server, with access to
> implicit container objects initialized with the request created in
> beginXXX().
> 
> The controller servlet is a little complex (and messy), containing
methods
> to parse the URL in several ways, extract parameters, extract encoded
> strings, extract cookies and based up these items set one of several
> different request scope attributes.
> 
> That said, it would be nice if there was a way to specify a set of URL
> components (things passed to setURL()), and for each item in the set,
> initialize the WebRequest object, and have a set of test cases called
on
> the
> server.  Something like:
> 
> create group of URL components
> foreach item in group {
>     foreach testXXX method {
>         setURL in beginXXX
>         testcase executed on server side
>         assertions made (passed from client side?)
>     }
> }
> 
> Does this make sense?  Is anyone aware of any tool/framework that
might
> help, or some idea on how to accomplish this?
> 
> Thanks in advance,
> 
> Tim
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org