Ask a Question

Project Variable Table

Lagencie
Frequent Contributor

Project Variable Table

Hello,

 

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.

3 REPLIES 3
shankar_r
Community Hero

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.


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

AlexKaras
Champion Level 2

Hi,

 

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.

 

Regards,
  /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.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
tristaanogre
Esteemed Contributor

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.  


Robert Martin
[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
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: