Adding the TestFairy SDK to your App
The TestFairy SDK helps you understand how users interact with your app. It can handle problems like crashes and on-screen error messages and integrate with your current development workflow.
TestFairy SDK features include:
- Recording videos of how users interact with your apps.
- Handling crashes and exceptions.
- Sending logs to the TestFairy dashboard for later inspection.
- Identifying and tagging users for searching and custom reports.
- Auto updates to ensure your users are on the latest version.
Supported Platforms
To add the TestFairy SDK to your app, see the instructions for the relevant development platform:
- Android
- iOS
- Cordova and PhoneGap
- Ionic
- React Native
- Unity
- Xamarin
- Titanium
- Nativescript
- Neptune Software
- Flutter
Adding Events
Events are used to provide insights into how testers use your apps. They can help you track when a tester reaches key points in your app, such as visiting the in-app store.
To add an event to your timeline:
- Android
- iOS
- React Native
TestFairy.addEvent("<event name>");
public class MyActivity extends Activity {
private void onPurchaseComplete() {
TestFairy.addEvent("Purchase OK");
}
}
[TestFairy addEvent:@"<event name>"];
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
[TestFairy addEvent:@"Purchase OK"];
//...
}
// ...
@end
TestFairy.addEvent("<event name>");
const TestFairy = require('react-native-testfairy');
var MyComponent = React.createClass({
componentDidMount: function() {
TestFairy.addEvent("Purchase OK");
}
});
Attaching Files To Sessions
TestFairy allows developers to attach files to sessions. As a developer, you can upload up to five files to a given session, with a maximum size of 15MB per file. Files must be local to the device.
Be sure to check the device logs for any problems uploading files. Only file extensions .jpeg, .jpg, .png, .txt, and .sqlite are supported.
To attach a file to a session, call the static instance method attachFile
in the TestFairy
class:
- Android
- iOS
File file = ...
TestFairy.attachFile(file);
File file = new File("/path/to/file.txt");
TestFairy.attachFile(file);
NSURL *file = ...
[TestFairy attachFile:file];
NSURL *file = [NSURL fileURLWithPath:"/path/to/file.txt"];
[TestFairy attachFile:file];