Skip to main content

Session Attributes

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

TestFairy.setAttribute("<key>", "<value>");
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");

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 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.