Xamarin Component
Xamarin Component is available here
TestFairy is available for both Android and iOS. You can install the bindings by 1 of 2 ways:
Download the latest binding DLL directly from GitHub for your specific platform.
Install the bindings through NuGet.
You will need an app token (TESTFAIRY_APP_TOKEN), which can be found in your settings page
Using the Xamarin SDK
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
// ...
}
Usage
Identifying your users
See the SDK Documentation for more information.
Session Attributes
See the SDK Documentation for more information.
Remote Logging
See the SDK Documentation for more information.
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.
Step 3:
Click on Custom Commands on the left, press Select a project operation and select After Build
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
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.
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(
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.
Last updated on 2023-03-23