NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to generate variables while in the sequence editor

I am using property files to load the values for a set of variables.  Currently I must manually create the variables in TS first, so values can be loaded into them.  Over the course of tests new attributes will need to be "modeled" and it would be very convenient to have a the ability to automatically create variables based on the names from the property file. 

 

Is there a way to accomplish this?

0 Kudos
Message 1 of 17
(4,121 Views)

Do you have to load the limits into Locals? It is possible to load limits directly into steps. The Property Loader step has an easy UI to accomplish this.

0 Kudos
Message 2 of 17
(4,100 Views)

mdewar,

 

Where are the datatypes defined?  I'm trying to picture your setup and it sounds like you will just be changing the Property Object file to add elements to a datatype?  Then you want TS to read that in and create the variables for you?

 

How do you originally create the Property Object file?

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 3 of 17
(4,095 Views)

Would you be able to post a link to some documentation which states how to do this.  I'm not stuck on locals, and if this method works, I'll give it a try.

0 Kudos
Message 4 of 17
(4,088 Views)

I have .csv files with the variables info loaded.

My process so far:

1) define the variables for the sequence/sequence file

2) create my test sequence which utilize the variables

3) create a .csv properly file which defines values for the variables

4) In setup, load the properties to setup for the test.

 

What I would like to do is have a tool which creates variables based on what is in the property file so I can skip item 1 above (which becomes more type-oriented error prone as variables are added.

0 Kudos
Message 5 of 17
(4,086 Views)

Sorry I'm still confused here.  What you are describing makes no sense for properly using TestStand.

 

Maybe I can help you find the right solution if I can understand your goal?

 

Do you want to dynamically populate the variables (Locals and FileGlobals) with values?  Or do you want to dynamically create the variables from scratch (i.e. add subproperties to the sequence file) based on some file?

 

Generally what happens is people want an ASCII file (in your case I'm guessing CVS) such that they can change the values of variable so that when TS is executing it will load those values and use them.  In this case NI recommends the Property Loader.  There is an example for this in <TestStand>\Examples.  Open the workspace and look for the PropertyLoader example.  Also, if you google "proprety loader teststand" then you will find various articles which may assist you.

 

When you say "define the variables for the sequence/sequence file"  Are you actually referring to manually right clicking in the sequence file and saying Insert Local?  or are you just saying that you change the value of a variable?

 

Thanks,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 6 of 17
(4,083 Views)

I am using the property file to change the values for variables used in test sequences (normal usage).

 

As there is a one to one releationship between variable names in the property file and the variables created for a sequence, I am looking to avoid manually creating the variables.  I was hoping for some way to have some means for TS to read the files and create the variables for me.

Use case .

 

A test has 15 items which need to be set, each corresponding to a variable.  Many of these may be arrays, with customer types, etc.  Once property file is created, a function is created to "Create variables", which then autmatically creates them in test stand.  These can then be used when createing test steps.

 

The difference here is I need a reference during the creation of a step, in addition to a reference from within a step .

 

 

0 Kudos
Message 7 of 17
(4,078 Views)

Check out the LimitsFromTextFile example. It's in the Examples folder in your TestStand Public directory.

 

On my machine, this is C:\Users\Public\Documents\National Instruments\TestStand 4.2\Examples\PropertyLoader\LoadingLimits\LimitsFromTextFile.

0 Kudos
Message 8 of 17
(4,077 Views)

dynamically creating variables can be tricky in TestStand because you have run-time and edit-time copies. 

 

Also, there is a multitute of TestStand API calls you would need to make in order to get the behavior you want.

 

I will point you to a couple:

Locals.NewSubProperty()  This will insert a new Local variable.  You can read about it in the TS help.

Engine.ReadPropertyObjectFile()  Read about it in TS help.

ProprtyObject.Clone() Read about it in TS help.

 

I don't know that there is a tutorial or example out there that straight up does what you are looking for.  This seems to me to be kind of a crazy use case because generally in order to use variables they are already created.

 

I still don't know how you are creating the property object file.  Generally in order to create it you already have to have the variables created.

 

 

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 9 of 17
(4,072 Views)

I'll check out the docs. 

I create the files by hand, then the variables separately.

 

thanks,

m

0 Kudos
Message 10 of 17
(4,062 Views)