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?
- 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.
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.
- 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.
- 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.
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.
- 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.
- 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.
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.
- 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.
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:
- Issue: When the remote computer gets locked, the graphical interface disappears.
- Solution: Use a command called "tscon" on the remote computer to bypass the logon screen and regain control.
- Command Example: Run
%windir%System32tscon.exe RDP-Tcp#NNN /dest:console (replace NNN with your remote session ID).
- Outcome: This prevents interruptions, allowing your automated tests and programs to run normally.
Method 2: Automating Disconnection with a Batch File:
- Issue: When tests are running, manually disconnecting can interrupt them.
- Solution: Create a batch file with a command to disconnect automatically.
- Batch File Example:
for /f “skip=1 tokens=3” %%s in (‘query user %USERNAME%’) do (%windir%System32tscon.exe %%s /dest:console)
- 1. Right-click the batch file > Send to Desktop (create shortcut).
- 2. Go to shortcut properties > Advanced > Run as administrator.
- Usage: Double-click the shortcut on the remote computer when you need to disconnect or run it at the start of your tests.
- 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.