Forum Discussion

andreeailiuta's avatar
andreeailiuta
New Contributor
7 years ago
Solved

TestComplete cannot find process

Hello,

 

We automate test cases for a desktop application in TestComplete V12.42 and all test are run on a test machine, using TestExecute V12.42 where is configured Team Foundation Build Service.

The application has a windows service and when trying to access it in TestComplete (Sys["Process"]("WebService.Service")["Exists"]) the test fails ("The process "WebService.Service" was not found"), although the process is displayed in task manager.

Also, when looking into Object browser, the process is not displayed there.

The "Show all processes" option is already selected and so is the "Show all process" checkbox in Process filter dialog, yet the process is not displayed in this section.

We got stuck since, at some point, Sys["Process"]("WebService.Service")["Exists"]) worked as expected.

 

Can you tell what we are missing or give us more information in order to determine why this process cannot be identified?

 

Thanks in advance!

  • This is, most likely, a timing issue in that the process is not present when the "Exists" property is checked.  If you think about it, you can't call the "Exists" property of an object if there is no object.  You can't check ANY property of an object that does not exist.

     

    If you're looking at testing the process existance, this is the better code to use (JavaScript):

     

    var processExists;
    var webServiceProcess;
    
    processExists = Sys.WaitProcess('WebService.Service', 20000).Exists
    if (processExists){
        webServiceProcess = Sys.Process('WebService.Service');
    }
    else{
        Log.Error('The WebService.Service process did not resolve within 20 seconds');
    }

    See https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/sys/waitprocess-method-sys-object.html

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    This is, most likely, a timing issue in that the process is not present when the "Exists" property is checked.  If you think about it, you can't call the "Exists" property of an object if there is no object.  You can't check ANY property of an object that does not exist.

     

    If you're looking at testing the process existance, this is the better code to use (JavaScript):

     

    var processExists;
    var webServiceProcess;
    
    processExists = Sys.WaitProcess('WebService.Service', 20000).Exists
    if (processExists){
        webServiceProcess = Sys.Process('WebService.Service');
    }
    else{
        Log.Error('The WebService.Service process did not resolve within 20 seconds');
    }

    See https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/sys/waitprocess-method-sys-object.html

  • Hello,

     

    I followed your example and the result was kind of surprising:

    When running the rest on TestComplete, the process is still not found, but when launching it (the same test and the same code) on TestExecute, the process is found and the test passed. 

     

    Thank you for your feedback!