TestFairy Class Reference

Inherits from NSObject
Declared in TestFairy.h

+ begin:

Initialize a TestFairy session.

+ (void)begin:(NSString *)appToken

Parameters

appToken

Your key as given to you in your TestFairy account

Discussion

Initialize a TestFairy session.

Declared In

TestFairy.h

+ begin:withOptions:

Initialize a TestFairy session with options.

+ (void)begin:(NSString *)appToken withOptions:(NSDictionary *)options

Parameters

appToken

Your key as given to you in your TestFairy account

options

A dictionary of options controlling the current session Options include - metrics: comma separated string of default metric options such as “cpu,memory,network-requests,shake,video,logs” - enableCrashReporter: @YES / @NO to enable crash handling. Default is @YES

Discussion

Initialize a TestFairy session with options.

Declared In

TestFairy.h

+ installCrashHandler:

Initialize the TestFairy SDK with only crash handling. No sessions will be recorded.

+ (void)installCrashHandler:(NSString *)appToken

Discussion

Initialize the TestFairy SDK with only crash handling. No sessions will be recorded.

Declared In

TestFairy.h

+ setServerEndpoint:

Change the server endpoint for use with on-premise hosting. Please contact support or sales for more information. Must be called before begin

+ (void)setServerEndpoint:(NSString *)serverOverride

Parameters

serverOverride

server address for use with TestFairy

Discussion

Change the server endpoint for use with on-premise hosting. Please contact support or sales for more information. Must be called before begin

Declared In

TestFairy.h

+ version

Returns SDK version (x.x.x) string

+ (NSString *)version

Return Value

version

Discussion

Returns SDK version (x.x.x) string

Declared In

TestFairy.h

+ hideView:

Hides a specific view from appearing in the video generated. Holds a weak reference to the view

+ (void)hideView:(UIView *)view

Parameters

view

The specific view you wish to hide from screenshots

Discussion

Hides a specific view from appearing in the video generated. Holds a weak reference to the view

Declared In

TestFairy.h

+ unhideView:

Removes a view added to hideView. Useful for table views which reuse cells, where cells only need to be hidden conditionally.

+ (void)unhideView:(UIView *)view

Parameters

view

The specific view added to hideView

Discussion

Removes a view added to hideView. Useful for table views which reuse cells, where cells only need to be hidden conditionally.

Declared In

TestFairy.h

+ hideWebViewElements:

Hides a specific html element from appearing in your WKWebView

+ (void)hideWebViewElements:(NSString *)selector

Parameters

selector

The specific selector you wish to hide from screenshots. Multiple selectors can be comma separated

Discussion

Hides a specific html element from appearing in your WKWebView

Declared In

TestFairy.h

+ pushFeedbackController

Pushes the feedback view controller. Hook a button to this method to allow users to provide feedback about the current session. All feedback will appear in your build report page, and in the recorded session page.

+ (void)pushFeedbackController

Discussion

Pushes the feedback view controller. Hook a button to this method to allow users to provide feedback about the current session. All feedback will appear in your build report page, and in the recorded session page.

Declared In

TestFairy.h

+ showFeedbackForm

Programmatically display the feedback form to users. Users can provide feedback about the current session. All feedback will appear in your build report page, and in the recorded session page.

+ (void)showFeedbackForm

Discussion

Programmatically display the feedback form to users. Users can provide feedback about the current session. All feedback will appear in your build report page, and in the recorded session page.

Declared In

TestFairy.h

+ showFeedbackForm:takeScreenshot:

Displays the feedback form. Allow users to provide feedback without prior call to begin. All feedback will appear in your build report page, and in “Feedbacks” tab.

+ (void)showFeedbackForm:(NSString *)appToken takeScreenshot:(BOOL)takeScreenshot

Parameters

appToken

Your key as given to you in your TestFairy account

takeScreenshot

whether screenshot should be automatically added

Discussion

Displays the feedback form. Allow users to provide feedback without prior call to begin. All feedback will appear in your build report page, and in “Feedbacks” tab.

