The Tauk Swift Package provides access to a TaukXCTestCase class that is a drop-in replacement for the standard XCTestCase class. TaukXCTestCase itself is a subclass of XCTestCase. This guide will walkthrough how to add it to an Xcode Project or Workspace and use it in the context of a UI test.

Adding to an Xcode Project

From an Xcode Project navigate to your project settings, and click on the Package Dependencies section.

From here you can click on the + button to add a new Swift package. This will open a popup window with a search bar that displays Apple’s package collection. Copy and paste the Tauk Swift Package GitHub repository HTTPS URL in the search bar:

<https://github.com/thetauk/tauk-ios-xctest.git>

Xcode lets us specify a dependency rule on which version it should fetch. The default 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.

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.