Session Attributes
TestFairy can collect additional information from your session, which can help you generate better insights.
- Android
- iOS
- Cordova
- React Native
- Nativescript
- Xamarin
- Unity
- Adobe Air
- Titanium
TestFairy.setAttribute("<key>", "<value>");
// Be sure to import TestFairy
import com.testfairy.TestFairy;
TestFairy.setAttribute("payment-method","free");
TestFairy.setAttribute("account-type","driver");
TestFairy.setAttribute("phone","+1-672-154-5109");
TestFairy.setAttribute("level","20");
[TestFairy setAttribute:@"<key>" withValue:@"<value>"];
// Be sure to import TestFairy
#import "TestFairy.h"
[TestFairy setAttribute:@"name" withValue:@"John Snow"];
[TestFairy setAttribute:@"phone" withValue:@"+672-14-5109"];
[TestFairy setAttribute:@"age" withValue:@"20"];
[TestFairy setAttribute:@"favorite_color" withValue:@"blue"];
TestFairy.setAttribute("<key>", "<value>");
TestFairy.setAttribute("name","John Snow");
TestFairy.setAttribute("phone","+672-14-5109");
TestFairy.setAttribute("age","20");
TestFairy.setAttribute("favorite_color","blue");
TestFairy.setAttribute("<key>", "<value>");
// Be sure to import TestFairy
const TestFairy = require('react-native-testfairy');
TestFairy.setAttribute("name","John Snow");
TestFairy.setAttribute("phone","+672-14-5109");
TestFairy.setAttribute("age","20");
TestFairy.setAttribute("favorite_color","blue");
TestFairySDK.setAttribute("<key>", "<value>");
// Be sure to import TestFairy
import { TestFairySDK } from 'nativescript-testfairy';
TestFairySDK.setAttribute("name","John Snow");
TestFairySDK.setAttribute("phone","+672-14-5109");
TestFairySDK.setAttribute("age","20");
TestFairySDK.setAttribute("favorite_color","blue");
TestFairy.SetAttribute ("<key>", "<value>");
// Be sure to import TestFairy
using TestFairyLib;
TestFairy.SetAttribute ("name","John Snow");
TestFairy.SetAttribute ("phone","+672-14-5109");
TestFairy.SetAttribute ("age","20");
TestFairy.SetAttribute ("favorite_color","blue");
TestFairy.setAttribute("<key>", "<value>");
// Be sure to import TestFairy
using TestFairyUnity;
TestFairy.setAttribute("name","John Snow");
TestFairy.setAttribute("phone","+672-14-5109");
TestFairy.setAttribute("age","20");
TestFairy.setAttribute("favorite_color","blue");
AirTestFairy.setAttribute("<key>", "<value>");
// Be sure to import TestFairy
import com.testfairy.AirTestFairy;
AirTestFairy.setAttribute("name","John Snow");
AirTestFairy.setAttribute("phone","+672-14-5109");
AirTestFairy.setAttribute("age","20");
AirTestFairy.setAttribute("favorite_color","blue");
TiTestFairy.setAttribute("<key>", "<value>");
// Be sure to import TestFairy
var TiTestFairy = require('com.testfairy.titestfairy');
TiTestFairy.setAttribute("name","John Snow");
TiTestFairy.setAttribute("phone","+672-14-5109");
TiTestFairy.setAttribute("age","20");
TiTestFairy.setAttribute("favorite_color","blue");
The first value is a string key
to help you search for the attribute in your session. The second parameter, value
, is any string value for the attribute associated with the session. Neither value can be nil. These attributes are available later in the session recording page, are available via API, and are searchable.
Adding these lines will mark this session with the values above, so when you review the recording, you have more information about the person running the app.
note
setAttribute
may be called many times.- You may call
setAttribute
before or afterbegin
. - You can only store a maximum of 64 keys. The keys can be a maximum of 64 characters. The values can have a maximum of 1000 characters.