Variable is caching the value for each test

Hello All,

I have the below line in my robot test file.
press keys {email_id} {mail_val}

${mail_val} is getting the value from Data.py file. Below is the snippet from Data.py.
mail_val = “Test” + get_random_string(6) + “@mailinator.com

My robot file contains 4 tests, when running the file, test 1 is calling the mail_val and use the email address in the script.
When test 2 is executing , it uses the same email used for test 1 - not creating another email address with get_random_string function.
i want different email address to be used for each test, please help me in achieving this.

That is done only once when the test run starts. You have to transform that into a Python function, or in an User Keyword, or even in an Evaluate step, … or using the Faker library…

1 Like