Forum Discussion

ceslav23's avatar
ceslav23
New Contributor
2 years ago
Solved

Getting "The object does not exist." errors for all objects when test script is started from local m

Hi there,
I am trying to figure out the best practice to run test scripts on remote machine for our desktop applications (Windows Forms and Windows Presentation Foundation).
I installed TestComplete on remote machine, created a test script and created a PowerShell file with CMD command inside to run a TestComplete script.
I can successfully launch & run a test script from PowerShell file on remote machine.
As a result, I have a working schema on remote machine:
run PowerShell file => CMD command => TestComplete script

 

As a next step, I am trying to launch my test execution on remote machine from local machine, like this:
run PowerShell file on local machine => PowerShell file on remote machine => CMD command => TestComplete script


I able to start TestComplete script on remote machine from PowerShell file on local machine, however my script contains only "The object does not exist. See details for additional information" errors for all objects.

I am wondering if someone can explain why we have different behavior for the same test script on same machine:
- Passed when it started from remote machine
- Failed when it started from local machine

Or maybe we can use different approach to run test scripts on remote computer?
Thank you in advance

  • On my VM, I also use a PowerShell script to launch either,

    Start-Process 'C:\Program Files (x86)\SmartBear\TestExecute 15\x64\Bin\TestExecute.exe' -ArgumentList """C:\Sandbox\TestComplete\ALS\ALS.pjs"" /run /exit /DoNotShowLog -Wait | Out-Null

    Or

    & 'C:\Program Files (x86)\SmartBear\TestExecute 15\x64\Bin\SessionCreator.exe' RunTest /UserName:***** /password:***** /UseActiveSession /ScreenResolution:"1920*1080" /ProjectPath:"C:\Sandbox\TestComplete\ALS\ALS.pjs" | Out-Null

    If I’m logged onto the VM, I’ll use the first command to run the automation. Otherwise, I’ll use the second command, together with tscon (which disconnects me from the VM, but my session remains active). The VM can not be locked, otherwise it won’t have a GUI.

     

    I have a Task Schedular set, to run the PowerShell script, which I can invoke manually.

     

    Note, the commands used in the PowerShell script i.e. Start-Process and &. These are important, because the PowerShell script won't exit, until the automation has finished (it's not running in a seperate process)

4 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    On my VM, I also use a PowerShell script to launch either,

    Start-Process 'C:\Program Files (x86)\SmartBear\TestExecute 15\x64\Bin\TestExecute.exe' -ArgumentList """C:\Sandbox\TestComplete\ALS\ALS.pjs"" /run /exit /DoNotShowLog -Wait | Out-Null

    Or

    & 'C:\Program Files (x86)\SmartBear\TestExecute 15\x64\Bin\SessionCreator.exe' RunTest /UserName:***** /password:***** /UseActiveSession /ScreenResolution:"1920*1080" /ProjectPath:"C:\Sandbox\TestComplete\ALS\ALS.pjs" | Out-Null

    If I’m logged onto the VM, I’ll use the first command to run the automation. Otherwise, I’ll use the second command, together with tscon (which disconnects me from the VM, but my session remains active). The VM can not be locked, otherwise it won’t have a GUI.

     

    I have a Task Schedular set, to run the PowerShell script, which I can invoke manually.

     

    Note, the commands used in the PowerShell script i.e. Start-Process and &. These are important, because the PowerShell script won't exit, until the automation has finished (it's not running in a seperate process)

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    It sounds like there's something wrong between the two PowerShell files, but it is difficult to tell since you didn't include any details. Let's see the code for both the PowerShell files.

  • ceslav23's avatar
    ceslav23
    New Contributor

    Thank you for quick response! Please find below teh PowerShell code:

    1. The PowerShell command on local machine:
    cd C:\PSTools
    .\PsExec.exe -i <sessionId> -accepteula \\<serverName> -u <userName> -p <password> PowerShell -ExecutionPolicy RemoteSigned -command "C:\PowerShellCommands\LunchTestComplete_Remote.ps1"

    2. The PowerShell file on remote machine:

    cmd.exe /c "C:\Program Files (x86)\SmartBear\TestComplete 15\x64\Bin\TestComplete.exe" "D:\01_TestComplete_CurrentWork\ProjectSuiteName.pjs" /r /pv:ProjectVariable=STANDARD /p:ProjectName /u:Start /rt:RoutineName /exit /SilentMode 

    We don't have issues with communication between PowerShell files - no errors during execution, and we can see as TestComplete started and finished test execution

  • ceslav23's avatar
    ceslav23
    New Contributor

    Thank you for your help.

    Actually, issue is in Session 0. Windows system processes and services run in Session 0. On systems earlier than Windows Vista, the first user who logged on to the console also used Session 0. Running services and user applications together in Session 0 poses a security risk because services run at elevated privileges and therefore are targets for malicious agents trying to elevate their own privilege levels. To eliminate the security risk,

    Session 0 is non-interactive on Windows Vista and later systems; that is, the first user logs on to Session 1. However, services still run in Session 0. This means that services that need to display user interface dialog boxes or communicate with user applications must properly secure a communication channel. If this is not done, the services fail to work properly on Windows 7 and later systems.

    Windows stated that this was a security concept and the process would run in the background.

    As a workaround, I can start TestExecute on remote machine via Task Scheduler like this:

    run TestComplete on local machine => send PowerShell command to remote machine => Run Task Scheduler on remote machine => Start TestExecute on remote machine