Forum Discussion

mima_vasiljevic's avatar
Occasional Contributor
10 years ago

Calculating three values and verifying them


I test a WPF application. I add three values to my applications and application calculate a result of all three (result = 1sr - 2nd + 3rd).

My question is how to verify that result is properly calculated in application.

I'm using a keywords tests for now

9 Replies

  • Marsha_R's avatar
    Champion Level 3
    Where are you getting the values that you enter into the app?  If they are coming from a table or a variable, you can also store the total the same way and then use a checkpoint to compare the app result with your known result.

    If you are generating random values as you go, then when you enter them into the app, also add them into a local variable then compare the app result with the local variable.

    I can give you keyword test syntax if you have a more specific example.

  • Well it sounds like you want to check a lot of values, if you are only manually selecting a few items using the record feature then the test is only going to run a few values.

    The easiest way for you to do this using the Wizard is a Data Driven Loop. Enter some expected results and compare them with the results you get in the application.

    If you want to dynamically generate expected results and then run it against the application you are going to have to write a script for it (Maybe someone here will be kind enough to write one for you)
  • Marsha seems correct.

    If your application is calculating some total value then is the value not output anywhere in the application?

    I think if you are only doing functional testing using Keyword Tests, you will just have to run a series of expected total value outputs using a Data Driven Test and if they are all correct then assume that the program is doing correct calculations.

    Then like Marsha said, check the output result to an expected result.
  • mima_vasiljevic's avatar
    Occasional Contributor

    Hi Marsha and Lee and thank you for giving me tips

    Here are some explanation, hopefully I'll give you a proper answer.

    Our system has predefined products in database - every product has its ID, name and price.

    I enter ID or name by myself and the price will be shown on the screen receipt. If I add another one, it would be added to screen receipt ofc, and the price of that product would be added to price of 1st product. etc...

    I would need to check if that price,on the end, is calculated right.

    I was hoping that I could enter some equation in some property checkpoint(or something similar) of that calculated value and to not use excel tables (with manualy calculated result) etc, (explained in data loops), but if thats only way I'll use it.

    I'm pretty new in this abd still learning...

    I would be very thankful if you give me keyword test syntax if you have enough information :)

  • Ohh I see so it is some kind of shopping application.

    If all your data is already stored in the database then it should be quite easy to export the data into an excel spreadsheet.

    The problem is, Test Complete needs to know which items to click on to then add them to the cart, but we are only talking about comparing output results.

    How are you planning on having Test Complete automate the selection of the items?

  • mima_vasiljevic's avatar
    Occasional Contributor

    I'll think about selection of items later, for now I enter manually 3 items, in a record mode. Need to start from somewhere :)