Why does UFT run in the background when using Jenkins batch call - jenkins

I configured Jenkins to run UFT in windows server 2003, but UFT is executing in the background. I can see the UFT process in task manager, how can I run it in the foreground instead of the background?
(ps: I did the same configuration on Win7, UFT will run in the foreground properly)
Win 7 config

On the host computer, you should right click on the Unified Functional Testing Remote Agent and click Settings. This will bring up a window that includes a section for Test Handling. You should choose the not run the UFT in hidden mode(uncheck the selection box)
Please refer to this article for more details. Reference Article

Related

UI issues while executing UFT test via Jenkins

I am having Jenkins running as a service and have a job to execute UFT tests on a remote slave. As part of the pipeline I am required to un-install our product, restart the slave, install the product (latest version) and start the test execution.
Since UFT tests need a dedicated UI, I am trying to launch a mstsc connection to the test VM from a temp VM. But since Jenkins is running as a service the mstsc process runs as a background process on the temp VM. Due to this UFT tests don't get a dedicated UI and some of the tests fail.
Tried running Jenkins using the war file instead of service. But after 30-40 mins or so the master slave connection drops.
Any workaround / tweak would be appreciated.
you need to run your jenkins remote agent(war) as a normal Process and not as a service, otherwise, as you mentioned there is no Desktop for them.
My Proposal:
Make sure the jenkins remote agent is running as a normal OS process (on both VMs). You can have a Windows Scheduled Task that launches this Process on Logon and Checks every 5 minutes if it is still alive (if not restarts it)
After the Temporary VM (Let's call it a Gateway) woke up your Test VM, the Test VM should execute a tscon command which will redirect the currently active RDP Session to the console (the Physical Monitor - which on Virtual machines well it's virtual). This will help you having your UI Session alive until the next restart, without having to bother about the Gateway
tscon here. Example: tscon rdp-tcp#1 /dest:console This can be solved again with a Scheduled Task which is executed At Logon (waiting a few Seconds just to make sure)
Have Caffeine.exe or MouseJiggle.exe running in the background as Processes (also launched at Logon) on your Test Computers to make sure the SCreen is never Locked or any Screen Saver is activated. Both tools are free.
If your Jenkins Connection drops that is a different issue has nothing to do with UFT. In my case this combination works perfectly fine. It is also easy to automate the installation of these things. Windows Batch and Vbs can do all these things for you. (Putting the mentioned tools to your %PATH% and creating Scheduled Tasks Programmatically)
** Bonus Tipp: In order to avoid a taskkill java.exe command killing your remote agent, you can simply rename the java.exe of your jvm to jenkins_remote_agent.exe and use that as your jenkins remote agent executable
UFT requires an interactive session for some Win32 operations.
In the Tools ⇨ Options menu, select General ⇨ Run Sessions there you will find an option to Enable continued testing on locked/disconnected remote computers, this may help in your case too.

Jenkins foreground task

I have two Jenkins machines.
Both run windows batch commands
When I start programs on one, they start in the background (Staging box).
When I start programs on the other, they start in the foreground, and you can see the window and watch the program as it's running (Production box).
I'm trying to test a program which only works in the foreground (it's a Cocos game executable and probably needs to be in the foreground to run properly).
I need to know what Jenkins-settings to change so that my staging-Jenkins box behaves the same as my Production-Jenkins box.
I have already tried:
The jenkins windows service is running as the currently logged in user.
Most other questions talk about forcing it to the background, which is the opposite of my problem.
Finally figured it out.
If you are running Jenkins as a Windows service, then the service is running in the background, and thus the programs started by Jenkins will also be run in the background.
If you run Jenkins in the foreground (Ie, typing "java -jar jenkins.war" in a console window), then programs started by Jenkins will also be in the foreground (since the foreground console window is the Jenkins process).
Jenkins-Slaves run as a service, but they run with a foreground window, so they show up in the foreground of the slave machine.
No need to run jenkins as jar. Rather one can configure the same system(master/ or some other system) as slave in Manage Jenkins -> Manage Nodes. Then connect the slave system with master.
In the jenkins job configuration, select node name in the job general configuration section mentioning the slave system where job will be running.
Then build the job. It worked for me.

Webdriver with Jenkins

