Android Automation fails from Jenkins Slave PC.

Ask general questions here.
stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Android Automation fails from Jenkins Slave PC.

Post by stapes » Wed Mar 16, 2016 12:58 pm

This has only just started occurring, and I don't know why.

I can run my app on the Android device from my development PC no problem. This is the one with the node-locked license.

It fails waiting for the device when I try to run it from Jenkins: Device WaitFor(DeviceConnected) timed out. ConnectTimeout: 00:05:00

The Jenkins Slave PC has the Floating License.

The only thing can think of that may have changed is that I Re-Instrumented the Application on this device yesterday.

Why is it failing?

It must be something to do with the device (a Samsung Galaxy tablet) because when I switch it to run on the 'Nexus 4' it works!
$varAndroidDevice = 'GT-N5110', $varAndroidApp = 'uk.co.documotive.mobile.documobile.agile'
[2016/03/16 12:57:08.091][Info ][Info]: Starting Android App: uk.co.documotive.mobile.documobile.agile on Device: GT-N5110
[2016/03/16 12:57:08.139][Info ][Log]: Starting Android App: uk.co.documotive.mobile.documobile.agile on Device: GT-N5110
[2016/03/16 13:02:08.462][Error ][Module]: Device WaitFor(DeviceConnected) timed out. ConnectTimeout: 00:05:00

Code: Select all

Report.Log(ReportLevel .Info , "Log", "Starting Android App: " + varAndroidApp + " on Device: " + varAndroidDevice);
            
bool resetInitialState=true ;
         
Host.Local.RunMobileApp(varAndroidDevice, varAndroidApp,resetInitialState);
            
Report.Info ("Android","Android App: " + varAndroidApp + " started on Device: " + varAndroidDevice);
The previous module - which also tries to run the app - was successful:
[2016/03/16 12:57:01.260][Info ][Info]: Adding device: GT-N5110, IP Address: 172.16.182.174.
[2016/03/16 12:57:01.332][Info ][Info]: Wait for device: GT-N5110, IP Address: 172.16.182.174 to be connected.
[2016/03/16 12:57:05.377][Info ][Info]: Device: GT-N5110, IP Address: 172.16.182.174 connected.
[2016/03/16 12:57:07.871][Info ][Info]: Device: GT-N5110, IP Address: 172.16.182.174. Wait for 365Agile to run.
[2016/03/16 12:57:07.960][Info ][Info]: Device: GT-N5110, IP Address: 172.16.182.174 365Agile connected.
Code:

Code: Select all

string deviceName=varDeviceToAdd ;
        	string ipAddressOfDevice=varDeviceIpAddress ;
        	
        	Report .Info ("Info","Adding device: " + deviceName + ", IP Address: " + ipAddressOfDevice + ".");
        	
        	var device = RemoteServiceLocator.Service.AddDevice(  
			    deviceName,   
			    RemotePlatform.Android,   
			    RemoteConnectionType.WLAN,   
			    ipAddressOfDevice);  
        	
        	Report .Info ("Info","Wait for device: " + deviceName + ", IP Address: " + ipAddressOfDevice + " to be connected.");
        	
			device.WaitFor(ChannelState.DeviceConnected);   
			
			Report .Info ("Info","Device: " + deviceName + ", IP Address: " + ipAddressOfDevice + " connected.");
			
			var firstApp = device.RanorexCompatibleApps[0];  
			
			device.StartApplication(firstApp);  
			
			Report .Info ("Info","Device: " + deviceName + ", IP Address: " + ipAddressOfDevice + ". Wait for " + firstApp.DisplayName .ToString () + " to run.");
			
			device.WaitFor(ChannelState.AppConnected);  
			
			Report .Info ("Info","Device: " + deviceName + ", IP Address: " + ipAddressOfDevice + " " + firstApp.DisplayName .ToString () + " connected.");

stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Re: Android Automation fails from Jenkins Slave PC.

Post by stapes » Thu Mar 17, 2016 12:38 pm

Amazingly, I have found a temporary workaround for this problem by removing the second Run Application command. The app just happens to be already running because it is the first Ranorex enabled app the automation finds. Of course this will not work if that changes.
I still don't understand why the above example (in the original post) worked on my development PC but not the Jenkins slave.

jma
Posts: 107
Joined: Fri Jul 03, 2015 9:18 am

Re: Android Automation fails from Jenkins Slave PC.

Post by jma » Fri Mar 18, 2016 3:14 pm

Do you use WiFi or USB connection? I would suggest trying WiFi to narrow down the cause of the issue. Let me know the result.