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: [email protected] [mailto:[email protected]]
On Behalf Of Niels Stevens
Sent: vrijdag 16 oktober 2009 9:51
To: [email protected]
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

Reply via email to