Home

Awesome

<p align="center" > <img src="http://inkling.github.io/Subliminal/readme-images/subliminal-hero.png" alt="Subliminal" title="Subliminal"> </p>

Build Status Gitter chat

Subliminal is a framework for writing iOS integration tests. Subliminal provides a familiar OCUnit/XCTest-like interface to Apple's UIAutomation framework, with tests written entirely in Objective-C. Subliminal also provides a powerful mechanism for your tests to manipulate your application directly.

[ FeaturesGetting StartedRequirementsUsageContinuous IntegrationContributingContactLicense ]

Features

Seamless Integration

Write your tests in Objective-C, and run them from Xcode. See rich-text logs and screenshots in Instruments. Use UIAutomation to simulate user interaction. Subliminal lets you use familiar tools, no dependencies required.

Full Control

By using UIAutomation, Subliminal can simulate almost any interaction--without resorting to private APIs. From navigating in-app purchase dialogs, to putting your app to sleep, Subliminal lets you simulate complex interaction like a user. And when you want to manipulate your app directly, Subliminal will help you do that too.

Scalable Tests

Define Objective-C methods to help set up and tear down tests. Leverage native support for continuous integration. Take confidence in Subliminal's complete documentation and full test coverage. Subliminal is the perfect foundation for your tests.

How to Get Started

Running the Example App

  1. Clone the Subliminal repo: git clone https://github.com/inkling/Subliminal.git.
  2. cd into the directory: cd Subliminal.
  3. If you haven't already, set up Subliminal: rake install.
  4. Open the Example project: open Example/SubliminalTest.xcodeproj.
  5. Switch to the "Integration Tests" scheme. You may also see a scheme called "Subliminal Integration tests"--make sure you choose "Integration Tests."
  6. Choose Product > Profile (⌘+I).
  7. Under the User Templates, choose Subliminal.

Installing Subliminal

For an installation walkthrough, refer to Subliminal's wiki.

Requirements

Subliminal supports projects built using Xcode 5.1 and iOS 7.x SDKs, and deployment targets running iOS 6.1 through 7.1.

For iOS 5.1 support, use Subliminal 1.1.0 (found in the Releases section or on CocoaPods). To test in the iOS 5.1 Simulator, you will need to run OS X 10.8 and manually add the iOS 5.1 Simulator to Xcode 5.1, as described here.

Usage

Subliminal is designed to be instantly familiar to users of OCUnit/XCTest. In Subliminal, subclasses of SLTest define tests as methods beginning with test. At run-time, Subliminal discovers and runs these tests.

Tests manipulate the user interface and can even manipulate the application directly. Here's what a sample test case looks like:

@implementation STLoginTest

- (void)testLogInSucceedsWithUsernameAndPassword {
	SLTextField *usernameField = [SLTextField elementWithAccessibilityLabel:@"username field"];
	SLTextField *passwordField = [SLTextField elementWithAccessibilityLabel:@"password field" isSecure:YES];
	SLElement *submitButton = [SLElement elementWithAccessibilityLabel:@"Submit"];
	SLElement *loginSpinner = [SLElement elementWithAccessibilityLabel:@"Logging in..."];
	
    NSString *username = @"Jeff", *password = @"foo";
    [usernameField setText:username];
    [passwordField setText:password];

    [submitButton tap];

	// wait for the login spinner to disappear
    SLAssertTrueWithTimeout([loginSpinner isInvalidOrInvisible], 
    						3.0, @"Log-in was not successful.");

    NSString *successMessage = [NSString stringWithFormat:@"Hello, %@!", username];
    SLAssertTrue([[SLElement elementWithAccessibilityLabel:successMessage] isValid], 
    			@"Log-in did not succeed.");
    
    // Check the internal state of the app.			
    SLAssertTrue(SLAskAppYesNo(isUserLoggedIn), @"User is not logged in.")
}

@end

For more information, see Subliminal's wiki.

Continuous Integration

Subliminal includes end-to-end CI support for building your project, running its tests on the appropriate simulator or device, and outputting results in a variety of formats.

For example scripts and guides to integrate with popular CI services like Travis and Jenkins, see Subliminal's wiki.

Comparison to Other Integration Test Frameworks

Contributing

Subliminal welcomes pull requests! Check out the contributing guidelines to learn how to set up Subliminal for development and how to make a successful pull request.

Credits

Created by Jeff Wear, made possible by Inkling, with help from:

and Subliminal's growing list of contributors.

Contact

If you'd like to chat, we hold "office hours" on Gitter 3-4pm Pacific Time, Tuesdays and Thursdays.

Lastly, you can follow Subliminal on Twitter for news and tips (@subliminaltest).

Copyright and License

Copyright 2013-2014 Inkling Systems, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.