NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding additional result programmatically

Relatively new to TestStand, and struggling with a problem.

 

I want to "scan" a test sequence, and for every step in the sequence where the name starts with a 4 digit number (i.e. "0400 - Measure...") i would like to add an additional result with the name "StepNumber" and the value being the specific 4 digit number. I'm assuming that i should use calls to the TestStand API, but my experience with this is almost non-existing, so any advice on where to begin would be greatly appreciated.

0 Kudos
Message 1 of 8
(5,958 Views)

Is this a tool that will run independently of TestStand?  Or will it run every time the sequence file is executed?  Or is it something you just need to do once?

 

If it's a one time thing then you can select all of the steps that have the 4 digit number and modify them all at once in the sequenc editor.  With them all selected choose the Additional Results category on the Properties tab.  Then put "StepNumber" in the Name column and put Left(Step.Name, 4) in the Value to Log column.

 

If you want to do it through the API then you would use:

Step.AdditionalResults.Insert("\"StepNumber\"", "Left(Step.Name, 4)", "True", PropFlags_IncludeInReport, 0)

 

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 2 of 8
(5,936 Views)

Thank you for the reply.

 

It  will not be necessary to have it run every time the sequence file is executed. What I am really trying to achieve is, that when i am done writing a test sequence i want to fill in the additional results as written in my original post, as easily as possible. I am just unsure how to do this. If there is a good way of doing this as an independent tool, that would be great.

 

I guess the option of selecting all of the steps and configuring them simultaneously would work, but usually our test sequences will consist of 10-15 subsequences, so i would have to do it for all of them.

0 Kudos
Message 3 of 8
(5,897 Views)

I threw this together really quickly to demonstrate how to do this dynamically.  It would be better if you made a Tool in the Tools menu and used RunState.InitialSelection (read about it in the help).

 

However, this example will work for ALL sequence files that are open, including itself.  It only doe the Main_StepGroup of each sequence and it doesn't check to see if there was already an additional result that matched the first 4 characters.  So if there already is one it will now have 2.

 

It's something to get you started though.

 

Let me know if you have questions.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 4 of 8
(5,875 Views)

Thanks alot. I will take a look at it, and get back to you if i have any questions. 

 

EDIT: We are only using TestStand 2012 in my company. Can you re-compile it to an older version?

0 Kudos
Message 5 of 8
(5,810 Views)

2010

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 6 of 8
(5,799 Views)

Jiggawax,

 

Can you save this sequence file in Test Stand 2013?  I can't open it up.

 

Thanks!

0 Kudos
Message 7 of 8
(5,522 Views)

Nevermind, I see your repost above.  Thanks!

0 Kudos
Message 8 of 8
(5,521 Views)