Accessing Local Variable from a Data Driven Loop for Run Script Routine
Hi everyone! I couldn't find any other posts that were attempting what I am trying to accomplish.
My team's end goal is to have tests that do not need to be updated one by one for each test.The majority of our tests are being created as Keyword Tests and we are using the Run Script Routine Test Action for checkpoints (writing scripts in Python). What I am hoping to do to accomplish this goal is create a Data Driven Loop within the Keyword test, add the data from a CSV file, then reference these values in the Script Routine for comparison.
Example: We are using a system that adds clients. There are fields for Client Name, Client Address, Client Phone Number, etc. I have a CSV file containing 5 rows of data to loop through so it will add 5 clients. I added the Run Script Routine Test Action to the end of the test, outside of the loop. My current issue is that I cannot access these variables within the Script Routine because they are considered Local Variables. I want to have a variable within the script routine that would take the value from the Keyword test it was called from.
I have not been able to figure out how to make this work. I want to do DDT so we can swap out the CSV files easily without having to go back and edit a bunch of variable values. Any help is appreciated.
Thanks!
I figured it out, and in hindsight it was pretty simple.
The syntax looks like this:
"KeywordTests.Test_Name.Variables.DDL_Data["textboxClientName"]"