Rainforest supports testing native iOS applications in both VM environments and on real devices. The configuration for testing differs slightly for each Platform! This document will walk you through the setup for iOS app testing on a physical device.

Watch here! 


Testing iOS apps with Rainforest is simple! To get started, your iOS developer will just need to install our Rainforest framework in your application code for QA.

This framework will open a connection to your application, allowing Rainforest testers to access your app from real iPhone devices.

Developer instructions

1) Download the framework

Download the suitable Rainforest.framework:

  • Bitcode framework here
  • Non-bitcode framework here.

Unzip the archive to ~/Documents/RainforestSDK.

2) Add the framework to your project

  1. Open your application's Xcode project.
  2. If you don't have a Frameworks group in your project, create one.
  3. Open ~/Documents/RainforestSDK using Finder.
  4. Drag the Rainforest.framework file into the Frameworks group of Xcode's Project Navigator. In the displayed dialog, choose Create groups for any added folders and select Copy items into destination group's folder.
  5. In your project's General settings, go to Embedded Binaries and add the Rainforest.framework that you just imported.

3) Import and start the framework in the App Delegate

You will need to import and initialize the Rainforest framework once in your application startup. To accomplish this, add the following code to the application:didFinishLaunchingWithOptions method on the AppDelegate.m file.

// AppDelegate.m
#import <Rainforest/Rainforest.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [[Rainforest shared] bootstrap];
    });
    // Add any custom logic here.
    return YES;
}

For Swift projects, you should add the following code to the application function on your AppDelegate.swift file.

// AppDelegate.swift
import Rainforest;
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(1 * Double(NSEC_PER_SEC))), dispatch_get_main_queue()) {
        let shared = Rainforest.shared()
        shared.bootstrap()
    }    // Add any custom logic here.
    return true
}

Instead of performing the above operations manually, you can use our rnfrst-xcode tool to automatically add the framework in your Xcode project.

You can also install the framework through CocoaPods, by adding the rainforest-pod on your Podfile. And for Ionic/Cordova projects, it's possible to use the rainforest-cordova-plugin which will perform all necessary configurations to import the Rainforest.framework to your iOS app.

After performing the steps above, your application will be ready to be tested by Rainforest!

Note: Remember to remove the Rainforest framework from your application code before submitting your app to the App Store.

Running native iOS tests 

Before you begin running your native Mobile tests:

  • Upload your app .ipa file to S3, FTP server, or any accessible website
  • Add the URL to your app as a Site to your account: Rainforest will upload your application from this URL to our server and will set the site/environment of the test to this URL.

Running tests from the API:

Follow the instructions provided here informing the browsers and app_source_url params:

  • browsers: iphone_6s_v9_0
  • app_source_url: the URL of your .ipa file

Running tests from the CLI:

Be sure you have installed the latest version of our CLI. This is required to run Mobile tests: https://github.com/rainforestapp/rainforest-cli

Run your test passing the browser and app-source-url params:

  • rainforest run --tag <your_test_tag> --token <your_token> --browsers iphone_6s_v9_0 --app-source-url <url_to_the_ipa_file>

Alternatively, instead of the URL, you can pass to the app-source-url the path for your .ipa file.

Running tests from the UI:

  • Set a new Site within your settings to the URL where Rainforest can download your app’s .ipa file
  • When you initiate a test, Rainforest will trigger the download of your app from this URL
  • Write your tests as normal, and run the test against the appropriate site/environment and browser

Preview for Mobile Tests

  • It takes some time for RF to establish a connection with your app, so you can expect a brief delay when you initiate a test in preview mode.

Some precautions: 

There are some limitations to native iOS testing. Please bear the following in mind when scheduling your runs!

Devices cannot make phone calls or send SMS messages

  • Mobile tests run for 45 minutes. The test is aborted after this time. Keep your step counts to about 10 steps to ensure speedy testing!
  • [Developers] Our iOS devices replace the embedded provisioning profile with a wildcard profile and resign the app, resulting in the removal of certain entitlements. 
  • App Group, Associated Domains, Game Center, HealthKit, HomeKit, Wireless Accessory Configuration, In-App Purchase, Inter-App Audio, Apple Pay, Push Notifications, and VPN Configuration & Control are not accessible.
  • You can find more details here: https://aws.amazon.com/device-farm/faq/
  • [Developers] The deprecated UIAlertView is not supported. Apps should instead use the UIAlertController to display alert messages.
  • AWS devices use Wifi for connection, no use of 3G or 4G networks. 
Did this answer your question?