I have calabash-android set up working perfectly with a default scenario (using cucumber
to run tests or calabash-android console
to enter REPL mode).
However, under some scenarios, it turns out to be pretty useful to be able to attach to an app that's already running. For instance, I would start an app in debug mode and start the tests to be able to set breakpoints and check why certain features don't work as expected in my scenarios.
When it comes to Calabash on iOS, this task is really straightforward: no additional preparation needed as the app starts with a test server bundled in and I can attach calabash to it at any time. However, Calabash Android seems to be force-quitting the app every time I try to start calabash having the app running.
Is there any way around it?
EDIT Looks like the below answers didn't help much, but I still hope someone (calabash devs, where are you?) will stumble upon this one day. I have spent some time discovering the issue myself, and that's what the specific issue is:
- Start the app in Debug mode (using Xamarin, for instance)
- Start
calabash-android console PATH_TO_APK
- Try issuing any commands (e.g.
query("*")
) – it fails with a message KeepAliveDisconnected - Try running start_test_server_in_background – the app is killed and debug session is terminated
Digging deeper into details, I found out that start_test_server_in_background in fact runs shell am instrument
with sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner
being instrumentation backend and a bunch of other flags describing which app to instrument, what port to use etc.
Thus being said, the following would help a lot: is it possible for shell am instrument to attach to a running app?