TestProject Forum
Powered by leading experts in the test automation community

Comparison on value in two different activities within the app

Hi there, I have a scenario that i would like you to help me with, I have a situation where by i have to compare two values on two different activities within the app, One on the Home Screen and the other in another activity, these two values are meant to be the same and equal, thats the purpose of the Comparison, how best may I and Can I achieve this, been trying but seems have no lack

Hi Haggai!

Here’s a step-by-step tutorial for comparing values from different application activities :slight_smile:

  1. First please use the Element action “Get text” to first element and save it’s value to input parameter.
  2. Use the “Start activity” Action to switch to another activity
  3. Then again, use the Get text from the second element to new input parameter
  4. Use the Action “Compare two strings” and compare this two inputs you have from the elements

Please tell me if you will need more help with this :slight_smile:
Have a great day!

1 Like

This would have worked if the Value is constant, But this value unfortunately keeps changing dependant on some factors for it to keep changing value and keeps changing when the factors are satisified, either goes up or goes down, storing the value in a parameter means that this value is the same and does not change at all and hence this solution wont be the best, this means that if the stored value is changed after satisfying some factors and condition, the test will always fail if the value is changed and different from the saved value

If this value remains the same during 1 test execution, then you can you Test Parameters.

Here's small example

To create a Test Parameter

And use it to save the value

The value saved in this parameter will automatically cleans after test execution, but you’ll be able to see what was the values in Test Reports.

Is this helpful for you?
Or you mean that value can be changed many times even within 1 execution?

1 Like

The Value is changed from the API and displayed from the App, and yes the value changes many times even in 1 execution, it is not a static value

Is it possible for you to take values from API directly?

We have an add-on to make requests.

its not possible as yet, the only read permission to the API is through the APP, and not Third Party, though i would love to give it a try, what is the name of that add-on

And what if make it reversed? I mean, first, take the last value (from activity #2) and then get back to activity #1 and compare? How often the value can be changed? Is there any specific time, or it a random?

The Value Changes like a temperature guage, or a speedometerm when something happens within the test, the value changes, so its always changing, and thats what i mean here

Then what is the goal of comparison?
You want to catch 2 values at the same moment and validate that they are equals?

The Goal is to always make sure, when these values change at any one time, they should always be the same values, if its 10 in one activity, should be 10 in the second Activity, if a change happens again to say 45, yes this should be the same for both activities, and this test is meant to capture that