UFT script pause when closing Remote Desktop - hp-uft

Im launching an UFT script in a Remote machine. The access to that Remote machine es from my Local machine (the script is launched in the Remote, not from local).
The problem is that if I close the Remote Desktop, the script pauses until I start another time the machine.
How can the script continue with the Remote Desktop closed? I tried going in UFT to Tools -> Options -> Run session -> allow scripting when RDP is closed and entering user and pass with a verified conection, but does not work.
Thanx!

More of a workaround. Have not seen this flag working for some time, but that could just be inexperience.
Alternatives are:
Configure a service account that logs in and starts UFT Run time as soon as the server is started.
Stay logged into the remote session and disable auto screen lock.
Use mouse move tools like MouseJiggle to stop the screen locking
UFT documentation give several places where settings must be configured. (during installation, post installation)

Related

Using GitLabRunner to execute GUI tests on windows with permanent active user session

i'm having issues to get a permanent active user-session on my virtual machine to execute gui tests developed with the functional testing tool Ranorex Studio via GitLab-Runner (Windows / Shell). The testsuite is based on a .NET solution which is built via MSBuild.exe and the output (bin/debug/*.exe) will be executed with some parameters via command line.
Procedure:
Start gitlab-runner via PowerShell as administrator with "gitlab-runner run" command
Make some changes in GitLab-Repository to start the pipeline via .yml-File
Ranorex test-project is built successfully and is starting the GUI-tests
In the first run the user session is active and the tests are going to be executed and interacting with the GUI, but when i try to trigger the pipeline again for further runs, the user-session turns to false and there is no interaction with the GUI (black sceenshots in test-report).
Already did:
Screensaver disabled
StandBy-Mode disabled
User-Access-Control on lowest setting
Lock-Screen disabled
Secure-Login disabeld
Remote connections enabeld
Ports openend
Keep Session open via .batch-File, when closing RDP-connection
GitLab-Runner Service => Log on with respective AD-User (equipped with admin-rights)
AD-User is alway logged in on virtual machine
With Jenkins (Master / Slave configuration) everything works fine
Would be grateful for any help!
Does your Ranorex process close down properly with an exit code? Does the Application Under Test also close down properly at the end? I am assuming something has locked - you could try a bit of Powershell to close the processes before a test run. One thing I had to do was keep the screen on - using a utility like 'Caffeine'.

Automate tests on virtual machine without graphical session

Context :
I execute automated GUI tests on virtual machines (there are few of them) on running on windows and using UFT/Ranorex, executions are piloted by Jenkins.
Problem:
VM must have an active graphic session, otherwise, UFT won't run GUI tests (unable to launch browser) and Ranorex will run but poorly and without screenshots. i mean that in my tests, the VM is configured not to "sleep" or to have any screen saver, vm is connected with jenkins properly.
The behavior is : i launch via Jenkins the test, one the build done inthe vm, automation tools start running but then finds difficulties to open browser.
I would like to know if there is any workaround to run those tests without being needed to physically open VMware or Remote desktop Connection.
Notice that the VM is running all the time and the session is always open (we are using a server to host the VM).
So the problem is: how to simulate in windows active graphical session. I guess it's like simulating that there is actually a screen connected even though there isn't...
Any suggestions will be welcomed.
Had to go through this many times and you can find a lot of resources related to your issue in the Ranorex Forum. (My username there is Martin for reference).
But to go through the points you need to do quickly:
1) Have an RDP machine to connect to that is used to run your tests
2) You need to disable screen saver for that machine (I had to do it from registry)
3) Then disable the "On Resume, display logon screen" option under Personalize settings for the screen saver
4) And finally create a .bat script with the following content "%windir%\System32\tscon.exe RDP-Tcp#0 /dest:console"
So basically when you have everything set up (required only once) you will run the .bat script. This will close the RDP window BUT the session will be left open with the screen enabled.
Just connect the RDP with Jenkins and you have full functionality that you need to run your tests.
Regards
Martin
In the Tools ⇨ Options menu, select General ⇨ Run Sessions there you will find an option to Enable continued testing on locked/disconnected remote computers.
If this fails, see my other answer.
I had the same problem when I try to run an automate tests on virtual machine and I find this solution to generated a graphical session although you are not connected to the virtual machine. You need to created a task to opend a session on the virtual machine when you disconected or terminated the session , this created a graphical session but will not function when you are connected and you have the screen minimize. Here is the link for the solution and the explanation
http://blogs.microsoft.co.il/arnona/2016/01/03/keeping-an-active-desktop-session/

Black screen when taking screenshot with Internet Explorer driver on Windows build server

