12-09-2007 02:33 AM
I am having trouble getting a sequence to work when I re-use the steps inside a sequence multiple times. I am a pretty experienced user of TestStand, but this is really bizarre and I cannot figure out what the problem is.
I will try and explain the problem using an example sequence file, but you will not be able to run it because the steps in the file call a .NET assembly which is proprietary software at Cummins.
In the sequence My_Connect, it can be seen that an object of a .NET class is being created and then the reference to the created object is being used to call a certain method of the class (Connect). If I execute the My_Connect sequence, since I am calling the Connect method TWO times, I see the expected behavior on our application.
However, if I make the RunMode of the last two steps (basically the second connect steps) as “Skip”, and then call My_Connect from the sequence Call My_Connect two times, the behavior of the My_Connect sequence is different in this case. Should it not be the same as before? All I have done differently is that I have re-used the same steps of the sequence (the first two) rather then executing multiple copies of the steps.
The only thing that explains the reason why in the second case I do not get the desired behavior is: For some reason, in the second call to the sequence My_Connect, a new object is not being created and the call to the Connect is operation on the first object that was crated during the first call. I have no idea why this would happen, but it sure seems like this is what is happening. Everytime I run this in debug mode to make sure that the .NET methods are not throwing an exception.
At one point, I was thinking that its possible that there might be a bug in the Connect method of our application which is causing this. However, I replicated this same stuff in a VB script and it worked from there.
Any help will be greatly appreciated..
12-09-2007 04:49 PM
12-10-2007 01:31 PM
12-10-2007 01:47 PM
12-10-2007 02:07 PM
12-10-2007 02:13 PM
12-10-2007 02:49 PM
Doug,
The difference in behavior I am referring to is the behavior of the application I am interfacing to. Everytime a Connect method is called with a new object reference, I am supposed to see a new "Client" pop up in the application monitor. This is the desirable behavior, so at the end of two calls (with unique objects), I see two clients in the application monitor. When I call the sequence multiple times from Call My_Connect, during the first call, a Client is connection is opened, however, during the second Connect call, a new Client is NOT opened, so I end up with only one client.
In my initial work, I was actually using different variables (and that too StationGlobals) for storing the references of individual calls. And I was ensuring that each call was using the right variable it was supposed to use. To simplify things, I had gone to the use of a local variable. However, the difference that you've pointed out does make sense and could be the problem. But the fact that it did not work when I was using completely differnet StationGlobal variables for each connection tells me that this is not the root cause of the problem.
I've not been releasing any references after opening them up. The reason is, once the reference is created, I want it to remain open for further use of other methods.The refernece is released when someone calls the "Disconnect" method. Because, I want the reference to remain open and live for further use, that is why I was using a StationGlobal variable for it (because StationGlobal values hold after the sequence execution)
I think my last resort at this point, as you suggested, is to debug into our application code and find out if TestStand is sending unique references for the successive calls as it is supposed to or not. Unfortunately, I don't own that application and only interface to it. I also don't have visual studio .NET installed on that machine where I do this testing. So, it may take me some time to get to that point (getting together with the application owners and finding another test machine). Before I go to this extent, I might explore some alternative approaches.
I will keep you updated on my progress.
12-10-2007 03:07 PM - edited 12-10-2007 03:08 PM
12-10-2007 03:21 PM
Hmm...I never paid attention to this option..
Sounds like you are fairly confident that this is what my problem is. I will get to try this later tonight and will let you what I find out...(can't wait..:)
12-10-2007 03:38 PM