Latest 0.3.4
License MIT
Platforms ios 10.0
Dependencies XCTest-Gherkin
Frameworks XCTest

The App Business

Build Status

Framework for extending the structuring of XCUI tests in a BDD style using the POM, steps and gherkin styled feature files found in the pod XCTest-Gherkin. Also a collection of functions to make XCUI easier to use and read.


XCTest-Gherkin (Read more on the setting up of Feature and Step files here: XCTest-Gherkin Github)


TABTestKit is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'TABTestKit'

Configure your iOS project

To start, make sure all of the feature and page files that are created, inherit from BaseFeature and BasePage repsectively. BaseFeature contains all of the setup, launch and tear down for the for app and each test case that is run. BasePage contains access to the trait element with allows the await() function to be called, along with a built-in Back Button interaction.

class ExampleFeature: BaseFeature {
  func test_ExampleFeature() {
    Given("I have opened the application")
class ExampleSteps: StepDefiner {
  let examplePage = ExamplePage()

  override func defineSteps() {
    step("I have opened the application") {

For the basics around writing Steps, please see XCTest-Gherkin’s documentation.

When configuring a Step file, you will have to provide an instance of each of the pages you want to reference. You can either do this for every step file or create a BaseSteps file to compile a list of page instances and inherit from that on the other step files, getting rid of the duplication.

final class ExamplePage: BasePage {
  let app: XCUIApplication
  let trait: XCUIElement
  let searchField: XCUIElement

  override init() {
    app = App.shared.current()
    searchField = app.textFields["Search Field"]
    trait = app.staticTexts["Hello World!"]

You will recognise this as setting up page objects for ineracting with e.g. a button, field, label etc. The one important one to note here is app. This must be present in all pages as it is the link to the singleton instance of the app under test.

See below for a more indepth usage guide of BasePage and BaseFeature


To run the UI automation tests, switch to the TABTestKit_ExampleUITests and use CMD + U.


trait: This is a page element that can be defined once a page has inherited from BasePage which will allow you to call .await() on that page.
await: Uses the given trait element for a page and calls waitForElementToAppear() on it. Using a unique element to that page is the recommended selection for a trait.
tapBackButton: Use a generic identifier matcher to find the native Back button and tap it. Note: This is done by the specific "Back" string – will need to be overriden for a custom back button.


setUp: Starts the XCTestCase instance with, defaulting continueAfterFailure to false and launches the App using launchApp().
launchApp: Calls launchWithOptions() from the App singleton to launch the app at the beginning of each XCTestCase.
tearDown: Calls terminate() from the App singleton to terminate the app after each XCTestCase.

Global functions

waitForElementToAppear: Takes an element and waits for a default (but overridable) amount of time and checks over that time period whether that element exists and is hittable.
tapWhenElementAppears: Runs waitForElementToAppear and adds a .tap() call onto the element.
waitForElementToDisappear: Takes an element and waits a for a default (overridable) amount of time and checks over that time period whether that element doesn’t exist and isn’t hittable.
tapCoordinate: Takes an x and y value and taps it.


(This is an extension of XCUIElement)
scollToLastCell: Finds the last cell on the page and uses scroll to get to it.
scroll: Scrolls to a given element, the default is to scroll down but this is overridable using a bool argument flag.


Guidelines for contributing can be found here.


Neil Horton, [email protected],
Zachary Borrelli, [email protected],


XCTest-Gherkin – Sam Dean, [email protected]


TABTestKit is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "TABTestKit",
    "version": "0.3.4",
    "summary": "Base to work off of for XCUI.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "zacoid55": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.3.4"
    "platforms": {
        "ios": "10.0"
    "source_files": "TABTestKit/Classes/**/*",
    "frameworks": "XCTest",
    "dependencies": {
        "XCTest-Gherkin": [

Pin It on Pinterest

Share This