Failed to find item when test is run by Jenkins

Ask general questions here.
tvu
Posts: 195
Joined: Tue Apr 07, 2015 10:47 pm

Failed to find item when test is run by Jenkins

Post by tvu » Tue May 19, 2015 7:17 pm

Hello Support,

I am automating an iOS mobile application. My test runs fine when I manually start it via the command line, but it fails to find the repository item when I try to run the exact same test via Jenkins.

I have a global parameter that identifies my device and it is in the base path of my repository: @devicename = $mobileDevice. When I run my test on the command line, I pass in the value for $mobileDevice with the following argument "/pa:mobileDevice=iPhone5". I've tried testing this with a device attach via USB on the Ranorex Runtime machine and with the iOS Simulator running on a Mac. The Service App is installed on the physical phone, but not on the iOS Simulator. Also, our application is running and is in focus when I kick off the test.

My Jenkins CI build setup is as follows:
Master - Mac, 10.10.3
Slave - PC, Windows 7
Ranorex 5.3.1.22939

On the Slave PC, Jenkins is not running as a service, but started with a batch file placed under the Startup folder. The PC automatically logs in with a the user when it boots up. When I kick off the test via Jenkins, on the Slave PC I can see the Ranorex pop up showing the test is running. Additionally, the $mobileDevice variable is getting resolved correctly because I can see the value in the report.

On another note, where is the device information saved? I want to put this information under Source Control so that it automatically gets distributed to all the Runtime PCs.

Thanks for the help,
Tung

tvu
Posts: 195
Joined: Tue Apr 07, 2015 10:47 pm

Re: Failed to find item when test is run by Jenkins

Post by tvu » Tue May 19, 2015 9:05 pm

Some additional information:
- I grabbed the item path from the failure report and put it in Ranorex Spy. Ranorex Spy was able to find the item.
- I am running the EXE file from Jenkins in the "Execute Windows batch command" build step.

tvu
Posts: 195
Joined: Tue Apr 07, 2015 10:47 pm

Re: Failed to find item when test is run by Jenkins

Post by tvu » Tue May 19, 2015 10:39 pm

So I created a new test solution on the Runtime PC. There are two recordings:
1 - Launches the RxBrowser on the mobile device, loads Yahoo and then does a search.
2 - Launches a Desktop browser, loads Yahoo and does a search

I ran it in Ranorex Studio, Test Runner and via the command line and it runs fine.

I was lazy and didn't want to setup a new Jenkins job just to run this EXE so I edited my current job. I put the following in the "Execute Windows batch command" section of the Jenkins build step:
cd C:\Jenkins\Ranorex\TestSolution\TestSolution\bin\Debug
TestSolution.exe

The recording for the Desktop browser ran fine, but I received the following error for the recording dealing with the mobile RxBrowser:
"Cannot start mobile app 'ranorex.RxBrowser' because there is no device with name 'iPhone' in the list of configured devices."

Is there an issue keeping the EXE outside of the workspace for the Jenkins job? Also, where is file containing the list of devices?


Thanks.
Tung

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Failed to find item when test is run by Jenkins

Post by krstcs » Wed May 20, 2015 3:43 pm

In the Jenkins job, make sure that the batch "cd"s into the directory where your test is before it runs the test.
Shortcuts usually aren't...

tvu
Posts: 195
Joined: Tue Apr 07, 2015 10:47 pm

Re: Failed to find item when test is run by Jenkins

Post by tvu » Wed May 20, 2015 4:05 pm

Yes, I am already doing that.

tvu
Posts: 195
Joined: Tue Apr 07, 2015 10:47 pm

Re: Failed to find item when test is run by Jenkins

Post by tvu » Wed May 20, 2015 8:06 pm

I found the issue. For Ranorex mobile automation, there appears to be an issue when you have a Jenkins Mac Master and Jenkins PC Slave. Ranorex fails to find the mobile device or iOS Simulator when a Mac Master kicks off the build job on a PC Slave.

I setup a new Jenkins PC Master to kick off the test on the existing Jenkins PC Slave. This setup allowed the test to run on my mobile device and on the iOS Simulator.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Failed to find item when test is run by Jenkins

Post by Support Team » Thu May 21, 2015 9:58 am

Hello tvu,

Thank you for sharing your experience :)

Regards,
Robert
.
Image