Posted by Tobias Walter on Thursday, February 14th, 2013 at 8:51 am to Improve Object Recognition

This blog post illustrates how to automate testing of cross-platform apps implemented with Xamarin.iOS (MonoTouch) and Xamarin.Android (Mono for Android) with Ranorex.

Automate Xamarin.iOS and Xamarin.Android Cross-Platform  App Testing


Xamarin.iOS and Xamarin.Android, both developed by Xamarin, are commercial implementations of Mono – a cross-platform implementation of C# – for iPhone and Android-based smartphones.

Using these two implementations it’s easy to reuse most of your existing code when porting from Android to iOS or vice versa. Next to that it’s possible to import existing .NET libraries and to use them in your Android/iOS apps.

Ranorex supports test automation for both, Xamarin.iOS and Xamarin.Android. Simply follow the steps below to make your cross-platform app testable.

Make Your Xamarin.iOS App Testable with Ranorex

Note: With Ranorex 5.3.0 and higher, Xamarin.iOS apps can be instrumented using the Ranorex Instrumentation Wizard.

To manually instrument your Xamarin.iOS app you simply have to add the Ranorex automation library for iOS to your MonoTouch project as native library.
Add Library as Native Lib


Open the projects options and set the following additional arguments (not necessary when working with simulator only):

-cxx -gcc_flags "-framework QuartzCore -framework CoreGraphics -framework IOKit"

Additional Arguments

Make Your Xamarin.Android App Testable with Ranorex

Note: With Ranorex 5.0.0 and higher, Xamarin.Android apps can be instrumented using the Ranorex Instrumentation Wizard.

To manually instrument your Xamarin.Android app simply follow the step by step instructions below.

  • Add the Ranorex automation library for Android (<RanorexInstallDir>\bin\RxEnv\Android\Ranorex.jar) to your Xamarin.Android project.
    Add Ranorex Automation Library 1
    Add Ranorex Automation Library 2
    Copy Ranorex Automation Library
  • Open the properties of the added file and set the build action to “AndroidJavaLibrary”.
    Set Build Action 1
    Set Build Action 2
  • Download the file RanorexAndroidMonoInstrumentation.cs and add it to your project (the same way as described in the first step).
  • Add the following lines of code to each activity in your project:
    public override bool DispatchKeyEvent (KeyEvent e)
      return base.DispatchKeyEvent (e);
    protected override void OnResume ()
      base.OnResume ();
    protected override void OnPause ()
      base.OnPause ();
  • Open the properties of your project and add a new “Android Manifest” in the “Mono for Android Application” area.
    Add a Manifest
  • Add “(RxInstrumented$4.x.x)” to the version name (whereas 4.x.x is the Ranorex version you are using) and activate the check boxes “INJECT_EVENTS” and “INTERNET” in the “Required permission” area.
    Update Manifest


Following these simple step by step instructions will make your Xamarin.iOS and Xamarin.Android apps accessible for Ranorex and nothing should be standing between you and your robust cross-platform test automation.

To get started with mobile test automation, have a look at the chapters “Android Testing” and “iOS Testing” in our user guide.

The following two tabs change content below.

Tobias Walter

Online Marketing and Content Specialist at Ranorex
Tobias Walter is Online Marketing and Content Specialist at Ranorex GmbH. Next to his marketing activities he also writes articles published in several blogs and journals.

Tags: , , , , ,


  1. Anoop

    We have an issue with integrating the tool with our iPhone and iPad applications developed using Xamarin. Can you please help us in fixing this issue? and following are the steps performed by us:

    1. We created a sample app (eg: Adding a value to the list) using the Xamarin for iPad and iPhone.
    2. Added the Ranorex Automation Library ‘libRxAutomationUni_405.a’ as Native library.
    3. Added the additional arguments in the project options “-cxx -gcc_flags “-framework QuartzCore -framework CoreGraphics”
    4. Built the app. App launches in Simulator/iPhone and the device gets listed in the ‘Manage Devices’ of Ranorex app.
    5. Next, we tried the same steps 1-4 for our client’s iPhone and iPad applications.
    6. Application fails to launch and we are getting null errors on UIApplication.SharedApplication.Delegate but UIApplication.SharedApplication returns the app.
    7. Now, we removed the Ranorex Automation Library ‘libRxAutomationUni_405.a’ from the Native library. App launches in Simulator/iPhone but device does NOT get listed in the ‘Devices List’ of Ranorex app.

  2. twalter

    @Anoop: Can you please provide the exact error thrown?
    You can of course directly contact our support team at if you don’t want a public conversation.

  3. paul

    Is it possible to test ios device on using windows platform,
    as most of the instructions seen point to use of mac pc for ios testing

  4. Tobias Walter

    Of course it is possible to test your iOS device using Windows.
    For further details have a look at the chapter “iOS Testing” in our user guide.


  5. Vadim

    Hi Tobias,
    Can i test IOS app not on device (mobile) but on simulator, is it possible? and if it is, please let me know where to start. Do i need to use MacOS xcode simulator?

  6. Bernhard Seunig

    Hello Vadim,

    Currently it is still possible to use the XCode simulator if the app was instrumented using XCode and the Ranorex Library manually. You can add the device using WIFI to Ranorex after doing so.

    Unfortunately, the service app will not work on the simulator.
    In general it is recommended to use physical devices because you will prevent possible differences in the behavior of the simulator and the device. Using real devices is also more common than using a simulator.


  7. Shuba

    Can Ranorex test iOS/Android mobile apps developed in Qt 5.4 ?

  8. Bernhard Seunig-Karner

    Hello Shuba,

    I’m afraid QT 5.4 apps are currently not supported. It is only possible to work with screen coordinates on QT5.4 apps. Unfortunately, the current plug-in is not able to recognize most of mobile QT controls.
    If you want to add a feature request please send an email to
    Thank you.

    Kind regards,

Leave a Reply