This method is different from showFeedbackForm by that it does not require a call to begin().

Declared In

TestFairy.h

+ startFeedback:withIntent:

Start collecting feedback by having your users either capture a screenshot or recording before filling the Feedback form. All feedbacks will appear in your build report page, and on the “Feedbacks” tab.

+ (void)startFeedback:(NSString *)appToken withIntent:(NSString *)intent

Parameters

appToken

Your key as given to you in your TestFairy account

intent

Either “video” or “screenshot”

Discussion

Start collecting feedback by having your users either capture a screenshot or recording before filling the Feedback form. All feedbacks will appear in your build report page, and on the “Feedbacks” tab.

Does not require a call to begin().

Declared In

TestFairy.h

+ sendUserFeedback:

Send a feedback on behalf of the user. Call when using a in-house feedback view controller with a custom design and feel. Feedback will be associated with the current session.

+ (void)sendUserFeedback:(NSString *)feedback

Parameters

feedback

Feedback text

Discussion

Send a feedback on behalf of the user. Call when using a in-house feedback view controller with a custom design and feel. Feedback will be associated with the current session.

Declared In

TestFairy.h

+ sendUserFeedback:text:screenshot:

Send a feedback on behalf of the user. Call when using a in-house feedback view controller with a custom design and feel. Feedback will be associated with the current session.

+ (void)sendUserFeedback:(NSString *)appToken text:(NSString *)text screenshot:(UIImage *)image

Parameters

text

Feedback text

Discussion

Send a feedback on behalf of the user. Call when using a in-house feedback view controller with a custom design and feel. Feedback will be associated with the current session.

Declared In

TestFairy.h

+ updateLocation:

Proxy didUpdateLocation delegate values and these locations will appear in the recorded sessions. Useful for debugging actual long/lat values against what the user sees on screen.

+ (void)updateLocation:(NSArray *)locations

Parameters

locations

Array of CLLocation. The first object of the array will determine the user location

Discussion

Proxy didUpdateLocation delegate values and these locations will appear in the recorded sessions. Useful for debugging actual long/lat values against what the user sees on screen.

Declared In

TestFairy.h

+ checkpoint:

Marks a checkpoint in session. Use this text to tag a session with a checkpoint name. Later you can filter sessions where your user passed through this checkpoint.

+ (void)checkpoint:(NSString *)name

Parameters

name

The checkpoint name

Discussion

Marks a checkpoint in session. Use this text to tag a session with a checkpoint name. Later you can filter sessions where your user passed through this checkpoint.

Declared In

TestFairy.h

+ addEvent:

Marks an event in session timeline. Use this text to tag a session with an event name. Later you can filter sessions where your user passed through this event.

+ (void)addEvent:(NSString *)name

Parameters

name

The event name

Discussion

Marks an event in session timeline. Use this text to tag a session with an event name. Later you can filter sessions where your user passed through this event.

Declared In

TestFairy.h

+ setCorrelationId:

Sets a correlation identifier for this session. This value can be looked up via web dashboard. For example, setting correlation to the value of the user-id after they logged in. Can be called only once per session (subsequent calls will be ignored.)

+ (void)setCorrelationId:(NSString *)correlationId

Parameters

correlationId

Id for the current session

Discussion

Sets a correlation identifier for this session. This value can be looked up via web dashboard. For example, setting correlation to the value of the user-id after they logged in. Can be called only once per session (subsequent calls will be ignored.)

Declared In

TestFairy.h

+ identify:

Sets a correlation identifier for this session. This value can be looked up via web dashboard. For example, setting correlation to the value of the user-id after they logged in. Can be called only once per session (subsequent calls will be ignored.)

+ (void)identify:(NSString *)correlationId

Parameters

correlationId

Id for the current session

Discussion

Sets a correlation identifier for this session. This value can be looked up via web dashboard. For example, setting correlation to the value of the user-id after they logged in. Can be called only once per session (subsequent calls will be ignored.)

Declared In

TestFairy.h

+ identify:traits:

