Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
An iOS Library to support A/B Testing remotely defined values in Apps and reporting back to a server. Includes native controls for A/B Testing UIButton text and background image. Includes generic ABTestCase for testing any NSString value.
branch: master

This branch is 29 commits ahead, 11 commits behind chrismaddern:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
ABTestSampleApp
.gitignore
LICENSE.md
README.md

README.md

iOS-Split-A-B-Test-Library

This is an Objective-C library for performing A-B testing in iOS Apps. Data is configured and results are collected remotely using the companion PHP Server project (https://github.com/chrismaddern/A-B-Split-Test-Server). This project contains a sql export of the state of the database to match the test app in this repository.

The Sample Application contains examples.

You can perform a split test in a number of ways:

  • Custom control in Interface builder.
    • Add a UIButton to the View
    • Change it's Class to either ABTestButton or ABImageTestButton
    • Set the User Defined Runtime Attributes:
      • testCase - the token of the test case
      • default - the control value and used when no test data is available
      • type (UIImageTestButton only) - "url" or "local" - determines whether to load the images in the test case from the bundle or the web.

The button will report a positive outcome for that test case whenever it is tapped.

  • Test Anything that can be determined with a String using ABTestCase

Code:

//Create a test case
ABTestCase *testCase = [[ABTestCase alloc] 
    initWithTestCase:YOUR_TEST_CASE_ID
    andControlValue:THE_DEFAULT_STRING_TO_FALL_BACK_ON];
NSString* testValue = [testCase value];
//Do whatever you want with testValue here 

And then to report the outcome…

//Something good has happened because of this value
ABTestCaseOutcome *outcome = [[ABTestCaseOutcome alloc] 
    initWithTestCase:YOUR_TEST_CASE_ID
    andOutcomeResponse:ABPositiveResponse];
[outcome send];

LICENSE

The iOS A/B Split Test Library is licensed under the MIT License.

CONTRIBUTIONS

Contributions are very welcome.

I will be continuing to extend this - the initial work was completed in less than a day and there are a lot of shortcomings at the moment!

If you have extended this in a way that you think would be useful to the community (or fixed one of the undoubtedly many bugs), please do submit a pull request! :)

Something went wrong with that request. Please try again.