03-28-2013 06:43 PM
Hello,
I am in need of the solution for accessing the execution of a Step
The execution order of a step begin as below. How can I insert a custom call at execution position before step 3 and after step 18?
Can I create a custom step allow me to insert a function call like that
1-->Allocate result
2-->Enter batch synchronization
3-->Check Run mode for Skip
4-->evaluate precondition
....
17-->Evaluate Post expression
18-->Evaluate Status Expression
Solved! Go to Solution.
03-29-2013 09:59 AM
Hey Tphan,
I can think of a few ways to accomplish this. Unfortunately, it's not really possible to insert something in the step itself that will always excecute before the run mode is evaluated, because the purpose of the run mode is to determine whether or not the step should execute. One simple solution to this would be to insert a Statement step directly before the step in question. This would execute before the step in question, and makes a bit more sense visually, especially if the step is set to Skip.
Another option is to override the SequenceFilePreStep callback, which executes before every step in the sequence. If there was something you needed to do before every step, it would make sense to put that code in this callback. There's also a SequenceFilePostStep callback, which would execute after each step completes.
Either of these options would work for what you're trying to do, and I think they might make more sense in terms of setting up the sequence in an ideal way so that its functionality will be apparent to any other test developers examining the code. Hopefully this will help some, but if you do have more questions about it, it'd be great to have a bit more information about what kinds of things you want to do in these pre- or post-steps.
03-29-2013 10:56 AM
Hello Daniel-E
Thanks for replying.
I am trying to create a custom batch model which is:
-If a step failed, all steps after that is report skip and the test is stop. It is crucial that all the steps will be report does not matter pass or fail or skip
-This function can be switch on /off using property loader from a text file
-Only work on custom step time to limit resource uses
As this could easily done by putting (fx) functions before and after a step to :
-Precheck if a fail flag is occured then setting the step to skip or Force Fail
-Postcheck if a the step status before is failed to set a flag
However putting step (fx) before or after will make the test seq looks confusing and time consumming when writing a test sequence.
Precondition can be use for dynamicly setting the step to skip or fail, but limit to boolean only
The post expression is before Status evaluation so it can not tell that the step status is pass or fail
using the call back for pre and post might work but add a lot more of cpu time since it apply to every steps but might be an acceptable solution.
I am going to check it out
Thanks for helping
Tphan
03-29-2013 11:50 AM
@Tphan wrote:
Precondition can be use for dynamicly setting the step to skip or fail, but limit to boolean only
The above statement is not correct, you can have any expressions as long as they evaluate to a true or false. So for example, you can have a precondition:
RunState.PreviousStep.Result.Status=="Passed"
So the above expression makes sure that the step will only execute if the previous test passed.
I think your problem can be solved using pre-conditions and post actions.
Have a look at the attached file.
03-29-2013 11:55 AM
Yes indeed it is a solution. How ever since what I do is a Model. I want to conceal the expression for other developer want to use precondition and post expression.
They not look clean but it should work,
Thanks
Tphan
03-29-2013 12:24 PM
Hello,
I try to open the seg in Teststand 2012 but got a message "CreateProcess Fail".
Does the seg file corrupted?
Thanks
Tphan
03-29-2013 12:39 PM
Not sure of the error, I can still open it.
Here is one in 2010 format.
03-29-2013 12:56 PM
Thanks, That works
Tphan