Sets a correlation identifier for this session. This value can be looked up via web dashboard. For example, setting correlation to the value of the user-id after they logged in. Can be called only once per session (subsequent calls will be ignored.)

+ (void)identify:(NSString *)correlationId traits:(NSDictionary *)traits

Parameters

correlationId

Id for the current session

traits

Attributes and custom attributes to be associated with this session

Discussion

Sets a correlation identifier for this session. This value can be looked up via web dashboard. For example, setting correlation to the value of the user-id after they logged in. Can be called only once per session (subsequent calls will be ignored.)

Declared In

TestFairy.h

+ pause

Pauses the current session. This method stops recoding of the current session until resume has been called.

+ (void)pause

Discussion

Pauses the current session. This method stops recoding of the current session until resume has been called.

See Also

Declared In

TestFairy.h

+ resume

Resumes the recording of the current session. This method resumes a session after it was paused.

+ (void)resume

Discussion

Resumes the recording of the current session. This method resumes a session after it was paused.

See Also

Declared In

TestFairy.h

+ sessionUrl

Returns the address of the recorded session on testfairy’s developer portal. Will return nil if recording not yet started.

+ (NSString *)sessionUrl

Return Value

session URL

Discussion

Returns the address of the recorded session on testfairy’s developer portal. Will return nil if recording not yet started.

Declared In

TestFairy.h

+ takeScreenshot

Takes a screenshot.

+ (void)takeScreenshot

Discussion

Takes a screenshot.

Declared In

TestFairy.h

+ addScreenshot:

Adds a screenshot to the current moment in session. Overrides the current screen recording system

+ (void)addScreenshot:(UIImage *)image

Parameters

image

Screenshot to add

Discussion

Adds a screenshot to the current moment in session. Overrides the current screen recording system

Declared In

TestFairy.h

+ setScreenName:

Set the name of the current screen. Useful for single page applications which use a single UIViewController.

+ (void)setScreenName:(NSString *)name

Parameters

name

logic name of current screen

Discussion

Set the name of the current screen. Useful for single page applications which use a single UIViewController.

Declared In

TestFairy.h

+ stop

Stops the current session recording. Unlike ‘pause’, when calling ‘resume’, a new session will be created and will be linked to the previous recording. Useful if you want short session recordings of specific use-cases of the app. Hidden views and user identity will be applied to the new session as well, if started.

+ (void)stop

Discussion

Stops the current session recording. Unlike ‘pause’, when calling ‘resume’, a new session will be created and will be linked to the previous recording. Useful if you want short session recordings of specific use-cases of the app. Hidden views and user identity will be applied to the new session as well, if started.

Declared In

TestFairy.h

+ setAttribute:withValue:

Records a session level attribute which can be looked up via web dashboard.

+ (BOOL)setAttribute:(NSString *)key withValue:(NSString *)value

Parameters

key

The name of the attribute. Cannot be nil.

value

The value associated with the attribute. Cannot be nil.

Return Value

YES if successfully set attribute value, NO if failed with error in log.

Discussion

Records a session level attribute which can be looked up via web dashboard.

Note: The SDK limits you to storing 64 named attributes. Adding more than 64 will fail and return NO.

Declared In

TestFairy.h

+ setUserId:

Records a user identified as an attribute. We recommend passing values such as email, phone number, or user id that your app may use.

+ (void)setUserId:(NSString *)userId

Parameters

userId

The identifying user. Cannot be nil.

Discussion

Records a user identified as an attribute. We recommend passing values such as email, phone number, or user id that your app may use.

Declared In

TestFairy.h

+ log:

Remote logging. These logs will be sent to the server, but will not appear in the console.

+ (void)log:(NSString *)message

Discussion

Remote logging. These logs will be sent to the server, but will not appear in the console.

Declared In

TestFairy.h

+ attachFile:

Attach a file to the session. A maximum of 5 files may be attached. Each file cannot be more than 15 mb in size. In order to see if the file successfully uploads or fails, please view the logs.

+ (void)attachFile:(NSURL *)file

Parameters

