Forum Discussion

mima_vasiljevic's avatar
mima_vasiljevic
Occasional Contributor
9 years ago
Solved

Subtraction of two variables

Hi guys,
I have one simple question (or I think it is a simple at least...) but seems like I cant find anywhere some solution.
In my application I need to subtract two values and then to check that result with specific field.
My problem is how to subtract two values (or add, or any other simple mathematic function)

My variable_1 is a radnom number as well as my other variable_2 (both values are generated during test run). My next step would be: variable_1 - variable_2 = Result (and then compare Result to a text field value).
Which method or operation should I use? (I'm creating test cases with keyword tests)

Can you please help me?


  • You can use Set Variable Value to get your variable Result and then use Compare Properties to compare the variable Result to your text field on screen.  

     

    See attached screenshots.  I used a mix of project and local variables but use whatever you need.

2 Replies

  • djadhav's avatar
    djadhav
    Regular Contributor

    How are you generating the random numbers? Are the variables project variables?

    • Marsha_R's avatar
      Marsha_R
      Champion Level 3

      You can use Set Variable Value to get your variable Result and then use Compare Properties to compare the variable Result to your text field on screen.  

       

      See attached screenshots.  I used a mix of project and local variables but use whatever you need.