Forum Discussion

ahmed_daniel's avatar
ahmed_daniel
Occasional Contributor
10 years ago

Resuming test to next test item after application crash

Hi,

 

I am using TestComplete to run a couple of different tests on a single desktop application. The application is prone to crashes so I want to ask is it possible to resume test to next test item in list if the application which was being tested has crashed?

 

For example I have a project which has 3 test items and during test 2 or test 1 the application crashes. Is it possible that after that the crashed application would re-launch and resume from next test item in project? All the test items are on the same level of hierarchy.

Is there a settings in TestComplete for such a scenario?

 

Your help would be really appreciated.

 

Thanks,

Daniel

  • AlexKaras's avatar
    AlexKaras
    10 years ago

    Hi Daniel,

     

    The actual implementation depends on your tested application (Desktop / Web / Mobile) and the way how it crashes (process disappears / some window is shown and the process is terminated after this window is closed / etc.), but I think that I would try something like that (refer to the help system for the description and more information about terms that are not clear or ask questions here):

    -- Implement a handler for the OnLogError or OnTestStart or OnTestStop events whatever is more reasonable in your given case;

    -- Implement some global flag (as a temporary Project Variable) that indicates whether or not the tested application is expected to be running (with absent crash indications) -- this is for the case when you need to do something regardless of whether or not application is running;

    -- Create a code called from the event handler that will check (using the above flag) if the tested application is running (when it is expected to be running) and if the crash indicators are present or not. The result of these checks is a decision whether or not application crash happened. If the application crashed and need to be restarted, then the code must perform all required clean-up actions (e.g. close crash notification window with a proper logging) and restart the tested application.

     

    Note, that, depending on your application, it will be restarted either in its initial state or in the state it was at the moment of crash. If the former, than, obviously, your tests must not expect that the application is in some expected state, but might be in its initial state and behave appropriately. In order to ease this task, you may consider Stop On Error and Stop on Exception properties of the test items (http://support.smartbear.com/viewarticle/55015/).

  • Open the Project and in the workspace pane, select the Properties tab then select Playback from the explorer pane and you will see numerous playback related options in the right pane, Un-select (uncheck) the 'Stop on error' and 'Stop on warning' check boxes and assuming your tests don't encounter runtime/unhandled exceptions, TestComplete should continue to the next test item.

    • ahmed_daniel's avatar
      ahmed_daniel
      Occasional Contributor

      I have these options disabled but they dont re-launch application (when application crashes) and continue with the next test.

      Is there a way for test complete to launch the tested application again when it detects that it has crashed during testing?

       

      Thanks for the reply.

       

      Daniel

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi Daniel,

         

        No, what you are looking for is not possible out-of-the-box and must be implemented yourself as a library function.

        I believe that there are two main reasons here:

        a) Test code has no idea of whether the tested application's crash was expected or not. It is quite possible that you wrote your test so it crashes the application for purpose and thus there is no need to restart it;

        b) If the tested application has crashed, there is a chance that some cleanup / setup actions must be required before application is restarted. Again, this is specific to your given application and thus must be handled by yourself.

         

        Also, http://support.smartbear.com/viewarticle/56438/ and http://support.smartbear.com/viewarticle/55754/ might appear to be relevant for you.