Project Variable Table
I have a question is there a way to create a permanent Table as Project Variable?
I know there is a way to create tables as ComponentTable during runtime with this code:
if Project.Variables.VariableExists("ComponentTable"): # Get a reference to the variable t = Project.Variables.VariableByName["ComponentTable"] else: Project.Variables.AddVariable("ComponentTable", "Table") t = Project.Variables.VariableByName["ComponentTable"]
But this way I have to always fill it during runtime and I want it to be filled with fixed values - on Project Variable Layer, not on Keyword Test Layer, where I can create tables.
Persistent variable does not have an ability to store table type. Instead of what you can do, OnStartTest event handler you can just add the script that you mentioned. It will create that project variable whenever you start to run.
Yes, @shankar_r is correct. Only Temporary variables of Table type can be created via code and those variables do not preserve their contents/structure created/modified from code.
/Alex [Community Champion]
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
If you need something in a table to persist, my suggestion would be to create some sort of external file to read/write to. Or an SQL database.
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider