NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I check a constructor return value in TestStand?

How can I check if the Constructor (selected in the Configure Class Constructor dialog box) was called and what it returned?

 

THANK YOU!!!

0 Kudos
Message 1 of 4
(3,124 Views)

Hi,

 

As i learned in C++ there is NO retrun code in Contstructor at all !

Otherwise you have defined a memberfunction.

 

To check if your constructor has been called.

Set a Localvariable via SequnceContext. The Context should be a

parameter in your Contructor. Or better store in ReferenceObject

to the created class in TS contructor options.

 

 

Hope this helps

 

Juergen

 

 

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 2 of 4
(3,113 Views)

Thanks! Yes, you are right, the constructor does NOT return anything, I learned that in C++ as well 🙂

What I am trying to figure out now is the following,

 

I loaded a .Net dll, I selected my class, I checked off "CreateObject" box. I selected a Constructor to be called. I created a local variable of type Object Reference and put it in the Object Reference field. I called a method of the class. So, this step got executed.

 

From C++ we also learned that when you call a constructor, an instance of that class gets created (or an object). You then use that instance to call other methods of that class. Correct?

 

Moving on to the next step in the TestStand sequence.  I want to call another method of the same class, but in this case, I already created an instance of that class (supposedly, by checking off CreateObject box and having a local variable of type Object Reference in the Object Reference field in the first step). Now, all I would have to do is load that same .dll, select the same class, select the same local variable of type Object Reference as I specified in the first step and call the second method of that class. Right? I don't have to create an instance of that class because I want to use the same instance I created in the first step, BUT it is NOT working. It is telling me I don't have an instance and I am not creating an object, so it knows nothing about me creating an instance of that class in the first step. WHY NOT?

0 Kudos
Message 3 of 4
(3,097 Views)

Hi,

 

Of course you are right.  

BTW have you ever looked on the  TS computer example ?

It is the "HelloWorld" of TS

 

You will find it under:

ProgrammFolderNI  \TestStand 4.0\Examples\Demo\DotNet

 

Greetings

 

Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
Message 4 of 4
(3,068 Views)