Disable XCTests on Swift Package Manager. Quick and dirty

Pacu
1 min readDec 8, 2023

--

If you are doing TDD but you also like to push your progress to remotes in Git, you will want your knowingly broken tests disabled to avoid false alarms in your CI

Lets say you have this test. It’s a blunt example but on Test Driven Development we know that we do “RED-GREEN-REFACTOR” so RED it’s normal.

func testIKnowItsBroken() {
XCTAssert(false)
}

Sometimes, you want to push our progress for whatever reason. If you push this to your CI integrated Git repo it will trigger all sorts of actions that depending on your pay tier could cost you money.

How to disable tests on Swift Packages? Easier than you think

Unlike Xcode that relies on xcodeproj files, Swift Package Manager relies on convention over configuration to run XCTests. So Xcode and swift test won’t run this tests if we remove the test prefix from it

func disabled_testIKnowItsBroken() {
XCTAssert(false)
}

That’s it!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Pacu
Pacu

Written by Pacu

Software Developer. Rookie surfer

Responses (1)

Write a response