Is it possible to skip a test step during test playback in TestComplete?
- 9 years ago
Let me make sure I understand.
I've clicked "Play" on a test project or suite. During the process of playing back, if a test step seems to be taking too long, you want an option to say "Skip this step". Is this correct?
If so, that's something you'll have to, in some way, build in programmatically. Based upon your initial post, there is a condition implied that, if the test seems to be taking too long, you want the option to "skip" it. You'll have to do several things.
Firstly, construct your code so that you can do some sort of detection of the performance before you start going into the test. Perhaps it would have to be some sort of condition of "If the previous test step took more than n seconds, skip this test". This would mean possibly wrapping each test step with some sort of utilization of the "StopWatch" object so that, at the end of each test, you can check a time elapsed value. You would then wrap the next step in an if/then code block to check for timing.It may look something like this Pseudocode.
var ElapsedTime; var Timing = HISUtils.StopWatch; function TestStep1(){ Timing.Reset(); Timing.Start(); Log.Message('Executing Test 1'); aqUtils.Delay(1500); ElapsedTime = Timing.Split(); } function TestStep2(){ if (ElapsedTime <=2000){ Timing.Reset(); Timing.Start(); Log.Message('Executing Test 2'); aqUtils.Delay(5000); ElapsedTime = Timing.Split(); } } function All(){ TestStep1(); TestStep2(); }
Basically, if the first test step takes longer than 2 seconds, the second one won't execute. Now, this is handled automagically, but you could easily put into the if/then logic a user form prompting for you to answer whether or not you want to proceed based upon your response.
IMO, this sort of defeats the purpose of having a larger suite if you need to manually interact. I would prefer some sort of automatic method like demonstrated because that would take it out of your hands. I'd then add some logging to indicate that, yes, a test step was skipped and what the timing reason was and so on.
You can modify the logic any way you want to but, essentially, it comes down to building some sort of conditional logic to indicate whether or not the proper conditions have been met to execute a test step (server performance counters, test environment variables, etc) and then executing logic to skip the step.