I am running several automated browser tests with selenium on our build server. There is no problems taking screenshots while running Chrome or Firefox driver, but when running Internet Explorer driver I just get a black screen.
Virtual Machine
Selenium version: 2.53.0
IEDriver: 2.53.0
OS:
Windows Server 2012
Browser:
Internet Explorer 11
I have gone through all the required configuration in the documentation https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver
I have also tried the third option here:
https://lostechies.com/keithdahlby/2011/08/13/allowing-a-windows-service-to-interact-with-desktop-without-localsystem/
I have also enabled service interaction globally:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683502(v=vs.85).aspx
When I remotely access the build server, I can trigger running the tests manually. This works fine. So there must be a problem with our CI(TeamCity) setup interacting with the build server.
I am currently stuck and could need some help ?
This is the default behavior of Windows. since Internet Explorer is tightly coupled with Windows, it behaves this way but other browsers don't.
In order to have better resource utilization, when running on remote, windows detects that since session is running in remote mode and nobody is watching the screen, it takes away the resources required to show the screen and screen goes black. When you log into the machine, resources to show screen UI are deployed again.
Hence, when running in remote mode, since there is no screen being showed, screenshot comes out to be blank.
There are only workarounds, no solution.
Workaround:
Workaround 1: Use VNC server for your remote session instead of RDP since VNC keeps the remote session alive.
Workaround 2: Add this command to batch file : tscon rdp-tcp#1 /dest:console
It will switch the session to "1" which is active mode.
By default it will be running on "0" mode. It will disconnect your session and now you can run your test case.

Automation: How to run some program on multiple windows 7 PCs?

I have an program which I need to run on multiple PCs (>100) all in same domain and share the same user and password.
If I run a program manually, it opens a console windows where I can see the logs running. I can remote desktop and still be able to see the console windows open and logs running. It helps in debugging as I can see whats going on. Issue is I want to avoid running it manually on all PCs.
I have following requirement
a. It should be able to run program on multiple pcs remotely
b. program should open in foreground where console logs can be seen.
c. launching PC should launch program on PC1 and then (without wait for the program to finish on PC1) it should launch the program on PC2 and so on.
I explored STAF it needs to be installed on all stations. Its heavyweight, needs complex configuration.
I explored power shell , it needs to be enabled on all stations and also probably (read somewhere) has issue with running tasks in foreground.
psexec can run the program but it does it in background, if I use -i option I need to give session id so only it will show the console for a specific remote desktop session. Another major issue with -i is that it will interactive so it waits until the program exits.
Looked a paexe, its simillar to psexe and doesn't solve the issue I am facing with psexe.
Any help is greatly appreciated.
If you have a server, you can put the program on the server and create a shortcut to it (assuming the program is small/simple enough to run on a network share).
You can use One-Click to deploy the programs, and give each of your users a link.
You can change the program into a website for central access.
You can use group policy to deploy the program when a user logs in, assuming you can create a .msi file from it.

How to run White + Teamcity (Winforms application)

I'm trying to run UI-tests (written using white). When I run them using NUnitConsole everything works fine. When I try to run them using TeamCity I get the following exception Test(s) failed. White.Core.UIItems.UIActionException : Couldn't find window with title Form1 in process 4132, after waiting for 5000 ms. What might be wrong? What could I do to make the test pass?
Not only does the build agent need to be set to interact with the desktop, but the desktop must be displayed in order for UI automation to work - desktop cannot be locked and screen saver must not be running. Is your agent on a headless machine? If you are using RDP to connect to the agent to check on things, when you close RDP, it locks the desktop. In this case, the automation will fail. Instead of using RDP, use a VNC viewer to log on to the box, rather than RDP, as VNC will not lock the desktop when you close it.
Another issue to consider is network access. If you are running TC agent as a service with access to desktop, then it will be running under service account which will not have access to network shares, etc... If this is a probelm, then you will not be able to run TC agent as a service, and will instead need to logon with a domain user and kick off the agent.bat file to start the agent.
Spent a lot of time solving this issue.
Main steps:
You need separate computer with teamcity build agend installed on it. Computer should have monitor and mouse.
The agent SHOULD NOT be launched and run as a Windows service (disable it if needed).
You should launch TeamCity build agent from .bat file (as administrator). To do this go to TeamCityBuildAgentfolder\bin and launch agent.bat file with start argument
Disable computer's screen sleep/lock after certain period of time. Your tests will require desktop for UI manipulations.
If you done everything right you should be able to see your build agent active in TeamCity's "Agents" menu.
You can also automate TeamCity agent launch (at selected user's logon):
Automate user's logon. More instructions here
Create task in Task Scheduler which will launch build agent at user's logon with administrative rights (with highest privileges)
Make sure that the user who will logon automatically has all neccessary permissions (run the scripts, perform file operations etc.)
IMPORTANT!
Running UI tests in such way is a potential security hole so make sure that the non-authorized people have no acccess to computer that runs this tests.
Remember that for running your UI test the computer SHOULD NOT be locked or be in sleep mode.
You probably have to make the Teamcity build agent interact with desktop.
Run -> services.msc -> Select TeamCity Build agent and right click -> Properties -> Log On tab -> Check "Allow service to interact with desktop"
Edit:
If that doesn't work, stop the agent service, go to Build Agent folder ( c:\teamcity\buildagent\bin ? ) and issue agent.bat start and then trigger the tests.
There is recommendation to run the UI tests on virtual machines.
Seems as most reliable solution.

Resources