Hi Jonathan,

Webtest alread supports multiple windows/browser sessions in order to simulate 
starting a new session without disrupting the current flow.

Please take a look at <selectWebClient>: 
<http://webtest.canoo.com/webtest/manual/selectWebClient.html>

There are a few ways to use <selectWebClient> depending on how often you want 
to switch between the browser sessions.  A one-time switch would look something 
like this:

<webtest name="Single switch">
    <steps>
        <!-- Initial Flow test steps -->
        <selectWebClient name="paypal">
            <!-- Do Paypal logic -->
        </selectWebClient>
        <!-- Continue previous flow from where you left off -->
    </steps>
</webtest>

If you need to switch between the browser sessions multiple times, your test 
would look like this:

<webtest name="Multiple switches">
    <steps>
        <!-- Initial Flow test steps -->
        <selectWebClient name="paypal"/>
        <!-- Do Paypal logic -->
        <selectWebClient name="default"/>
        <!-- Continue previous flow from where you left off -->
        <selectWebClient name="paypal"/>
        <!-- Do More Paypal logic -->
        <selectWebClient name="default"/>
        <!-- Continue previous flow from where you left off -->
    </steps>
</webtest>

Cheers,

John Spann | Associate Software Engineer

Citrix Online Division
Citrix Systems, Inc.
6500 Hollister Avenue
Goleta, CA 93117 USA
www.citrix.com

Phone: 805.690.3489
Cell: 805.729.0008
Email: [email protected]


________________________________
From: Jonathan Rosenberg <[email protected]>
Reply-To: <[email protected]>, Jonathan Rosenberg <[email protected]>
Date: Thu, 11 Jun 2009 08:37:41 -0700
To: <[email protected]>, Marc Guillemot <[email protected]>
Subject: RE: [Webtest] Null Pointer Exception

Marc,

The nested <webtest/> occurred in an external Ant-invoked file.  I suspect 
that's why there was no complaint.

I was using the nesting to try to deal with testing payment using the PayPal 
sandbox.  Using the sandbox requires that another
window has logged onto the sandbox account.

I thought that the nested webtest would solve the problem of not destroying the 
state of the transaction that had begun.

I have since realized that this wouldn't have worked anyway, since the sandbox 
log in sets a cookie (which gets lost when I exit the
nested webtest).

What I really needed was a way to simulate windows/tabs using webtest ...

--
Jonathan Rosenberg
Founder & Executive Director, Tabby's Place
http://www.tabbysplace.org/


> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On 
> Behalf Of Marc Guillemot
> Sent: Monday, June 08, 2009 04:43
> To: [email protected]
> Subject: Re: [Webtest] Null Pointer Exception
>
> Hi,
>
> a nested <webtest/>? In fact this should not be allowed. What is your
> used case for that?
>
> Cheers,
> Marc.
> --
> Web: http://www.efficient-webtesting.com
> Blog: http://mguillem.wordpress.com
>
> Jonathan Rosenberg wrote:
> > I'm hoping someone will have some tips on how to work around a 
> > java.lang.NullPointerException I'm
> seeing in a test.
> >
> > I'm thinking the problem is triggered when webtest is trying to restore the 
> > previous response after
> executing a nested <webtest/>.
> > Here are the first few lines of the stack  trace:
> >
> > --- Nested Exception ---
> > java.lang.NullPointerException
> >     at 
> > com.canoo.webtest.engine.WebClientContext.getCurrentResponse(WebClientContext.java:197)
> >     at com.canoo.webtest.engine.Context.getCurrentResponse(Context.java:98)
> >     at 
> > com.canoo.webtest.engine.WebTestException.readUrlCurrentResponse(WebTestException.java:29)
> >     at 
> > com.canoo.webtest.engine.WebTestException.<init>(WebTestException.java:25)
> >     at 
> > com.canoo.webtest.engine.StepExecutionException.<init>(StepExecutionException.java:18)
> >
> > Any thoughts on this?
> >
> > --
> > Jonathan Rosenberg
> > Founder & Executive Director, Tabby's Place
> > http://www.tabbysplace.org/
> >
> >
> >
> > _______________________________________________
> > WebTest mailing list
> > [email protected]
> > http://lists.canoo.com/mailman/listinfo/webtest
> >
>
> _______________________________________________
> WebTest mailing list
> [email protected]
> http://lists.canoo.com/mailman/listinfo/webtest

_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to