#2 XCTest vs. Swift Testing - Has error testing been simplified?

#2 XCTest vs. Swift Testing - Has error testing been simplified?

Today we check how testing error has changed in the new framework. In XCTest, we use XCTAssertThrowsError to check if a specific error is thrown. This assertion comes with the error handler closure where we can perform additional checks like e.g. verifying the exact error type. With Swift Testing, this process is even simpler, especially when an error conforms to Equatable. We can directly specify the expected error in the expect macro and it automatically checks the type....

November 19, 2024 · 1 min · Maciej Gomolka
#1 XCTest vs. Swift Testing - fresh look on a new testing framework

#1 XCTest vs. Swift Testing - fresh look on a new testing framework

New Series! XCTest vs. Swift Testing - fresh look on a new testing framework. Swift Testing was presented at WWDC24 as a new, modern, simplified framework for writing automated tests. It’s a perfect candidate to replace XCTest unit tests, so it’s definitely worth learning. I haven’t had a chance yet to use Swift Testing in production and the series is my motivation for me to discover it. Today we cover 2 basic differences ⤵️...

November 14, 2024 · 2 min · Maciej Gomolka
At the top, the title "TDD with SwiftUI - Triggering API Request" and at the bottom, an image of a phone with a red button and a finger pressing that button.

TDD with SwiftUI - Triggering API request

Recap Hello everyone and welcome to the next chapter of the series about SwiftUI code automated testing! In the previous post we defined acceptance criteria for the Joke app that we’re implementing we covered by snapshot tests all UI cases mentioned in the acceptance critieria That’s what the app looks like ⤵️ Here’s the link to the previous blog post ⤵️ (Worth reading before this one) Testing SwiftUI Code - The beginning (UI)...

September 13, 2024 · 9 min · Maciej Gomolka
At the top, the title "Swift Testing Parameterized Tests" and at the bottom, a table with scientists conducting experiments.

Swift Testing parametrized tests

Swift Testing can elevate your unit tests writing 🚀 Hello Apple Developer! I prepared a special post that will help you write better unit tests using the new SwiftTesting framework 🫢 The Swift Testing framework is the successor to XCTest for unit tests. It was introduced at this year’s WWDC24 and is worth learning 📚 One of the main features of Swift Testing are parameterized tests 🧪 Click to learn how to leverage this new feature ⤵️...

August 12, 2024 · 1 min · Maciej Gomolka
On the left side, the post title, and on the right, an image with a list of 5 tests, each accompanied by tags.

Insights about Swift Testing Tags

Today, I have a special post about Apple’s new testing framework - Swift Testing! 🤩 Swift Testing was presented at WWDC24 as a new, modern, simplified framework for writing automated tests. It’s a perfect candidate to replace XCTest unit tests, so it’s definitely worth learning 🧑‍🏫 The topic of Swift Testing is quite broad, so I decided to break it down into more digestible parts, starting with Swift Testing Tags. What is this?...

July 11, 2024 · 1 min · Maciej Gomolka