[Ranorex 5.3.2, Windows 7]
For security reasons, I'd like to have the screen locked on my Windows machine, when running tests overnight. Basically, start test run and then lock screen without interrupting the test run.
Is this possible?
If not, is there another way to password protect access to a Windows 7 computer, when Ranorex tests are running?
Thanks!
Lock Screen in Windows 7, When Running Tests?
Re: Lock Screen in Windows 7, When Running Tests?
Hi,
No, I don't think you can do that. Ranorex requires unlocked desktop. I think the only reasonable way to achieve what you want is to setup a virtual machine (on your main computer) and run your tests on this VM. Then you can lock your main desktop. BTW, using virtual machine for running tests has one more advantage. You can still work on your main computer while tests are running on VM
No, I don't think you can do that. Ranorex requires unlocked desktop. I think the only reasonable way to achieve what you want is to setup a virtual machine (on your main computer) and run your tests on this VM. Then you can lock your main desktop. BTW, using virtual machine for running tests has one more advantage. You can still work on your main computer while tests are running on VM

Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
-
- Certified Professional
- Posts: 455
- Joined: Tue Feb 18, 2014 2:14 pm
- Location: Co Louth, Ireland
- Contact:
Re: Lock Screen in Windows 7, When Running Tests?
Thanks for your reply odklizec. I would like to figure out a way of doing it without a VM, will reply back here if I do.
Re: Lock Screen in Windows 7, When Running Tests?
It depends on what type of testing you are doing.
If you are doing some kind of service or load test where you don't need to interact with a GUI, then it can be done, however there may still be issues and it isn't recommended.
If you are trying to do functional GUI testing, which is what Ranorex is designed for, then NO, you will not be able to do it with the system locked. Windows does not allow any application to have access to the GUI when the system is locked or logged off. Technically there is no GUI, because Windows destroys the desktop while the system is locked (or logged off). This is a security feature.
I would agree with Pavel, you should be using virtual machines for testing as much as possible. The VM can be left unlocked while you lock your system. The VM host software virtualizes the guest's desktop in software, so you still have the VM's desktop even when the host is locked.
If you are doing some kind of service or load test where you don't need to interact with a GUI, then it can be done, however there may still be issues and it isn't recommended.
If you are trying to do functional GUI testing, which is what Ranorex is designed for, then NO, you will not be able to do it with the system locked. Windows does not allow any application to have access to the GUI when the system is locked or logged off. Technically there is no GUI, because Windows destroys the desktop while the system is locked (or logged off). This is a security feature.
I would agree with Pavel, you should be using virtual machines for testing as much as possible. The VM can be left unlocked while you lock your system. The VM host software virtualizes the guest's desktop in software, so you still have the VM's desktop even when the host is locked.
Shortcuts usually aren't...
-
- Certified Professional
- Posts: 455
- Joined: Tue Feb 18, 2014 2:14 pm
- Location: Co Louth, Ireland
- Contact:
Re: Lock Screen in Windows 7, When Running Tests?
Thanks krstcs.
Is there a way to create a recording module that will shut down or lock a windows machine? This module could be included at the end of the test suite, so the machine is locked or shut down at the end of the test run.
Yes, that is the type of testing I am doing.krstcs wrote:...If you are trying to do functional GUI testing,...
Is there a way to create a recording module that will shut down or lock a windows machine? This module could be included at the end of the test suite, so the machine is locked or shut down at the end of the test run.
Re: Lock Screen in Windows 7, When Running Tests?
Hi,
Sure, almost anything is possible (except testing GUI with locked screen
). Check for example this sample:
http://www.codeproject.com/Tips/480049/ ... e-or-Sleep
I think you will have to call the "lock/shutdown" code as a very last operation in program.cs (just before return error; line).
Another option (without coding anything) could be setting up a continuous integration environment with slaves machines, that will turn "on" when you start the test, and automatically turn "off" at the end of test. Jenkins CI is particualrly good and free solution, but yes, it requires some time to setup and learn things. But then it's a very helpful and valuable tool for automatized testing.
Sure, almost anything is possible (except testing GUI with locked screen

http://www.codeproject.com/Tips/480049/ ... e-or-Sleep
I think you will have to call the "lock/shutdown" code as a very last operation in program.cs (just before return error; line).
Another option (without coding anything) could be setting up a continuous integration environment with slaves machines, that will turn "on" when you start the test, and automatically turn "off" at the end of test. Jenkins CI is particualrly good and free solution, but yes, it requires some time to setup and learn things. But then it's a very helpful and valuable tool for automatized testing.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Lock Screen in Windows 7, When Running Tests?
Don't use 'Shutdown'. Just lock the system. You can run a batch file as the last module in Ranorex that runs the lock command in Windows:
'Shutdown' might force the test to end before it full completes.
Code: Select all
rundll32.exe user32.dll,LockWorkStation
'Shutdown' might force the test to end before it full completes.
Shortcuts usually aren't...
-
- Certified Professional
- Posts: 455
- Joined: Tue Feb 18, 2014 2:14 pm
- Location: Co Louth, Ireland
- Contact:
Re: Lock Screen in Windows 7, When Running Tests?
Thanks odklizec and krstcs.
krstcs is there a way to lock the system with a recording module? If not, were you suggesting that I create a code module using the line of code you provided?
krstcs is there a way to lock the system with a recording module? If not, were you suggesting that I create a code module using the line of code you provided?
Re: Lock Screen in Windows 7, When Running Tests?
The line of 'code' I posted is actually the Windows command-line command that does it.
The only thing you should need to do is to add the "Start Application" action to your module with that command ("rundll32.exe") and the given arguments ("user32.dll,LockWorkStation").
The only thing you should need to do is to add the "Start Application" action to your module with that command ("rundll32.exe") and the given arguments ("user32.dll,LockWorkStation").
Shortcuts usually aren't...
-
- Certified Professional
- Posts: 455
- Joined: Tue Feb 18, 2014 2:14 pm
- Location: Co Louth, Ireland
- Contact:
Re: Lock Screen in Windows 7, When Running Tests?
Thank you very much krstcs, that works perfectly.
Re: Lock Screen in Windows 7, When Running Tests?
You can implement this as a windows task scheduled to be performed at login:
Run program rundll32.exe With arguments user32.dll,LockWorkStation
one (not very best) way to implement it might be:
autologin as passwordless single user
set user password - net user <user> <password>
lock the screen - rundll32.exe user32.dll,LockWorkStation
these two lines can be put into autoexec.bat file or startup folder in a batch file to run on every login
Run program rundll32.exe With arguments user32.dll,LockWorkStation
one (not very best) way to implement it might be:
autologin as passwordless single user
set user password - net user <user> <password>
lock the screen - rundll32.exe user32.dll,LockWorkStation
these two lines can be put into autoexec.bat file or startup folder in a batch file to run on every login
Re: Lock Screen in Windows 7, When Running Tests?
I actually use a tool called Autologon, which allows me to remotely lock/unlock and logon/logoff from any system with it installed. Of course it is only installed on test VMs that are deep inside our network... 
All I have to do is add the unlock command to the start of my test (or, in my case, the start of the Jenkins job) and then add the lock command at the end.

All I have to do is add the unlock command to the start of my test (or, in my case, the start of the Jenkins job) and then add the lock command at the end.
Shortcuts usually aren't...