file

path to file on disk.

Discussion

Attach a file to the session. A maximum of 5 files may be attached. Each file cannot be more than 15 mb in size. In order to see if the file successfully uploads or fails, please view the logs.

Declared In

TestFairy.h

+ didLastSessionCrash

Query to see if the previous session crashed. Can be called before or after calling begin.

+ (BOOL)didLastSessionCrash

Discussion

Query to see if the previous session crashed. Can be called before or after calling begin.

Declared In

TestFairy.h

+ enableCrashHandler

Enables the ability to capture crashes. TestFairy crash handler is installed by default. Once installed it cannot be uninstalled. Must be called before begin.

+ (void)enableCrashHandler

Discussion

Enables the ability to capture crashes. TestFairy crash handler is installed by default. Once installed it cannot be uninstalled. Must be called before begin.

Declared In

TestFairy.h

+ disableCrashHandler

Disables the ability to capture crashes. TestFairy crash handler is installed by default. Once installed it cannot be uninstalled. Must be called before begin.

+ (void)disableCrashHandler

Discussion

Disables the ability to capture crashes. TestFairy crash handler is installed by default. Once installed it cannot be uninstalled. Must be called before begin.

Declared In

TestFairy.h

+ enableMetric:

Enables recording of a metric regardless of build settings. Valid values include “cpu”, “memory”, “logcat”, “battery”, “network-requests” A metric cannot be enabled and disabled at the same time, therefore if a metric is also disabled, the last call to enable to disable wins. Must be called be before begin.

+ (void)enableMetric:(NSString *)metric

Discussion

Enables recording of a metric regardless of build settings. Valid values include “cpu”, “memory”, “logcat”, “battery”, “network-requests” A metric cannot be enabled and disabled at the same time, therefore if a metric is also disabled, the last call to enable to disable wins. Must be called be before begin.

Declared In

TestFairy.h

+ disableMetric:

Disables recording of a metric regardless of build settings. Valid values include “cpu”, “memory”, “logcat”, “battery”, “network-requests” A metric cannot be enabled and disabled at the same time, therefore if a metric is also disabled, the last call to enable to disable wins. Must be called be before begin.

+ (void)disableMetric:(NSString *)metric

Discussion

Disables recording of a metric regardless of build settings. Valid values include “cpu”, “memory”, “logcat”, “battery”, “network-requests” A metric cannot be enabled and disabled at the same time, therefore if a metric is also disabled, the last call to enable to disable wins. Must be called be before begin.

Declared In

TestFairy.h

+ enableVideo:quality:framesPerSecond:

Enables the ability to capture video recording regardless of build settings. Valid values for policy include “always” and “wifi” Valid values for quality include “high”, “low”, “medium” Values for fps must be between 0.1 and 2.0. Value will be rounded to the nearest frame.

+ (void)enableVideo:(NSString *)policy quality:(NSString *)quality framesPerSecond:(float)fps

Discussion

Enables the ability to capture video recording regardless of build settings. Valid values for policy include “always” and “wifi” Valid values for quality include “high”, “low”, “medium” Values for fps must be between 0.1 and 2.0. Value will be rounded to the nearest frame.

Declared In

TestFairy.h

+ disableVideo

Disables the ability to capture video recording. Must be called before begin.

+ (void)disableVideo

Discussion

Disables the ability to capture video recording. Must be called before begin.

Declared In

TestFairy.h

+ enableFeedbackForm:

Enables the ability to present the feedback form based on the method given. Valid values include “shake”, “screenshot” or “shake|screenshot”. If an unrecognized method is passed, the value defined in the build settings will be used. Must be called before begin.

+ (void)enableFeedbackForm:(NSString *)method

Discussion

Enables the ability to present the feedback form based on the method given. Valid values include “shake”, “screenshot” or “shake|screenshot”. If an unrecognized method is passed, the value defined in the build settings will be used. Must be called before begin.

Declared In

TestFairy.h

+ disableFeedbackForm

Disables the ability to present users with feedback when devices is shaken, or if a screenshot is taken. Must be called before begin.

