Forum Discussion

tinauser's avatar
tinauser
Frequent Contributor
13 years ago

process close and terminate does not work

Hi,

I have a couple of applications, if I use the method process.Close() or process.Terminate() the application is there but the function returns true. Is this expected?

Thnx
  • Julia_K's avatar
    Julia_K
    SmartBear Alumni (Retired)
    Hello Lorenzo,

    Could you please check if the issue persists on the latest version of TestComplete – 9.0? If you need a free trial version of TestComplete 9.0, you can apply for it here.

    To help us investigate the problem, also please check the following:

    1. Is your tested application listed under the Sys node in the process hierarchy in TestComplete‘s Object Browser after you try to close it with TestedApp.Close or TestedApp.Terminate methods?

    2. In what run mode is your application launched? Is it launched in Simple mode? The tested application’s run mode is specified in the Run mode column of the TestedApps editor.

    3. Can you close your tested application by calling the Close method of the process object instead of the Close method of the TestedApp object? For example, Sys.Process(“Notepad”).Close().

    Thanks in advance.
  • Hi,



    Is there are multiple instances of that application open? if yes, you have run a loop to close all instances of that application.



    Regards,

    Saurabh
  • tinauser's avatar
    tinauser
    Frequent Contributor
    Hi, thanks for the answer.

    No, there is only one application running. Moreover, if there were more, it should also close all of them with no loop, as the manual says "If several instances of the application exist in the system, this method closes
    all of them."
  • Julia_K's avatar
    Julia_K
    SmartBear Alumni (Retired)
    Hello Lorenzo,

    Could you please specify more precisely the methods you are using to close your tested application? Do you use the Process.Close and Process.Terminate methods or the TestedApp.Close and TestedApp.Terminate methods?

    How do you launch your tested application? Please note that the TestedApp.Close and TestedApp.Terminate methods affect only applications launched from TestComplete.

    Also, could you please check whether your tested application freezes when you launch it or try to close it from TestComplete tests? Can you close the application manually?

    Thanks in advance.
  • tinauser's avatar
    tinauser
    Frequent Contributor
    Hi,thanks for the answer.

    The test application is launched within the following function

    function startPopulateHelper()

    {

    //variables

      var TestApp ;

      try

      {

    //fetch the Testedapp  

        TestApp = TestedApps.Items("Ident_PersistenceAccess_PopulateHelper");

    //set the path, if given (should be the same where the Ident.exe is located)

        if (ProjectSuite.Variables.VariableExists("identPath"))

          TestApp.Path = aqFileSystem.IncludeTrailingBackSlash(ProjectSuite.Variables.VariableByName("identPath")) ;

    //run the application

        TestApp.Run();

        return true;

      }

      catch(e)

      {

        Log.Error("Could not run the application", e.description);

        return false;

      }

    }



    It does not close neither with TestApp.Close() nor with TestApp.terminate()
  • Hi,

    Our project supports more than 40 applications.Before Test complete start running the script,i want to terminate the applications if opened any in my machine.

    How to identify the running application in my system and terminate them using script.



    Thanks,

    Kirthiga