Storing variabels after reading them from a page.

View: New views
3 Messages — Rating Filter:   Alert me  

Storing variabels after reading them from a page.

by Niels Stevens :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi all,

 

I’ve been searching the manual for this, but don’t really see the functionality I need. Here is the problem: In a basket I need to check if the functionality to change the number of products to order works. To do this I want webtest to read the price, then change the number, then read the price again and check if it has been multiplied by the number selected. So I need a way to store variables after reading them from a page (no idea),  and a way to multiply and compare these variabeles (I think this might work in the ifstep test).

 

Regards,

 

Niels Stevens

Jr. Developer


RE: Storing variabels after reading them from a page.

by David Jehoul :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi Niels,

 

What I do is the following:

- read from the page: storeXpath; using this you can store the value in a property. E.g.
<storeXPath

      description="get the price "

      xpath="<xpath expression to get your price>"

      property="price_before"

/>

 

The property price_before contains the price.

 

- Now you change the number (=theNumber; e.g. 5).

 

- read you price again

<storeXPath

      description="get the price "

      xpath="<xpath expression to get your price>"

      property="price_after"

/>

 

- compare

<verifyXPath

      xpath="number(#{price_before})*5 = number(#{price_after})"

/>

 

- remark that you can also assign 5 to the variable by doing

                        <var

                              name="theNumber"

                              value="5”

                        />

 

- then you can make the compare statement

<verifyXPath

      xpath="number(#{price_before})*number(${theNumber}) = number(#{price_after})"

/>

 

 

-----Original Message-----
From: webtest-admin@... [mailto:webtest-admin@...] On Behalf Of Niels Stevens
Sent: vrijdag 16 oktober 2009
9:51
To: webtest@...
Cc: Dirk van Zonhoven
Subject: [Webtest] Storing variabels after reading them from a page.

 

Hi all,

 

I’ve been searching the manual for this, but don’t really see the functionality I need. Here is the problem: In a basket I need to check if the functionality to change the number of products to order works. To do this I want webtest to read the price, then change the number, then read the price again and check if it has been multiplied by the number selected. So I need a way to store variables after reading them from a page (no idea),  and a way to multiply and compare these variabeles (I think this might work in the ifstep test).

 

Regards,

 

Niels Stevens

Jr. Developer


RE: Storing variabels after reading them from a page.

by Niels Stevens :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

This should work, will try on Monday. Thx a lot!

 

Groeten,

 

Niels Stevens

Jr. Developer



logosoftlution250pix

Making eBusiness profitable


T: +32 (0)11/565.012
F: +32 (0)11/201.884

website:
www.softlution.com


 

Van: webtest-admin@... [mailto:webtest-admin@...] Namens David Jehoul
Verzonden: vrijdag 16 oktober 2009 13:43
Aan: webtest@...; Niels Stevens
Onderwerp: RE: [Webtest] Storing variabels after reading them from a page.

 

Hi Niels,

 

What I do is the following:

- read from the page: storeXpath; using this you can store the value in a property. E.g.
<storeXPath

      description="get the price "

      xpath="<xpath expression to get your price>"

      property="price_before"

/>

 

The property price_before contains the price.

 

- Now you change the number (=theNumber; e.g. 5).

 

- read you price again

<storeXPath

      description="get the price "

      xpath="<xpath expression to get your price>"

      property="price_after"

/>

 

- compare

<verifyXPath

      xpath="number(#{price_before})*5 = number(#{price_after})"

/>

 

- remark that you can also assign 5 to the variable by doing

                        <var

                              name="theNumber"

                              value="5”

                        />

 

- then you can make the compare statement

<verifyXPath

      xpath="number(#{price_before})*number(${theNumber}) = number(#{price_after})"

/>

 

 

-----Original Message-----
From: webtest-admin@... [mailto:webtest-admin@...] On Behalf Of Niels Stevens
Sent: vrijdag 16 oktober 2009 9:51
To: webtest@...
Cc: Dirk van Zonhoven
Subject: [Webtest] Storing variabels after reading them from a page.

 

Hi all,

 

I’ve been searching the manual for this, but don’t really see the functionality I need. Here is the problem: In a basket I need to check if the functionality to change the number of products to order works. To do this I want webtest to read the price, then change the number, then read the price again and check if it has been multiplied by the number selected. So I need a way to store variables after reading them from a page (no idea),  and a way to multiply and compare these variabeles (I think this might work in the ifstep test).

 

Regards,

 

Niels Stevens

Jr. Developer

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.421 / Virus Database: 270.14.20/2440 - Release Date: 10/16/09 06:32:00