Forum Discussion

sindhu10's avatar
sindhu10
Contributor
8 years ago

How to launch desktop application without tested apps using jscript

Hi,

 

Am trying to launch desktop application without tested apps .

 

tried the below code :

The application opens and closes automatically dont know why

Please help.

 

function Launch_app()
{

DbgServices.LaunchApplication("D:\\testedapp.exe");
var Res = Sys.Process("test").Exists;

// Checks whether Notepad has started successfully
if (Res)
Log.Message("App has been started successfully.")
else
Log.Message("App hasn't been started.");

}

4 Replies

  • karkadil's avatar
    karkadil
    Valued Contributor

    But just in case you still want to try running your tested app without TestedApps, you can try one of the following:

    1. Use OLE

    Sys.OleObject(“WScript.Shell”).Run(“C:\\Windows\\notepad.exe”, SW_SHOWNORMAL);

     

    2. Use WinAPI

    Win32API.WinExec(“C:\\Windows\\notepad.exe”, SW_SHOWNORMAL);
    • sindhu10's avatar
      sindhu10
      Contributor

      I tried the code but it opens a login window for the application

      Once I input the password it closes automatically and says the application not working and checking for the root cause .

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        As Marsha_R suggested, does this happen when you do it manually?  Can you, without TestComplete running, run your application, enter the password, and have it continue running?  Let's start simple...

  • Marsha_R's avatar
    Marsha_R
    Icon for Champion Level 3 rankChampion Level 3

    I know you've posted several questions in the forum, but I'm seeing a pattern.  You keep reporting that your application under test is closing and you don't know why. 

     

    Let's back up and try the application without TestComplete.  Can you step through a test case manually and have it work?  Or do you still get the crash? 

     

    After you've tested manually, check Task Manager.  Are there multiple copies of your application running?  Are there any other programs running that are taking up a lot of memory?  TestComplete wants a lot of memory and if you have little available when you do run it, it may lock up or crash.

     

    Now try the test with TestComplete again.  Check Task Manager after it's done.  Are there multiple copies of the application now?  Are there any other programs running that are taking up a lot of memory?   

     

    Let's find a way to keep your application running under TestComplete and then see if you still need to change your code.