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/04/14 21:14:06 UTC
RE: Servlet Testing with Attributes
No it isn't ... :-). But please continue to answer questions, we need
your help ! :0)
setURL() is simply used to simulate a URL. The correct way is :
public void beginDoGet(WebRequest request)
{
request.addParameter("name1, "value1");
request.addParameter("name2, "value2");
}
[...]
BTW, Cactus comes with several examples which show how to do almost
everything you might dream of ... :-). Have a look at them for
reference.
-Vincent
> -----Original Message-----
> From: laurent.duperval@masq.ca [mailto:laurent.duperval@masq.ca]
> Sent: 16 April 2002 12:46
> To: cactus-user@jakarta.apache.org
> Subject: Re: Servlet Testing with Attributes
>
> On 16 Apr, Arathi.Bhaskar@itsindia.com wrote:
> > Hi
> >
> > I have a test servlet , which does the following:
> >
> > 1. In the setup method, i am instantiating the actual servlet to be
> tested.
> > 2. In the test method, i am calling the servlet's doGet method,
which is
> to
> > be tested. doGet method in the actual servlet accepts two parameters
as
> > part of the Query String. (thru getAttribute).
> >
> > My question is, how can I set this in my test method before calling
the
> > doGet method.
> >
>
> I think this is the correct way:
>
> public void beginDoGet(WebRequest theRequest) {
> theRequest.setURL("localhost:8080", "/servletcontext",
> "/YourTestServlet", null, "param1=foo,param2=bar");
> }
>
> L
>
> --
> Laurent Duperval <ma...@masq.ca>
>
> People have one thing in common--they are all different.
>
>
>
> --
> 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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>