Selenium test (testNg) with mvn test from jenkins ,
I cant view the action performed on the browser, it is possible to view the real browser opened and performing action?
I suggest using SeleniumGrid.
You can then let the test run on a node, where you can see all the browser actions. For demonstration purposes, distributed and independent testing I did similar with teamcity for a regression-test project.
Basically there are two steps to setup the environment:
Start the grid for example as background-service.
Start a node which is running within a logged on user context (also as Service or autorun)
optional: Start another node for running tests in background
In your tests the creation of the the WebDriver instance changes like this:
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
Here a link for more details to setup the Grid2: https://github.com/SeleniumHQ/selenium/wiki/Grid2
No. In typical setup, tests from Jenkins run on randomly available node. You don't know which node is available at a given point. Also typically Jenkins nodes tend to run headless browsers (like phantomjs) since they don't have displays.
Jenkins tests are meant to be run without any manual intervention, like on nightly basis for example. You develop tests locally, see how they run in a real browser and then push it to your main suite so that Jenkins can run it for you. If you want to run tests from Jenkins and view test running live then look for paid solutions like saucelabs or browserstack.
You can using BrowserStack. We have recently released a Plugin that allows you to view your test results right inside Jenkins. It's a paid tool of course :(
In Windows you should not install jenkins as windows application (because in this recent version, Microsoft decided to give services their own hidden desktop even you enable the functionality "interact with desktop" in jenkins service), you may have to deploy it from a war file as follows:
1) Download jenkins.war from Jenkins official site
2) Deploy it by the command prompt : java -jar {directoryOfJenkinsFile}/jenkins.war
3) Now you can access jenkins administration on http:// localhost:8080
Hope that helps you !

Configure Jenkins to Execute tests in UFT

I am running UFT Test Suite manually on the host machine, however i now have the requirement to run the smoke tests as soon as the new build is delivered in jenkins. For that i need to run the test suite automatically using Jenkings. Can someone help me in the direction, how this can be achieved? I have never used Jenkins before.
Looks like theres a plugin for Jenkins which enables integration with HP UFT. Take a look at the Jenkins wiki page for instructions about how to install and use it.
As you didn't mention that you are using ALM so I am assuming that you have some kind of driver script in vbs which runs your test suite. You do not necessarily require any plugin in jenkins to run your UFT suite(however you can also check the suggestion given in the previous answer). Create a job in jenkins and call your vbs file (driver file) or a bat file which kicks off your execution your test machine.
Your test execution machine can be configured as jenkins slave. Only thing which you need to take care off is to remove the settings which can let go your jenkins slave machine which is your uft execution machine in standby mode or locked user mode(uft scripts will fail otherwise). You can handle this by configuring windows settings(if admin allows) or by using some small scripts to move mouse after some intervals.
Your test execution job in jenkins(master) machine can be made dependent on the job which goes to success when new build is available. As soon as new build is available - that job goes to success then your Test job gets notified and connects to UFT execution machine(slave) and starts running your test.
I am trying to integrate ALM with jenkins but not working
Started by user admin
Running as SYSTEM
Building in workspace C:\JENKINSHOME\workspace\CLRP_AUTO_RN
[CLRP_AUTO_RN] $ C:\JENKINSHOME\workspace\CLRP_AUTO_RN\HpToolsLauncher.exe -paramfile props05092020010832244.txt
"Started..."
Timeout is set to: -1
Run mode is set to: RUN_PLANNED_HOST
Unable to retrieve test set folder: Node not found.
Node not found.
Starting test set execution
Test set name: CLRP Smoke Test Automation Run, Test set id: 104
Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Could not create scheduler, please verify ALM client installation on run machine by downloading and in installing the add-in form: http://almserver:8080/qcbin/TDConnectivity_index.html
Build step 'Execute Micro Focus functional tests from Micro Focus ALM' changed build result to FAILURE
Finished: FAILURE

How to run jenkins job as a system user?

Rightnow, my jenkins jobs are run by Tomcat Server user.
I wanted it to run as User 'Admin', so i tried creating a slave and
added my same jenkins machine as the slave.
I have also added this as a windows service, and have confiured the
Admin user/pwd in the Logon Tab.
But still, when i run a job which executes the UI tests, i'm not able
to see them running in the firefox but it runs and the screenshots
are captured!
Are you asking how to have Jenkins spawn a process in your session that you can see at the monitor?
Have a look here: Open Excel on Jenkins CI, replace excel with whatever you are launching.
If you use jenkins as windows service, it won't allow GUI execution.
It only allows backgound running jobs.
If you want run UI test then stop your jenkins service , use some other way to connect your slave.

Resources