cancel
Showing results for 
Search instead for 
Did you mean: 

Project Variable Table

Highlighted
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
Community Hero

Re: Project Variable Table

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

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


Extension Available

Community Hero

Re: Project Variable Table

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 Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Community Hero

Re: Project Variable Table

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
[Community Expert Group]
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.


I’ll be talking about “Hidden Treasures – TestComplete Script Extensions” at #SBConnect in October! Who’s joining me? Click here for tickets
Extensions available
Top Kudoed Authors
Are You In?

Meet the Community Leaders!

SmartBear Connect is an excellent opportunity for training, in-person support, and networking.

GET YOUR TICKET WITH $100 OFF