02-16-2009 02:12 PM
I am using batch parallel mode. It's easy enough to terminate or abort all executions from SequenceFilePostStepRuntimeError using IEngine.TerminateAll() and .AbortAll(), but I would like to be able to set an error on all my running executions and cause them to run cleanup when I encounter an error on ANY of the test socket executions.
Anyone have an example of how I might do this?
Thanks,
Jake
02-17-2009 12:42 PM
I did something like this for a failure handler once... and looking through my code I think the biggest headache is to realize that one execution socket has no easy way of seeing the execution references for other sockets. These things are kept by the process model's top level execution... which you also don't have a super easy time accessing without tweaking some logic in your Model file.
(1)Somehow or another you want to get access to the "TestUUTs"/"SinglePass" Fileglobals.TestSocketExecutions[] array and make use of it in your classic RuntimeError callback. The easiest solution (but not the most elegant) would be to edit your model to copy/clone the file global into someplace more convenient... ie "TestUUTs - TestSocketEntrypoint".
(2) in your error callback, handle your error as usual i.e. tell top level sequence to go to cleanup etc. but also loop through the other execution references and do some variation on GetSequenceContext() and setting Runstate.sequenceErrorCode and the rest. The example api calls below are probably overkill...
Locals.currentExeContext=Locals.currentexecution.AsExecution.GetThread(0).GetSequenceContext(0, Nothing)
Locals.currentExeContext.AsSequenceContext.SequenceErrorCode=Locals.RecievedError.Code,
Locals.currentExeContext.AsSequenceContext.SequenceErroroccurred=Locals.RecievedError.Occurred,
Locals.currentExeContext.AsSequenceContext.SequenceErrorMessage=Locals.RecievedError.Msg,
Locals.currentExeContext.AsSequenceContext.ErrorReported =True, Locals.currentExeContext.AsSequenceContext.GotoCleanup =True
I'm using "Locals.RecievedError" as my error buffer in this case because it made sense to me to modifiy the error text to include which socket actually had the error (since now it's propigated to all sockets).
Locals.RecievedError.Msg=Parameters.Step.Result.error.msg+" Occurred on Socket#"+Str(RunState.TestSockets.MyIndex)
or something like that...
Was this what you were looking for? If you're really stumped and can tell me what version of TS you're using, I'll try and extract an example from my old code that you can use, but hopefully this helps.
02-17-2009 01:21 PM
Thanks Elaine,
This is exactly what I was looking for. I'm pretty new to TestStand, but I think I can muddle through it based on your post.
Best Regards,
Jake