Forum Discussion

krvikas1011's avatar
krvikas1011
Occasional Visitor
9 years ago

TestComlete hanging for multiple instance of an application.

In my automation script, I am opening an application and then logging into it. After that I perform some actions inside that application. After this I close the application. Then we again restart the application and try to login but the type action is not happening in the username textbox. The execution just seems like hanged.

 

I saw that when the first time that I close the application, the process is still there in the task manager. When I reopen the application another instance of the application is started. 

 

When the execution is hanged during the second login attempt, If I go and terminate the first instance of the application from the task manager then the execution resumes and completes successfully.

 

So can anyone help me understand why this issue is occuring ?

 

Any help is appreciated. Thanks

  • Simple. You're not closing it properly.

     

    How are you closing it? Many applications, if you just click the "x" in the top right, will just minimise to the tray.

     

    So either exit the application properly (I don't know what "properly" is in your case as I don't have access to it), or kill it at process level after you have (incorrectly) closed/minimised it.

     

    https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/window-and-process/terminate-method-process-object.html

     

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      OR... you found a bug.  If closing the x in the upper corner is SUPPOSED to close the application and end the process and it's not... well, then your automation is doing what it's supposed to do.  If you're calling Sys.Process('myapp').Close(), that should also kill the process assuming that it's supposed to be able to be closed that way.

      • mgroen2's avatar
        mgroen2
        Super Contributor

        Could be a timing issue. Sometimes it takes a couple of seconds for an application to close all its processes/threads etc.

        Maybe you are re-executing the testcase to fast after ending first test run? You could try to implement some wait time before each test run.. or, as tristaanogre mentioned you have found a bug in the application

  • Manfred_F's avatar
    Manfred_F
    Regular Contributor

    You probably do use Aliases.

     

    Aliases are not capable to handle multiple instances of anything.

    They get You - as I experienced it - always the first instance of whatever.

     

    To deal with multiple instances, You

    - use the alias to see whether at least one instance of Your target Dialog is visible

    - if true, navigate the control tree (e.g. see the dialog's control siblings) to find any additional instance (it will have the same .mappedName)

     

    If You do not really Need multi-instance handling, You can solve Your Problem by adding the .Visible = true property to Your alias. This will make Your terminated first instance a no-match and will get You the second, visible one.