|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
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.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. 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-----
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.This should work,
will try on Monday. Thx a lot! Groeten, Niels Stevens Jr. Developer
Making eBusiness profitable
Van:
webtest-admin@... [mailto:webtest-admin@...] Namens David
Jehoul 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.
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----- 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. |
| Free embeddable forum powered by Nabble | Forum Help |