Running uninterrupted test automation on remote machine during remote disconnection?

Running uninterrupted test automation on a remote machine during remote disconnection refers to the continuous execution of automated tests on a computer that is not physically accessible or directly connected.  

Why do we need to run uninterrupted test automation on a remote machine during remote disconnection?

It’s usually seen that while running test automation with Internet Explorer on a remote computer, execution fails when users lock their PC or disconnect the remote computer connection. When the remote computer gets disconnected or locked anyway, the graphical user interface disappears and the logon screen appears. It causes interruption for running test automation with Internet Explorer on a remote computer and the user gets a failed result.

What are the other crucial reasons?

  1. Efficiency:

    • Continuous execution of test automation allows for efficient utilization of resources. Automated tests can be scheduled to run during off-hours or at times when the remote machine is not actively in use.

  2. Optimal Resource Utilization:

    • Remote machines are often shared among team members. Running tests uninterrupted during disconnection ensures optimal use of these shared resources without requiring constant manual supervision.

  3. Timely Feedback:

    • Automated tests provide rapid feedback on the application's functionality and quality. Disconnection interruptions can delay this feedback, impacting the overall testing cycle and potentially delaying the release process.

  4. Cost-Effectiveness:

    • Automated test execution during non-working hours or when the machine is not actively in use optimizes resource utilization and contributes to cost-effectiveness. It eliminates the need for manual intervention during each testing cycle.

  5. Support for Continuous Integration/Continuous Deployment (CI/CD):

    • In CI/CD pipelines, automated tests are often triggered automatically. Ensuring that tests run uninterrupted on remote machines, even during disconnection, supports a seamless CI/CD process, enabling faster and more frequent releases.

  6. Large-Scale Testing:

    • For large-scale test suites or regression testing, continuous execution on remote machines ensures comprehensive coverage without manual intervention. This is especially crucial in complex applications with frequent updates.

  7. Remote Collaboration:

    • Teams may be distributed across different locations and time zones. Uninterrupted test automation on remote machines facilitates collaboration by allowing team members to contribute to testing efforts regardless of their physical location or working hours.

  8. Consistency and Reliability:

    • Consistent and reliable execution of automated tests helps maintain the integrity of the testing process. Interruptions in test execution due to remote disconnection can lead to inconsistencies and unreliable test results.

  9. Time Savings:

    • Running tests continuously, even during remote disconnection, saves time for testers and developers. It ensures that tests are completed within expected timelines, supporting agile development practices.

  10. Effective Use of Cloud Resources:

    • In cloud-based testing environments, uninterrupted test automation ensures the effective use of cloud resources. Tests can be distributed across multiple virtual machines, enhancing parallel test execution capabilities.

How do you run uninterrupted test automation on a remote machine during remote disconnection? 

Method 1: Using "tscon" Utility:

  1. Issue: When the remote computer gets locked, the graphical interface disappears.
  2. Solution: Use a command called "tscon" on the remote computer to bypass the logon screen and regain control.
  3. Command Example: Run %windir%System32tscon.exe RDP-Tcp#NNN /dest:console (replace NNN with your remote session ID).
  4. Outcome: This prevents interruptions, allowing your automated tests and programs to run normally.

Method 2: Automating Disconnection with a Batch File:

  1. Issue: When tests are running, manually disconnecting can interrupt them.
  2. Solution: Create a batch file with a command to disconnect automatically.
  3. Batch File Example:

for /f “skip=1 tokens=3” %%s in (‘query user %USERNAME%’) do (%windir%System32tscon.exe %%s /dest:console)

Shortcut Creation:

    • 1. Right-click the batch file > Send to Desktop (create shortcut).
    • 2. Go to shortcut properties > Advanced > Run as administrator.

  1. Usage: Double-click the shortcut on the remote computer when you need to disconnect or run it at the start of your tests.
  2. Note: Using "tscon" reduces system security, so only use it when necessary.

Additional Command to Lock the Remote Computer:

  • After testing, use Rundll32.exe user32.dll, LockWorkStation to lock the remote computer for security.


  • Avoid locking or disconnecting the remote computer during automated tests. If needed, use the "tscon" command or automate disconnection with a batch file. Be cautious about security and lock the computer after testing.

Explore more Opkey features by clicking Here.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article