NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

A few clarifications on teststand api

Solved!
Go to solution

Hello fellow TS enthusiasts,

 

I have a few clarifications regarding the TS api. My requirement has it that I have to design a simple TS api interface as a .net library which will take a sequence file path as a parameter and execute the test and return whether the tests have passed. However, I have a few challenges with activeX as AX runs properly in windows forms as a UI control which is basically branched out and running in parallel with the UI through connectcommand. I cannot set the ocx state as well because of the class library not being a windows form type (Then again, I am not sure if it even makes sense to make my class library inherit from windows forms).

 

Here is a bit of code:

  //Init
  axApplicationMgr = new NationalInstruments.TestStand.Interop.UI.Ax.AxApplicationMgr();
  axSequenceFileViewMgr = new NationalInstruments.TestStand.Interop.UI.Ax.AxSequenceFileViewMgr();
  System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TestStandExecutorApi));

  ((System.ComponentModel.ISupportInitialize)(this.axApplicationMgr)).BeginInit();
  ((System.ComponentModel.ISupportInitialize)(this.axSequenceFileViewMgr)).BeginInit();
           
this.axApplicationMgr.Enabled = true; this.axApplicationMgr.Name = "axApplicationMgr"; ((System.ComponentModel.ISupportInitialize)(this.axApplicationMgr)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.axSequenceFileViewMgr)).EndInit();
axApplicationMgr.Start(); axApplicationMgr.OpenSequenceFile(path); axSequenceFileViewMgr.GetCommand(CommandKinds.CommandKind_RunCurrentSequence).Execute(true);

Am I doing something or everything wrong?

 

Kindest regards,

a dumfounded fellow programmer.

0 Kudos
Message 1 of 3
(3,137 Views)
Solution
Accepted by topic author newbieprogrammer

If those are your requirements then your work is already done.  Take the C# UI that ships with TestStand and call it from the command line and use flags.  Technically you have all the source code for that UI.

 

https://zone.ni.com/reference/en-XX/help/370052W-01/tsfundamentals/infotopics/startup_opt/

 

Also this:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P9lvSAC

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 2 of 3
(3,046 Views)
Solution
Accepted by topic author newbieprogrammer

Just for the benefit of the community, I managed to get everything working as I needed. Thanks for the pointers Jiggawax. 

 

I could instantiate the activeX controls using .createControl() to forcibly create an instance and then use the getengine() method to get execution engine and then, pass the sequence file and model for the execution to create an instance of the execution. 

0 Kudos
Message 3 of 3
(3,030 Views)