Forum Discussion

Jim_Taylor_3rd's avatar
Jim_Taylor_3rd
Occasional Contributor
15 years ago

Checkpoint - Verifying Calculations with an equation

 Is it possible to set a check point in a data-driven loop to verify that an on-screen value relates acurately to other on-screen values via an equation?  For example -  the value of the Total Charge Field = Value of Price Field - Value of Discount Field + Value of Tax Field + Value of Shipping Field?  



I looked through help and searched here, but did not find anything, though I just may not be searching on the right terms.





3 Replies

  • Jim_Taylor_3rd's avatar
    Jim_Taylor_3rd
    Occasional Contributor
    Additional information:

      In this loop, I provide the item number and quantity.   The system uses these to determine the price, discount, etc.  I want to just verify that the final calculations are correct.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    In script code, you can do it like so:





    PropertyTestValue = aqConvert.IntToStr(aqConvert.StrToInt(Object1.Value) + aqConvert.StrToInt(Object2.Value))

    aqObject.CheckProperty(MyObject, "MyPropertyName", cmpEqual, PropertyTestValue)




     
  • irina_lukina's avatar
    irina_lukina
    Super Contributor

    Hi Jim,


    There is one more approach. You can create a data storage (for instance, an Excel file), that will store the correct values of the Total Charge field. After that, you can use the data-driven loop to extract the values one-by-one from the Excel file and compare the current value of the field with the stored baseline copy.


    For more information, refer to the Data-Driven Testing With Keyword Tests tutorial.