Integrating Tauk into your XCTest User Interface Tests

Nathan Krishnan
4 min readMar 23, 2022


Apple’s XCTest is part of Xcode and is the de facto choice for writing UI tests for your iOS app. It is part of Xcode and does not require any additional dependencies to use. In this short guide, I’ll walkthrough how to integrate your existing XCTest cases into the Tauk platform.

Contents of this Guide

  • Create a Tauk account
  • Adding the Tauk Package to an Xcode Project
  • Using Tauk in a UI Test Case

Create a Tauk Account

Creating your first project in Tauk

Creating a Tauk account is simple and straightforward. Navigate to the Tauk website and click on “Try Tauk for Free” to create a free account. Once authenticated in your account, you’ll be able to create your first project. Once you’ve completed this step, you’ll have two important pieces of information that we will use later in this guide:

  • A Project ID
  • An API Token

Adding the Tauk Package to an Xcode Project

Open your Xcode Project and select File > Add Packages from the menu bar:

Add Packages option in Xcode

This will open a modal dialog for selecting a new package to add. Paste the Tauk Swift Package GitHub repository HTTPS URL in the search bar:
Adding the Tauk package in Xcode

Xcode lets us specify a dependency rule on which version it should fetch. The option of Up to Next Major Version is reasonable for getting started, but of course feel free to select a rule of your preference. Next, select Add Package.

Xcode will fetch the Tauk Package from GitHub and present a dialog window with the option of adding it to a target. Under the Add to Target column, select the UI Tests target in your project and then select Add Package.

Adding the Tauk Package to a UI Test target

📦 The Tauk package is now added to your project and can be imported and used.

Note: If you accidentally selected the wrong target, it’s easy to correct this!

Select your project from the Project navigator and then select your UI tests under the TARGETS area. Select the Build Phases section and from the Link Binary With Libraries section, click on the “+” button.

This will open a dialog menu list and select the Tauk package.

Using Tauk in a UI Test

In your UI Test file, import Tauk right after the XCTest import:

import Tauk

By default your test case classes will subclass from XCTestCase. Replace subclassing from XCTestCase with TaukXCTestCase. For example:

Subclass from TaukXCTestCase

If your test case overrides any of the XCTestCase lifecycle methods, such as:

  • setup()
  • setupWithError()
  • tearDownWithError()
  • tearDown()

Ensure to call the super class (TaukXCTestCase) method before your logic. For example:

Overriding XCTestCase lifecycle methods

In your test case, after you’ve created an instance of XCUIApplication, you can initialize the Tauk using the method taukInitialize(). Note there’s two options for this method:

  • taukInitialize(apiToken:projectId:appUnderTest)
  • taukInitialize(apiToken:projectId:appUnderTest:exclude: uploadTimeoutSeconds:customTestName:userProvidedBundleId)

The required parameters are: apiToken, projectId, and appUnderTest. The other parameters are optional and provide additional features based on your needs.

For example:

Using taukInitialize()

And that’s it! You now have successfully integrated your XCTest UI test with Tauk. Go forth and build and test great apps!

Discussing interesting topics in automation testing is precisely why we created our Discord server! Consider joining our community today 👋:



Nathan Krishnan

I enjoy writing about building & testing apps. Co-founder and CTO of Tauk (acquired by Moloco).