+ (void)disableFeedbackForm

Discussion

Disables the ability to present users with feedback when devices is shaken, or if a screenshot is taken. Must be called before begin.

Declared In

TestFairy.h

+ disableAutoUpdate

Disable auto updates for this build. Even if there’s a newer build available through TestFairy, ignore it, and continue using the current build. Must be called before begin

+ (void)disableAutoUpdate

Discussion

Disable auto updates for this build. Even if there’s a newer build available through TestFairy, ignore it, and continue using the current build. Must be called before begin

Declared In

TestFairy.h

+ setMaxSessionLength:

Sets the maximum recording time. Minimum value is 60 seconds, else the value defined in the build settings will be used. The maximum value is the lowest value between this value and the value defined in the build settings. Time is rounded to the nearest minute. Must be called before begin.

+ (void)setMaxSessionLength:(float)seconds

Discussion

Sets the maximum recording time. Minimum value is 60 seconds, else the value defined in the build settings will be used. The maximum value is the lowest value between this value and the value defined in the build settings. Time is rounded to the nearest minute. Must be called before begin.

Declared In

TestFairy.h

+ setFeedbackEmailVisible:

Determines whether the “email field” in the Feedback form will be visible or not. default is true

+ (void)setFeedbackEmailVisible:(BOOL)visible

Parameters

visible

BOOL

Discussion

Determines whether the “email field” in the Feedback form will be visible or not. default is true

Declared In

TestFairy.h

+ getDistributionStatus:callback:

Query the distribution status of this build. Distribution is not required for working with the TestFairy SDK, meaning, you can use the SDK with the App Store.

+ (void)getDistributionStatus:(NSString *)appToken callback:(void ( ^ ) ( NSDictionary<NSString*,NSString*> *, NSError *))callback

Parameters

appToken

App token as used with begin()

callback

to receive asynchornous response. Response dictionary can be nil

Discussion

Query the distribution status of this build. Distribution is not required for working with the TestFairy SDK, meaning, you can use the SDK with the App Store.

The distribution status can be either “enabled” or “disabled”, and optionally, can have an auto-update. This method is useful if you’re using TestFairy in your development stage and want to know if you expired the distribution of this version in your dashboard.

Possible response keys:

response[@“status”] = @“enabled” or @“disabled” response[@“autoUpdateDownloadUrl”] = @“

Declared In

TestFairy.h

+ setPublicKey:

Enable end-to-end encryption for this session. Screenshots and logs will be encrypted using this RSA key. Please refer to the documentation to learn more about the subject and how to create public/private key pair.

+ (void)setPublicKey:(NSString *)publicKey

Parameters

publicKey

RSA Public Key converted to DER format and encoded in base64

Discussion

Enable end-to-end encryption for this session. Screenshots and logs will be encrypted using this RSA key. Please refer to the documentation to learn more about the subject and how to create public/private key pair.

Declared In

TestFairy.h

+ setSessionStateDelegate:

Set the delegate object to listent to TestFairy events. See @TestFairySessionStateDelegate for more information

+ (void)setSessionStateDelegate:(id<TestFairySessionStateDelegate>)delegate

Discussion

Set the delegate object to listent to TestFairy events. See @TestFairySessionStateDelegate for more information

Declared In

TestFairy.h

+ addNetwork:error:

Call this function to log your network events.

+ (void)addNetwork:(NSURLSessionTask *)task error:(NSError *)error

Discussion

Call this function to log your network events.

Declared In

TestFairy.h

+ logError:stacktrace:

Send an NSError to TestFairy. Note, this function is limited to 5 errors.

+ (void)logError:(NSError *)error stacktrace:(NSArray *)trace

Parameters

error

NSError

trace

Stacktrace

Discussion

Send an NSError to TestFairy. Note, this function is limited to 5 errors.

Declared In

TestFairy.h

+ crash

Force crash (only for testing purposes)

+ (void)crash

Discussion

Force crash (only for testing purposes)

Declared In

TestFairy.h