TestFairy can collect additional information from your session, which can help you generate better insights.

Syntax

TestFairy.setAttribute("<key>", "<value>");

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.

Code Example

// 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");

      

Syntax

[TestFairy setAttribute:@"<key>" withValue:@"<value>"];

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.

Code Example

// 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"];
      

Syntax

TestFairy.setAttribute("<key>", "<value>");

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.

Code Example

TestFairy.setAttribute("name","John Snow");
TestFairy.setAttribute("phone","+672-14-5109");
TestFairy.setAttribute("age","20");
TestFairy.setAttribute("favorite_color","blue");
      

Syntax

TestFairy.setAttribute("<key>", "<value>");

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.

Code Example

// 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");
      

Syntax

TestFairySDK.setAttribute("<key>", "<value>");

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.

Code Example

// 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");
      

Syntax

TestFairy.SetAttribute ("<key>", "<value>");

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.

Code Example

// 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");
      

Syntax

TestFairy.setAttribute("<key>", "<value>");

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.

Code Example

// 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");
      

Syntax

AirTestFairy.setAttribute("<key>", "<value>");

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.

Code Example

// 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");
      

Syntax

TiTestFairy.setAttribute("<key>", "<value>");

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.

Code Example

// 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");
      

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.

Notes


  • setAttribute may be called many times.
  • You may call setAttribute before or after begin.
  • 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.

Last updated on 2023-06-06