Hi. I want to update a numeric local variable every time I run the test, increasing its value by 1 and storing the new value into the same variable. How can that be done? An example would be very useful!!
Thanks!
Hi. I want to update a numeric local variable every time I run the test, increasing its value by 1 and storing the new value into the same variable. How can that be done? An example would be very useful!!
Thanks!
The scope of a local variable is limited to the test case (or block of code) within which it is declared. In other words, a local variable has no access to what happens outside of its scope. Therefore, trying to increment a local variable based on the number of times the test case within which it was declared was run is not possible (it will always get re-initialized each time you run the test case).
However, you can store/increment this value in a larger scope using either:
1.) A global variable
2.) Test data
Brandon, thank you. I tried with a Global Variable and it worked perfectly.
can u pls tell me wer to add this condition
Just as I said: