01-14-2010 10:15 AM
Is there an elegant way to programmatically determine any steps that are reference in an expression using API.
Such that
AllOf(RunState.Sequence.Main["ID#:AzvyVD4OcUiZz2vk3ZHknA"].Result.Status == "Passed", RunState.Sequence.Main["ID#:0RT7Ih2QQkimHpGGh30sIA"].Result.Status == "Passed")Would return ID#:AzvyVD4OcUiZz2vk3ZHknA and ID#:0RT7Ih2QQkimHpGGh30sIA in an array of strings or something along those lines.
01-18-2010 04:02 PM
Herrlin,
Unfortunately there is no simple solution for what you seek.
It would be possible via the TestStand API or the expression language to search a string/expression for a Step, however building this would not be trivial. The Find expression to find specific strings easily enough but building the logic behind it would take more work. The tool would not only have to loop to find every reference within a string but we would also, likely, have to include a known list of all step IDs so we don't pull out invalid references. The other trick is that steps can be referenced by ID, by number or by name so that would add another level of complexity.
Despite those factors this is a good idea. If you want to go to our Product Suggestion page you can submit this idea for consideration as a future addition to TestStand.
01-19-2010 08:08 AM
John B
Thanks for the reply.
I actually did implement a similar solution to what you described. I originally didn’t share the entire scope of what I was trying to accomplish. I wanted an entry point that would run selected steps and actively look for any steps referenced in the preconditions of the selected steps. If a step was reference the entry point would know that it also had to run this step. This will be a useful tool for debugging, since it will record results as well as run steps that the selected test is dependent on, in a sense.
My team made a decision that we would only be using unique ids to reference steps in expressions felt this was a better programming practice. Also we only needed this function for the MainSequence of a sequence file. In addition we always wanted Setup and Cleanup groups to remain the same. So we only needed to search each precondition for the unique step id of steps that where in the Main group of the MainSequence.
I have attached the new sequence file I made with a Custom entry point. The entry point is almost an exact copy of the single pass entry point with a couple of modifications.
1 It calls Configure Temp Sequence
2 It references a temp sequence file what during the MainSequence Callback instead of the Client file
3 In the Cleanup it closes the reference to the temp sequence.
Also there are two new sequences:
Configure Temp Sequence
Get Steps to Exe
Any way just thought you might be interested and this was no easy task for me so I was excited to share.
Thanks
Dan H
01-19-2010 08:34 AM