driver.removeApp(appIdentifier); doeasn't work after upgrade to appium 1.5.3

Hi,
Our ENV includes:

  • Appium 1.5.3
  • Java-Client 4.0.0
  • TestNG 6.9.9
  • Testing on a real device (iPhone 5S, iOS 9.3.2)

When the after suite method executes the driver.removeApp(appIdentifier) it fails (see appium server log below).
Any idea if it is a bug in the 1.5.3 version & if there is a workaround?

2016-06-14 12:22:59:852 - [HTTP] --> DELETE /wd/hub/session/55d4a3db-e297-4be7-a3ec-ee5d786f574b {}

2016-06-14 12:22:59:853 - [MJSONWP] Calling AppiumDriver.deleteSession() with args: ["55d4a3db-e297-4be7-a3ec-e…

2016-06-14 12:22:59:856 - [debug] [iOS] Deleting ios session
2016-06-14 12:22:59:858 - [debug] [UIAuto] Destroying instruments client socket.
2016-06-14 12:22:59:859 - [debug] [UIAuto] Closing socket server.

2016-06-14 12:22:59:863 - [debug] [UIAuto] Instruments socket server was closed
2016-06-14 12:22:59:866 - [debug] [Instruments] Starting shutdown.

2016-06-14 12:22:59:867 - [debug] [Instruments] Sending sigterm to instruments

2016-06-14 12:22:59:909 - [debug] [Instruments] [INST] 2016-06-14 09:22:59 +0000 Stopped: Script was stopped by the user

2016-06-14 12:22:59:950 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:22:59 SG-iPhone-5s SpringBoard[54] : HW kbd: Failed to set (null) as keyboard focus

2016-06-14 12:22:59:955 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:22:59 SG-iPhone-5s SpringBoard[54] : Unable to get short BSD proc info for 1639: No such process

2016-06-14 12:22:59:956 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:22:59 SG-iPhone-5s SpringBoard[54] : HW kbd: Failed to set (null) as keyboard focus

2016-06-14 12:22:59:957 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:22:59 SG-iPhone-5s SpringBoard[54] : Unable to get short BSD proc info for 1639: No such process

2016-06-14 12:22:59:962 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:22:59 SG-iPhone-5s SpringBoard[54] : UNNotificationRegistrarConnectionListener connection invalidated

2016-06-14 12:22:59:962 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:22:59 SG-iPhone-5s SpringBoard[54] : UNNotificationRegistrarConnectionListener connection invalidated

2016-06-14 12:23:00:196 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:23:00 SG-iPhone-5s com.apple.xpc.launchd[1] (UIKitApplication:beta.SkyGiraffe.SkyGiraffe[0xf664][1639]) : Service exited due to signal: Killed: 9

2016-06-14 12:23:00:197 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:23:00 SG-iPhone-5s com.apple.xpc.launchd[1] (UIKitApplication:beta.SkyGiraffe.SkyGiraffe[0xf664][1639]) : Service exited due to signal: Killed: 9

2016-06-14 12:23:00:350 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:23:00 SG-iPhone-5s SpringBoard[54] : Application ‘UIKitApplication:beta.SkyGiraffe.SkyGiraffe[0xf664]’ exited abnormally via signal.
2016-06-14 12:23:00:351 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:23:00 SG-iPhone-5s SpringBoard[54] : Application ‘UIKitApplication:beta.SkyGiraffe.SkyGiraffe[0xf664]’ exited abnormally via signal.

2016-06-14 12:23:00:355 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:23:00 SG-iPhone-5s UserEventAgent[23] : 2845376309515: id=beta.SkyGiraffe.SkyGiraffe pid=1639, state=0

2016-06-14 12:23:00:356 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:23:00 SG-iPhone-5s UserEventAgent[23] : 2845376309515: id=beta.SkyGiraffe.SkyGiraffe pid=1639, state=0

2016-06-14 12:23:00:418 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:23:00 SG-iPhone-5s searchd[160] : ====^^^^ DuetExpert missing data, count -> people:0 applicationDeepLinks:0 applications:8 requests:576 missingAllDataRequests:1

2016-06-14 12:23:00:420 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:23:00 SG-iPhone-5s searchd[160] : ====^^^^ DuetExpert missing data, count -> people:0 applicationDeepLinks:0 applications:8 requests:576 missingAllDataRequests:1

2016-06-14 12:23:03:378 - [debug] [Instruments] [INST STDERR] 2016-06-14 12:23:03.373 instruments[21425:3025903] Attempting to change event horizon while disengage

2016-06-14 12:23:04:871 - [iOS] Instruments didn’t shut down. Error: Instruments did not terminate after 5 seconds!

2016-06-14 12:23:04:875 - [debug] [iOSLog] Stopping iOS log capture

2016-06-14 12:23:04:878 - [debug] [iOS] Running ios real device reset flow
2016-06-14 12:23:04:909 - [Appium] Removing session 55d4a3db-e297-4be7-a3ec-ee5d786f574b from our master session list
2016-06-14 12:23:04:912 - [debug] [MJSONWP] Received response: null

2016-06-14 12:23:04:914 - [debug] [MJSONWP] But deleting session, so not returning
2016-06-14 12:23:04:915 - [MJSONWP] Responding to client with driver.deleteSession() result: null
2016-06-14 12:23:04:918 - [HTTP] <-- DELETE /wd/hub/session/55d4a3db-e297-4be7-a3ec-ee5d786f574b 200 5064 ms - 76

2016-06-14 12:23:10:421 - [debug] [Instruments] [INST] Instruments Trace Complete (Duration : 545.932434s; Output : /var/folders/wz/bmlkwsw57jbbmyk7dgyxhwd80000gn/T/appium-instruments/instrumentscli0.trace)

2016-06-14 12:23:10:789 - [debug] [Instruments] Instruments exited with code 0

2016-06-14 12:23:10:804 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:23:10 SG-iPhone-5s DTServiceHub[233] : Could not create service named com.apple.instruments.server.services.processcontrol.posixspawn

2016-06-14 12:23:10:810 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:23:10 SG-iPhone-5s notification_proxy[159] : 0x16e087000 -[MNPLockdownConnection receiveMessage]: lockdown_receive_message error!

2016-06-14 12:23:10:823 - [iOSLog] [IOS_SYSLOG_ROW] Jun 14 12:23:10 SG-iPhone-5s notification_proxy[159] : 0x16e12f000 -[MNPLockdownConnection receiveMessage]: lockdown_receive_message error!

@menypeled: Could you please share your code?
Seems your session is getting deleted even before removeApp is called.

I found that the driver.quit() was executed before the remove method so seems that you were right however if I call the driver.isAppInstalled before the remove I get an exception.

this is the tearDown code in the after suite:
boolean isAppInstalled = driver.isAppInstalled(appIdentifier);
if (isAppInstalled) {
driver.removeApp(appIdentifier);
}

Appium Log:
2016-06-14 14:59:46:675 - [HTTP] --> GET /wd/hub/status {}

2016-06-14 14:59:46:676 - [MJSONWP] Calling AppiumDriver.getStatus() with args: []

2016-06-14 14:59:46:713 - [MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:“1.5.3”…

2016-06-14 14:59:46:714 - [HTTP] <-- GET /wd/hub/status 200 38 ms - 83

2016-06-14 14:59:47:479 - [HTTP] --> POST /wd/hub/session/347abf3b-f412-4da2-b0c4-33ee974ccd89/appium/device/app_installed {“bundleId”:“beta.SkyGiraffe.SkyGiraffe”}

2016-06-14 14:59:47:480 - [MJSONWP] Calling AppiumDriver.isAppInstalled() with args: ["beta.SkyGiraffe.SkyGiraff…

2016-06-14 14:59:47:480 - [debug] [iOS] Executing iOS command ‘isAppInstalled’
2016-06-14 14:59:47:483 - [HTTP] <-- POST /wd/hub/session/347abf3b-f412-4da2-b0c4-33ee974ccd89/appium/device/app_installed 501 3 ms - 122

Sorry @menypeled, I don’t see any exception in the log that you posted.

Right, but once the first row executed it jumps to the catch so it seems that instead of retrieving True/False if fails.

	boolean isAppInstalled = driver.isAppInstalled(appIdentifier);
		if (isAppInstalled) {
			driver.removeApp(appIdentifier);
		}

	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

So that means, driver.quit() may be uninstalling your app. Try --no-reset when starting Appium.

I remove the driver.quite so i don’t think it is related.
Regard the “–no-reset when starting Appium.” I guess you mean when running the appium server from code however I run it from Appium client.

In your capabilities, set noReset to true.