NI TestStand

Showing results for 
Search instead for 
Did you mean: 

How to use return value from TestComplete ( using COM) as a variable in the conditional statement (e.g. while loop) in TestStand

Go to solution



I have setup a COM interface for TestStand(TS) to run certain scripts in TestComplete (TC).  Normally, when TestComplete finishes executing the script, it returns a 0 or 1 to denote pass/fail in the TestStand step (e.g String value test step).  This worked fine.


However, now I need TestComplete to return a vaule( e.g 32) to TS, and TS need to evalue this value in a while statement. So if TC return value is 32, I'd have some statement in TS ike :                                                                                                 


While (return value != 30)

Do something..




0 Kudos
Message 1 of 8

There are a hundred ways to implement what you are asking.  The hard part is deciding which one would be the best for you.


What adapter are you using to communicate with TestComplete?  ActiveX?  Is TestComplete running asynchronously (in parallel)?  If so then how is the data getting back to TestStand?


So here are some options:

1. You can use the While Step type.  It's in the Flow Control folder in your Step Types pallette.  Look in your examples under UsingFlowControlSteps.seq in the SequenceFlow

2. You can loop on a step and have the termination for the loop be (return value == 30).  Look in the Step Properties under Looping.  Also in the TestStand help

3. You could do Post Actions based on a condition and have it jump to another step.  Read about it in the TestStand Reference Manual.

4. You could use a GoTo step.  I don't really recommend this one.  It makes code hard to maintain.  Also an example in SequenceFlow called gotobeep.seq.


Hopefully this gets you thinking.  Let me know if you have specific questions about any of these methods.




~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 8

Thanks Jigg. This worked!.  I used the statement Parameters.Result =="32" in a IF statement to evaluate the return value from TC.


However, now I need to send back another value from this called sequence file to the calling sequence step within TestStand. How can I do that? 

Do I need to create new parameter or locals in the tab of calling sequence step? Everything is empty now.



0 Kudos
Message 3 of 8

Parameters are the best way to pass data to and from sub sequences.


However, is the sequence running in a new thread?  Then you may want to use a queue or notifier.

~Will work for kudos and/or BBQ~
0 Kudos
Message 4 of 8
Accepted by topic author ph2



No, the program is not running a new thread.  It's just a single sequential thread. It calls other sequential files and that's it.


I think I'm having some luck using the StationGlobal.  It appears to be working (e.g setting the StationGlobal in one sequence file automatically updates the Stationglobal in another sequence file, kind of like passing the value by reference)





0 Kudos
Message 5 of 8


I tried to start a script using TestStand and TestComplete ActiveX but without success.

I have TestStand 2013 and TestComplete 11.


May you please send me the TestStand Sequence that starts your TestComplete script and retrieve the data ?


Best regards,

Armindo PINTO

0 Kudos
Message 6 of 8
Hi, Please see attached. Regards, ph2
0 Kudos
Message 7 of 8

I don't see attached.

~Will work for kudos and/or BBQ~
0 Kudos
Message 8 of 8