Identifying Your Users
With TestFairy's user identification feature, you can enhance your testing and debugging process by efficiently correlating session recordings with specific users and their traits. This capability empowers you to gain deeper insights into how different users interact with your app and aids in the diagnosis of user-specific issues during testing.
Example Configuration
Below are code examples illustrating how to utilize TestFairy's setUserId
method on various platforms:
- Android
- iOS
- Cordova
- React Native
- Nativescript
- Xamarin
- Unity
- Adobe Air
- Titanium
TestFairy.setUserId("<userId>");
// Be sure to import TestFairy
import com.testfairy.TestFairy;
TestFairy.setUserId("john@example.com");
[TestFairy setUserId:@"<userId>"];
// Be sure to import TestFairy
#import "TestFairy.h"
[TestFairy setUserId:@"john@example.com"];
TestFairy.setUserId("<userId>");
TestFairy.setUserId("john@example.com");
TestFairy.setUserId("<userId>");
// Be sure to import TestFairy
const TestFairy = require('react-native-testfairy');
TestFairy.setUserId("john@example.com");
TestFairySDK.setUserId("<userId>");
// Be sure to import TestFairy
import { TestFairySDK } from 'nativescript-testfairy';
TestFairySDK.setUserId("john@example.com");
TestFairy.SetUserId ("<userId>");
// Be sure to import TestFairy
using TestFairyLib;
TestFairy.SetUserId ("john@example.com");
TestFairy.setUserId("<userId>");
// Be sure to import TestFairy
using TestFairyUnity;
TestFairy.setUserId("john@example.com");
AirTestFairy.setUserId("<userId>");
// Be sure to import TestFairy
import com.testfairy.AirTestFairy;
AirTestFairy.setUserId("john@example.com");
TiTestFairy.setUserId("<userId>");
// Be sure to import TestFairy
var TiTestFairy = require('com.testfairy.titestfairy');
TiTestFairy.setUserId("john@example.com");
Where userId
is a string representing an association to your backend. We recommend passing values such as email, phone number, or user ID your app may use. This value may not be nil and is searchable via API and web search.
Important Notes
To make the most effective use of TestFairy's user identification feature, it's essential to keep in mind the following important notes:
- The
setUserId
method can be called multiple times to update the user identifier for different sessions. - You can call
setUserId
before or after initializing a session withbegin
. - The user identifier you provide must not be null and should be chosen from user attributes like email, phone number, or user ID.
- The user identifier you set using setUserId() will be searchable through the TestFairy API and web search interface.