announcement
Opkey Raises $47 Million in Series B Funding | Read more
announcement
Opkey Announces New AI-Powered Features | Read more
announcement
Advisory for Oracle Cloud 24C Release | Download now
How to run un-interrupted test automation on remote machine during remote disconnection?

How to Run Un-Interrupted Test Automation on Remote Machine During Remote Disconnection?

September 12, 2016
 / 
by 
Iffat Ara Khanam

It’s usually seen that while running test automation with Internet Explorer on remote computer, execution get failed when users lock their PC or disconnect remote computer connection. When remote computer get disconnected or locked anyway, the graphical user interface disappears and logon screen appears. It causes interruption for running test automation with Internet Explorer on remote computer and user get failed result.
Now, such problems can be resolved by following few recommended steps:

  • You can use “tscon” utility; which enables you to return your control over the remote computer to the original local computer through bypassing the logon screen which usually appears on locked computer. In this way, your test automation execution with IE along with other running programs will run normally and there will be no interruption as well. As an administrator, you need to run following command on the remote computer:

%windir%System32tscon.exe RDP-Tcp#NNN /dest:consoleHere, RDP-Tcp#NNN is the ID of your current Remote computer session. For example, RDP-Tcp#0, RDP-Tcp#1, RDP-Tcp#2, RDP-Tcp#3 etc. You can see it in the Windows Task Manager on the Users tab, in the Session column.Now, you come across a message that “Your remote desktop session has ended” and the Remote computer client get closed but your test automation along with all other programs and tests on the Remote computer are running normally.

  • Another way is to automate the disconnection process using a batch file. Create a batch file on Remote computer by using the following code:

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

Create a desktop shortcut of this file in following way:

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

Now, you can use this shortcut on the Remote computer when you need to disconnect from Remote computer. For this, double-click this shortcut on the remote computer in the Remote computer window.In addition, you can also run this batch file in the starting of your tests on Remote computer. You must ensure that you have Administrator rights on Remote computer.Note:“tscon” command utility is used to release control over Remote computer and leave Remote computer unlocked but it reduces system security. You can lock Remote computer when your test automation is over by using following command:Rundll32.exe user32.dll, LockWorkStation

Summary: You should not lock or disconnect Remote computer when your test automation are still running. In case of un-avoidance situation of locking or disconnecting Remote computer, you must ensure hassle free running of test automation by using above mentioned methods.

Author

Radhe Shyam Prajapati

Contact us