The buddybuild SDK is a lightweight yet powerful suite of tools that integrates seamlessly into your application. Among the many features the SDK provides, you can use the buddybuild SDK to record video of your UI tests as they execute.
Here are the step-by-step instructions to configure the SDK in your UI tests target:
The SDK needs to be integrated into your main app prior to configuring video recording for your UI tests target.
We highly recommend using the automatic buddybuild SDK integration right from your dashboard. However, if you wish to install the buddybuild SDK manually, follow these steps.
Follow these instructions to update the SDK on your local machine.
-
Open your project in Xcode.
-
Highlight your project in the Project Navigator.
-
Select your target.
-
Select the Build Phases tab.
-
Open Link Binaries With Libraries expander.
-
Repeat for each of the AssetsLibrary, BuddyBuildSDK, CoreTelephony, CoreText, CoreMedia, AVFoundation, CoreVideo, QuartzCore and SystemConfiguration frameworks:
-
Click the
+
button. -
Select the required framework name.
-
Click the Add button.
-
Add the uiTestsDidReceiveRemoteNotification
call in your app
delegate’s didReceiveRemoteNotification
method.
Important
|
If you have an
|
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
BuddyBuildSDK.uiTestsDidReceiveRemoteNotification(userInfo)
// Initial implementation below
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
[BuddyBuildSDK uiTestsDidReceiveRemoteNotification:userInfo];
// Initial implementation below
}
If you haven’t already implemented didReceiveRemoteNotification in your app delegate, you need to create it.
Important
|
uiTestsDidReceiveRemoteNotification only runs in buddybuild while your UI tests run. It does not run when you build from Xcode on your local machine, on real iOS devices, on TestFlight, or on App Store installs. |
Add the following line after each XCUIApplication().launch()
(generally called in the setUp
function), call in your UI tests
code base. This will start recording the video right after your app is
launched by the UI test case.
...
XCUIApplication().launch()
BuddyBuildSDK.startUITests()
...
...
[[[XCUIApplication alloc] init] launch];
[BuddyBuildSDK startUITests];
...
Add the following line before each super.tearDown call in your UI tests code base. This will stop the video recording and save the file at the end of each UI test case.
override func tearDown() {
BuddyBuildSDK.stopUITests()
super.tearDown()
}
- (void)tearDown {
[BuddyBuildSDK stopUITests];
[super tearDown];
}
Run your UI tests locally (⌘+U) in Xcode. In the output pane you should see the following log line, which indicates that the buddybuild SDK has been successfully integrated.
2015-10-05 15:34:48.693 myAwesomeApp[25126:526527] BuddybuildSDK : Successfully integrated. Feedback tool, crash reporting and other features are disabled for local builds. Please build with https://dashboard.buddybuild.com to enable.
2015-10-05 15:33:24.562 myAwesomeApp[25126:526527] BuddybuildSDK : Disabled in the simulator
Commit the change and push the changes to your repo to add the buddybuild SDK.
git add - -all
git commit -m 'Adding buddybuild SDK for UI tests video recording'
git push
That’s it! Your code push will be picked up by buddybuild. All subsequent builds of your App will now record a video for each of your UI tests!