Forum Discussion

AngelKS609's avatar
AngelKS609
Occasional Contributor
8 years ago
Solved

Is it possible to skip a test step during test playback in TestComplete?

I have a test case with a bunch of delays on it for my companies QA site, because it does not run at full speed at all times. to avoid failing when our system is running slow I put those in there, but is there a way to skip these steps incase they are unneeded? If not I could just test the system before starting my test?

  • 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.

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The best answer I can give up front is: it depends.

     

    I say that because it depends a bit on the architecture of how you have your tests organized for execution.  There are any number of ways to indicate to run a test or not but they all depend upon how the whole suite of test cases is put together. Some possible methods:

    1) Set a global/project variable and, if the variable has a particular value, have "if/then" logic configured to skip certain tests based upon the value. Something like an "IFDEF" compiler directive, in truth.

    2)  If you have a table or data driven framework that is executing the tests, simply comment out those lines in your data or "deactivate" certain records. For example, if you are reading your data out of an Excel sheet, you could have a column in that sheet called "Execute" and, if it's set to FALSE, that row will be skipped.

     

    3) If each test case is a test item in TestComplete, you could create a batch file to execute test items via command line and simply comment out or remove lines from that batch file. What I conceive of is that each test case would be a command line in the batch file using the appropriate parameters and then you could customize your test cases that way.

    4) If you're using a tool like QAComplete, you could configure your test cases in test runs through that management tool and execute that way rather than running the tests.

    5) OR (and the is probably the most extreme), you would manually edit your code routines each run to "turn on" or "turn off" you test cases.

    So... the short answer is, yes, you can skip a test step... but it all depends upon your architecture as to how and how difficult it is to do so.

    • AngelKS609's avatar
      AngelKS609
      Occasional Contributor

      So is there no way to skip a step during the playback?

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        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.