Example to demonstrate how to run UI-independent tests in an iOS project from the Swift Package Manager (SPM).
Based on the example by Paul Samuels here.
- Create a folder to hold the project structure visible to the SPM.
- Create symlinks into the
Sources
andTests
subfolders for the UI-independent part of your app. - Create a
Package.swift
file to describe your targets. - From within the SPM folder, run
swift test
. - (Optional) Use
swift test --filter target.testClass
to execute single groups of tests.
- Run your UI-independent tests faster: no need to start the iOS simulator.
- Keep the structure of the project unaltered.