Xamarin Component is available here

TestFairy is available for both Android and iOS. You can install the bindings by 1 of 3 ways:

  1. Download the latest binding DLL directly from GitHub for your specific platform.

  2. Install the bindings through NuGet.

  3. Install the bindings trhough the Xamarin Component Store.

You will need an app token (TESTFAIRY_APP_TOKEN), which can be found in your settings page

iOS

Open AppDelegate.cs in your solution, and override or add the following code to FinishedLaunching.

using TestFairyLib;
...

public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
    TestFairy.Begin (TESTFAIRY_APP_TOKEN);

    // Rest of the method here
    // ...
}

Remote Logging

Prior to iOS 10, TestFairy would automatically capture any device logs. However, with the introduction of a new logging system by Apple in iOS 10, some extra steps are required in order to capture logging information along with your session. We recommend wrapping all log statements with a custom method, which will output to both the console and to TestFairy sessions. One suggestion we have is to add a method that looks like this:

using TestFairyLib;
...
public static void Log(string format, params object[] arg)
{
    using (var nsFormat = new NSString(string.Format(format, arg)))
    {
        CFunctions.TFLog(nsFormat.Handle, "");
        Console.WriteLine(string.Format(format, arg));
    }
}

Now, you can log statements using this call:

Log("Hello {0}", "World");

Note: This requires Xamarin plugin version 2.1.0 and above.

Upload dSYM

With TestFairy, symbolicating crash reports is as easy as pie. A simple Build Phase script can automatically upload the compressed .dSYM file for future symbolicaton.

To enable automatic uploads of .dSYM files, please follow these steps:

Step 1:

Copy upload_dsym.sh to your project folder. Download here.

Step 2:

In Xamarin Studio, click on your project in the left sidebar, then open "Settings" and choose Options.

alt

Step 3:

Click on Custom Commands on the left, press Select a project operation and select After Build

alt

Step 4:

Add the following command to the command line

sh upload-dsym.sh UPLOAD_API_KEY -p DSYM_PATH

Make sure to replace UPLOAD_API_KEY with your upload API key, which can be found in the Settings page.
Replace DSYM_PATH with the path of your build folder.

Step 5:

Set the "Working Directory" to the path of upload-dsym.sh file

alt

Xamarin Insights Integration

With Insights, Xamarin developers can review their app usage using the Xamarin Insights component. TestFairy fills in the gap by providing additional metrics, such as CPU usage and memory allocation and even video capture from the device. Any question you may have, as a developer, will be answered in the TestFairy session reports.

alt

In the left sidebar of Insights, you will now see a link to the session recorded by TestFairy.

Integration

By simply adding the following code, the session recorded by TestFairy will be associated in Xamarin Insights as well (as seen in the screenshot above.) Place this snippet right after initializing Xamarin.Insights and TestFairy.

NSNotificationCenter.DefaultCenter.AddObserver (TestFairy.SessionStartedNotification, delegate (NSNotification n) {
      NSString sessionUrl = (NSString)n.UserInfo.ObjectForKey(TestFairy.SessionStartedUrlKey);
      Insights.Track ("TestFairy", new Dictionary<string, string> {{ "URL", sessionUrl }});
});

Android

Either in your custom Android Application class, or in any Activity class, simply make a call to Com.TestFairy.TestFairy.Begin(). Below, you can see an example of invoking begin from the Main Activity.

using Com.Testfairy;
...

public class MainActivity : Activity {
    protected override void OnCreate (Bundle savedInstanceState)
    {
        base.OnCreate (savedInstanceState);

        TestFairy.Begin (this, TESTFAIRY_APP_TOKEN);
        SetContentView (Resource.Layout.Main);
        ...
    }
}

Telling TestFairy what to record

TestFairy can record screens cast directly from the device, as well as monitor CPU consumption and memory allocations. It grabs
logs and even enables your users to provide feedback upon shaking their device.

To configure how and what TestFairy records, visit your Build Settings. You will see the build after calling Begin () at
least once.

Mixing with other crash handlers

TestFairy plays nice. There is no problem using the crash handler with another reporter.