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

There is a bug in the current version of Xamarin.iOS reported by Ranorex in May 2016. Therefore, it is not possible to automate applications based on the current version of Xamarin.iOS at the moment. We will inform you about any news regarding this topic.



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 automated mobile testing 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>BinRxEnvAndroidRanorex.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.