NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Evaluating TestStand and having a hard time...

Solved!
Go to solution

Hi,

 

I created a step which calls a module (.dll). This step creates an object and stores its reference into a local variable called "ObjectRef".

Here's what i did:

 1. insert step->action: "Action"

 2. specify module

 3. filled the assembly text box

 4. selected the right class

 5. filled the .NET invocation text box 

 6. specified the Value text box to : "Locals.ObjectRef

 

Then, I created another step in order to call the method "getValue" from the object created earlier

Here's what I did:

 1. insert step->action: "Action2"

 2. specify module

 3. filled the assembly text box

 4. selected the right class

 5. filled the .NET invocation text box with  "Use existing object(ClassLibrary.cls604242_00).getValue()"

 6. Specified the Value text box : "Locals.returnValue"

 

At run-time, I would expect to see the value of "returnValue" in the variable panel but I don't. Moreover I'm getting a run-time error message.

 

Could anyone indicate me what I'm doing wrong?

 

As I mentionned in the subject, I'm conducting an evaluation of this product for my company.

 

Thanks

 

Mathieu BAzinet

Download All
0 Kudos
Message 1 of 14
(4,138 Views)

Hi acheo,

 

On your second step, you need to specify your local object reference to be the existing object that should be used to make the call on.  If you click on the "Use Existing" part of the .NET Invocation text, the parameters grid will display the parameters for that call (instead of your second call which is shown in your screenshot), which will just be one parameter that specifies the object reference to use.

 

Also note that you could even add a second call to your first .NET step by typing a '.' after your call to get the "Instance" property and you could call "getValue" directly from there.  The key thing to remember is that the parameters grid only shows parameters for one call at a time, that being the currently selected call which is shown in bold in the Invocation text box.

 

-Jeff

0 Kudos
Message 2 of 14
(4,126 Views)

Hi Jeff,

 

If I add a '.' after the call to get the instance in "Action" (first step), yes it works as youu suggested in your second paragraph.

 

However I don't quite understand the way you do it as explained in your first paragraph. What should I add or get rid off in the .Net Invocation for the second step (Action2)?

 

thanks!

 

Mathieu

 

 

0 Kudos
Message 3 of 14
(4,122 Views)

Yeah my first explanation wasn't very clear, sorry.  You can do the following to correct your second step:

 

1) Click anywhere on the text that reads "Use Existing Object(ClassLibrary.cls604242_000)" in the .NET Invocation control.  This will "select" that call and will cause the parameters grid below it to show the parameters for that call.

2) You will then see one parameter listed in the grid, with a name of "Existing Object".  In the Value column for that row, you should fill in the local variable where your object is stored (Locals.ObjectRef).

 

Basically, you had told the step to use an existing object reference, but you never specified what object reference to use.

 

Another tip is that if you have an error in one of your calls on your step, it will show the text in red in the .NET Invocation control.  So if you haven't specified a required parameter, it will show that parameter in red in the invocation control.  In this instance there was an error with the single parameter on the Use Existing Object call, and you can see in your screenshot that the parameter is displayed in red text.

 

Hope that helps.

 

-Jeff

0 Kudos
Message 4 of 14
(4,120 Views)

Hi Jeff,

 

No luck! Smiley Sad

 

The image I sent you does depict red stuff but here, with getValue selected in the .NET Invocation, there is no error. I also used the check expression for error button and it passed the test.

 

Bascially, I want to store the value returned by the existing object in my local variable returnValue. In C# it would look like:

 

returnValue = ObjectRef.getValue();

 

Any suggestion?

 

matt

 

 

0 Kudos
Message 5 of 14
(4,095 Views)

Hi Matt,

 

Can you attach a screenshot of your step when you have "Use Existing Object" as the selected call?  You need to make sure that call also does not contain an error, because if it does, the next call ("getValue") will not be able to execute.  Like I said before, judging from the red text in that call, you do not have that call's parameters specified properly.

 

-Jeff

0 Kudos
Message 6 of 14
(4,089 Views)

Jeff,

 

Here's the screen shot.

 

Matt

0 Kudos
Message 7 of 14
(4,085 Views)

Hi Matt,

 

I think you misunderstood me.  Could you please click on "Use Existing Object" in the Invocation control so that it becomes the selected call and then post a screenshot of the step?

 

-Jeff

0 Kudos
Message 8 of 14
(4,078 Views)

Sorry..here's the screenshot.

 

matt

0 Kudos
Message 9 of 14
(4,076 Views)

Hi Matt,

 

Like I mentioned before, you need to specify the object reference that the step should use.  This means that in the Value cell for the "Use Existing Object" call you need to put "Locals.ObjectRef" since that is where your first step stored the reference.

 

-Jeff

0 Kudos
Message 10 of 14
(4,072 Views)