[Resolved] Kill application in real devices. App is already running

Hi,

For tests with real devices for iOS7 the application doesn’t get killed between runs (as it happens in simulator p.e.).

I get the message:

Executable “app_name” is already running as process XXX which was launched from the ‘launchd’ process

I’m using rspec to launch the automatic test, so the only option I have now it using only one xxx_spec.rb file and even only one describe call, because for each describe it will attempt to re-launch the application.

And mainly when a test fails I cannot re-launch to continue the other tests, so it will probably be stuck in some sub-page and all the other tests will also fail, so in the morning I have no useful report on tests.

Any solution for this? This seems to be a huge issue on appium.

Thanks,
Telmo Cardoso

Hey,

Still no comments on this?

Has anyone ever used cucumber f.e. with ios7 real device? How is it possible to run 2 features in a row? Because appium tries to restart app and then will fail in the error I showed in previous comment.

Any thought? Its possible not to kill app between features? I tried playing around with noReset, fullReset, autoLaunch, etc. and cannot make it happen.

Thx,
//Telmo

you may want to kill the appium process and re-launch it before running the next test. try using this command:

osascript -e tell application “Terminal” to do script “killall -9 node”

Command in starting appium:
osascript -e tell application “Terminal” to do script “appium &”

This should be in your code.

I tried that. It wont work, because the app will still be in the iphone in the background and so the “new” appium server will again not be able to touch it.

can you post some code how you launch your application?

Normally I just launch appium server:

appium -p 4730

Then I run the tests, currently I’m using either rspec or cucumber, like:

cucumber features

This way it will run the first feature properly and then when going to the second feature it wont be able to re-launch the app.

My appium.txt is

[caps]
platformName = "ios"
app = "/Users/wcs_mac/Desktop/appium/ios/MessagePlusAppium.ipa"
deviceName = "WIT Demo iPhone 5C VI"
udid ="39bcf05aabb1bddf783b79d452cca052b32e2f2f"
bundleId = "com.witsoftware.messageplus"

[appium_lib]
sauce_username = false
sauce_access_key = false
port = 4730

@Telmo_Cardoso

Have you tried closeApp() or resetApp() ?

I have tried combinations of

restart
close_app
launch
reset

and nothing works because at max it sends the application to background and doesn’t kill it. As you probably know apps dont get killed from >ios7, we have to do it manually.

So I had to make a completely idiot but functional workaround in order to run n features during the night and have jenkins call them on multijobs plugin.

This is the way I kill the app after every feature ends:
Pre-condition:

  • Turn on AssistiveTouch in General -> Accessibility -->AssistiveTouch ON
  • Place the icon on a place that will not interfere with yours tests
  1. Tap the coordinates where you left the AssistiveTouch icon
  2. Double tap the home button icon
  3. Swipe up your application and by so effectively killing it

The next feature will launch your app again without any problems.

@Telmo_Cardoso

I always get the co-ordinates of Assistive touch as -2 and 5

a=driver.find_element(:xpath,“//*[@name=‘Double-tap to open’]”)
x=a.location.x
y=a.location.y
execute_script ‘mobile: tap’, :tapCount => 1, :touchCount => 1, :duration => 0.9, :x => x, :y => y

the above code does not work … can you please your code?

I left my assistive on fixed coordinates, so I just had to play on console until I found what those were and those are hard coded on constants in the code :slight_smile:

How do you Double tap the home button icon ?

Thats out of context :slight_smile: If you see above I was using “AssistiveTouch”. Anyway, these days there is one command to terminate app:

driver.terminateApp(bundleId);

You can see more in Kill and Relaunch app in Appium