Hi,

"," is not good for numbers in scripts

Why do you need a script for this purpose? What about following:

<verifyXPath xpath="number(translate('#{accountBalanceNew}', ',', '.'))
- number(translate('#{accountBalance}', ',', '.'))" text="0"/>

(not sure if 0 is converted to "0" or "0.00" here, you have to check)

This is shorter and would give you a better feedback when it fails.

Marc.
-- 
Blog: http://mguillem.wordpress.com


Alexander Mannsfeld wrote:
> Hi there,
> 
> I'm using webTest at the moment to validate our payment-service; the
> functionality works meanwhile.
> 
> Within the property "accountBalance" is the amount the user had within
> his deposit before and in "accountBalanceNew" after he had paid in. At
> the moment the amount he is paying in is fixed, forthis is the
> JS-variable "amount_dep".
> 
> The JS-snippet's mission is to fetch the two webtest-properties and
> store them into JS-variables - substract them from each other and
> finally substracts from this the amount the user has deposited.
> 
> When this is equals 0 the deposit has worked as it should >
> amountDiffers false. Within the following "not"-step the value is
> validated....
> 
> My problem: it doesn't work and at the moment I'm not sure if it's me,
> JS or Webtest. Btw, the values have been aggregated by using
> "storeRegEx" and are delimited by a comma(like 120,00).
> 
>          <scriptStep description="Calculate if deposit amount is
> correct" language="javascript">
>                 amount_diff=0;
>                 amount_old=0;
>                 amount_new=0;
>                 amount_dep=10;
>                 amount_new=step.webtestProperties.accountBalanceNew;
>                 amount_old==step.webtestProperties.accountBalance;
>                 amount_diff=amount_new-amount_dep;
>                 if(amount_diff-amount_old==0) {
>                         step.setWebtestProperty('amountDiffers', 'false');
>                 } else {
>                         step.setWebtestProperty('amountDiffers', 'true');
>                 }
>          </scriptStep>
>          <not>
>                 <verifyProperty name="amountDiffers" text="true" />
>         </not>
> 
> Thanks a lot,
> 
> cheers,
> 
> Alexander
> 

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

Reply via email to