Backdoor concept in Appium (like in Calabash) for UI testing

1.3k views Asked by At

In Calabash you can implement a backdoor, i.e., a way to call a method in the app delegate during test case execution. This makes it possible to simulate non-UI/external events like a Bluetooth device to appear/disappear, etc. in simulator.

(I understand the backdoor concept is possible because Calabash-server is linked into the executable. Appium executes tests on the an untouched executable.)

Is a similar concept available in Appium? If not what are the alternatives then?

(I couldn't find anything in the Appium documentation.)

4

There are 4 answers

0
Ian On

We support this in a framework called Illuminator (full disclosure, I am the author), with an RPC channel called the automation bridge.

When instruments runs, we use the performTaskWithPathArgumentsTimeout function to call our script, which relays our supplied arguments to the running app (on simulator or on hardware). Any data returned from the app is relayed back to UIAutomation.

0
sebnil On

I just finished a project to do just this. In my case I needed to simulate some Bluetooth events. My apps are for Android and iOS, and they are written in C# using the Xamarin framework. The backdoor is accessed with Python or Robot Framework. But in the end it is just a MQTT server, so it would be possible to implement in other languages. I am sharing it here because others might find it useful: https://github.com/sebnil/appium-mqtt-backdoor

It is not really a pure Appium solution, and more like a workaround. I found no robust way to implement a backdoor in Appium and make it work for both Android and iOS. But principally it works just the same when it comes to writing test cases in python or Robot Framework.

0
sebnil On

I had a very similar problem when developing iOS and Android apps in Xamarin, and testing them in Appium. Basically I found no robust way to implement a backdoor that would work the same in both Android and iOS.

You can do a backdoor into Android applications if you use the Espresso driver: https://appiumpro.com/editions/51

I went with the solution of adding the backdoor into the test framework itself. So instead of implementing the backdoor in Appium, I implemented it in Python and Robot Framework (both of which can be used to control Appium). Basically the backdoor is implemented via a MQTT broker. More information here: https://sebastiannilsson.com/blog/appium-mqtt-backdoor/

1
Alex Maimescu On

I have written a library in order to get a backdoor concept in my Appium setup. It is called Insider.

It includes the following features:

  • Send a message to the app from a remote script;
  • Send a message to the app from a remote script and wait for response;
  • Send local notifications through NSNotificationCenter with given parameters from a remote script;
  • Get device system state information (CPU, memory, IP address, etc) while running tests;
  • Manage files / directories in application sandbox (Documents, Library, tmp) while running tests;

GitHub: https://github.com/alexmx/Insider
API reference: http://alexmx.github.io/Insider/