Hi Ivan,

An interesting idea. You have to remember that calling cactus tests from
a web browser is just one way of doing it. There are lots of other front
ends: Ant, Maven, Eclipse, manually from command line, etc. Thus the
solution must be able to work for all these situations.

ATM, there are already ways to pass parameters to a cactus test case.
Here's how you can currently do it:

public void beginXXXX(WebRequest req)
{
  req.addParameter("param1", System.getProperty("param1"));
[...]
}

Thus, I believe the best solution would be to modify the Cactus
ServletTestRunner class so that it adds all the HTTP parameters as
System properties. That will allow your test case to retrieve these
properties as shown above.

It has the advantage that you'll also be able to use the other front
ends for your test and it'll still work (provided you also configure the
other front ends to pass these parameters).

Would that do it for you?

Thanks
-Vincent

> -----Original Message-----
> From: Ivan Kaschenko [mailto:[EMAIL PROTECTED]
> Sent: 10 November 2003 09:56
> To: Cactus Developers List
> Subject: Running cactus test from web-browser with custom parameters
> 
> Hi, guys!
> 
> I have a question but couldn't find a proper location to place it in.
> Would
> you be so kind to skim it though and, maybe, give me some links where
I
> can
> get information I need?
> 
> As specified in Cactus documentation, running test from web-browser
must
> be
> performed as follows:
> 
> http://server:port/webapp/ServletTestRunner?suite=testcasename
> 
> It would be extremely convinient to parametrize tests from such
requests.
> I
> mean adding parameters list in a way as http GET request syntax
specifies:
> 
>
http://server:port/webapp/ServletTestRunner?suite=testcasename&param1=va
lu
> e1
> &param2=value2 etc.
> 
> Optional parameters are custom ones and must be passes to request
(within
> test) without any modification. They must be accessible via
> WebRequest.getParameter(String) call. Default value must be provided.
For
> example:
> 
> public void beginXXX(WebRequest theRequest) throws Exception {
>     String param1 = theRequest.getParameter("search_keyword");
>     if (param1 == null)
>         theRequest.addParameter("search_keyword", "Cactus");
>     [...]
>  }
> 
> General benefit is test parametrization which doesn't require
recompiling
> and redeploying web-application (you understand it may be
time-consuming).
> 
> Greetings,
> Ivan.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to