Hi

This is the code I have:

     public void beginGetMethod(ServletTestRequest theRequest) {
          theRequest.addParameter("strScreenId", "5");
          theRequest.addParameter("strMinRoleId", "1");
     }

     public void testGetMethod() throws IOException
     {

        System.out.println("Inside testGetMethod........");

        try {
             servlet.doGet(request, response);
        } catch (Exception e) {
             System.out.println(e.toString());
        }

       System.out.println("Completed testGetMethod.....");
     }

My actual Servlet being tested uses request.getParameter() method to
retrieve the values of strScreenId, strMinRoleId.

Will this not work???

Thanks & Regards
Arathi




                                                                                       
     
                    laurent.duperv                                                     
     
                    [EMAIL PROTECTED]           To:     [EMAIL PROTECTED]        
     
                                         cc:                                           
     
                    04/16/02 05:15       Subject:     Re: Servlet Testing with 
Attributes   
                    PM                                                                 
     
                    Please respond                                                     
     
                    to "Cactus                                                         
     
                    Users List"                                                        
     
                                                                                       
     
                                                                                       
     




On 16 Apr, [EMAIL PROTECTED] 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 <mailto:[EMAIL PROTECTED]>

People have one thing in common--they are all different.



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





-----------------------Disclaimer------------------------

The views of the author may not necessarily reflect those
of the Company. All liability is excluded to the extent
permitted by law for any claims arising as a result of the
use of this medium to transmit information by or to
IT Solutions (India) Pvt. Ltd.

We have taken precautions to minimize the risk of
transmitting software viruses, but we advise you to
carry out your own virus checks on any attachment to
this message.  We cannot accept liability for any loss or
damage caused by software viruses.

------------------------Disclaimer------------------------


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

Reply via email to