Forum Discussion

SK2020's avatar
SK2020
Occasional Contributor
4 years ago
Solved

mathematical operations with variables in KeywordTesting

Hi,

In my project I need to subtract two values to compare with another value.

My problem is how to subtract two values (or add, or any other simple mathematic function)

I have created two variables which store my values. And I need make an addition or subtraction and need to create a new variable for the result. After that I will compare the result with another variable for verification.

Which method or operation should I use? (I'm creating test cases with keyword tests)

Please can you help me on this issue.

Thank you.

  • Use Set Variable Value (lots of screenshots to follow)

     

    first pick your result variable out of the list

     

     

    then Next and choose Code Expression, then select your first variable, enter a +, then select your second variable

     

     

    You will end up with this

     

    Click OK and then Finish and you will see this in your test

     

     

     

3 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    Use Set Variable Value (lots of screenshots to follow)

     

    first pick your result variable out of the list

     

     

    then Next and choose Code Expression, then select your first variable, enter a +, then select your second variable

     

     

    You will end up with this

     

    Click OK and then Finish and you will see this in your test

     

     

     

  • Mathernee's avatar
    Mathernee
    Occasional Visitor

    An algebraic expression is a collection of numbers, variablesoperations, and grouping symbols. You will translate an unknown number as the variable x or n. 

    The grouping symbols are usually a set of parentheses, but they can also be sets of brackets or braces.

    In translating expressions, you want to be well acquainted with basic keywords that translate into mathematical operations: addition keywords, subtraction keywords, multiplication keywords, and division keywords .

     

     

     

     

    iMessage for PC