Ask a Question

Import/Export variable lists

Import/Export variable lists

We would like to be able to share variables lists from all levels without having to share project files or add them all in manually.

 

If I export my project variables, then my colleagues should be able to import the resulting list and have it be merged with theirs.

17 Comments
Marsha_R
Champion Level 2

Having to enter a long list of project variables is tedious when we need to combine or split up projects and we need the variables duplicated.  It would be helpful to be able to get some or all of the project variables and add them in somewhere else.

NisHera
Valued Contributor

I would like to have export method on project variables. (mey be to a .cvs file)

so that those could be sent to other projects or preserve previous values

cunderw
Community Hero

Why don't you store the data you need in an excel sheet?

Marsha_R
Champion Level 2

We do use Excel if we are reading in a lot of data, but I shouldn't have to go to all that trouble to share a single value between tests.

MKozinets
Staff
Status changed to: Accepted for Discussion
 
cunderw
Community Hero

It would be very simple to also write a script that will do this.

 

You can loop through the number of variables you have and output their name, type and value into a file, then read them back in another project to add them. 

 

Very rough psuedo code.

function outputVars() {
   var count = Project.Variables.VariableCount;
   var name, type,value;
   for(var i = 0; i < count; i++){
      name = Project.Variables.GetVariableName(i);
      value = Project.Variables.VariableByName(name);
      type = Project.Variables.GetVariableType(Project.Variables.VariableByName(name))
     //code to write to file
   }
}

function insertVars() {
   //code to open file
  for(lines in file) {
    if(!Project.Variables.VariableExists(varNameFromFile){
      //add var and type
   }
   //set var value etc..
  }
}
Marsha_R
Champion Level 2

Good, now SmartBear can use that script to implement it.  🙂

vatbub
Contributor

Hey guys,

just for reference:

SmartBear just launched a coding contest to face just that problem 🙂

https://community.smartbear.com/t5/General-Discussions/Code-Contest-Export-Importing-Project-Variabl...

 

Regards,

vatbub

mgroen2
Super Contributor

Having to work with a big amount of variables, which I now have to type in manually one-by-one, I thought this process would go much faster if TC would support importing if variables lists (also parameter definitions) from external files, like Excel, CSV, txt.

 

Ravik
Super Contributor

 Hi ,

 

About which variables you are talking, ProjectSuite/Project or local variables ??

 

Announcements
Welcome to the TestComplete Feature Requests board!

Here you can review submitted feature requests and vote up the ones you like! If you can't find the feature you want - go ahead and suggest your own idea. Ideas with the highest rating can be implemented in the product.

Check out the Create a Feature Request guide for more information.
New Here?
Welcome to the Community
Sign Up Here