Forum Discussion
I don't see a process in that document that details how to convert and/or create Data Driven Loop variables as Project level variables. I have read most of the support documentation and what I have found on Google and I still can't figure out the best route. Is this possible?
- vondie10 years agoContributor
Maybe I am not being clear on what I am trying to accomplish.
Data Driven Loops in Keyword Tests create Local Variables in a project (my example in the attachment) for each column and the data within each row of a column. I want to take these variables and compare them to variables in a separate Script Routine (Python). Currently, I am unable to make this work because they are all considerd "Local" to the Keyword test. I have read all of the attached support documents and cannot find how to take the variables created from a DDL and compare them in a separate test.
Thanks for your help! Any advice or best practice suggestions are appreciated.
vondie
- Marsha_R10 years agoModerator
I see the confusion. "Local Variables" is being used two different ways. The variables being used to reference the DDT data are not accessible outside the loop. Other variables can be defined for use inside the whole keyword test (local variables) or the whole project (project variables).
What does the script routine need to accomplish? Can you not put it inside the loop? That way you would have each set of data accessible as the loop progresses.
- joseph_michaud10 years agoModerator
I think if you set up the Project variable as a DB Table variable, you can access it by a script routine, and from both within your data loop, and after your data loop. I just tried this with a simple CSV data file.
Inside the data loop, I called a script routine which directly referenced the current loop values
Sub Inside Log.Message(Project.Variables.Var1.Value(Project.Variables.Var1.ColumnName(0))) Log.Message(Project.Variables.Var1.Value(Project.Variables.Var1.ColumnName(1))) Log.Message(Project.Variables.Var1.Value(Project.Variables.Var1.ColumnName(2))) End Sub
After the data loop, I called a script routine which reset the DB Table variable and reread the CSV file:
Sub Outside Project.Variables.Var1.Reset() While Not Project.Variables.Var1.IsEOF Log.Message(Project.Variables.Var1.Value(Project.Variables.Var1.ColumnName(0))) Log.Message(Project.Variables.Var1.Value(Project.Variables.Var1.ColumnName(1))) Log.Message(Project.Variables.Var1.Value(Project.Variables.Var1.ColumnName(2))) Project.Variables.Var1.Next() Wend End Sub
Seems to work. I see the values from the CSV file in the right places in the test log.
Related Content
- 2 years ago
Recent Discussions
- 20 hours ago
- 20 hours ago
- 5 days ago