In the last post, we wrote our first SwiftUI test in pseudocode. We knew what we wanted to test — that the initial displayed count is zero — but we didn’t yet have a way to make it real. Before we can turn that pseudocode into real code, we need an essential tool: ViewInspector. This is

Read More

In TDD: Where Do You Even Begin? we distilled the “essence” of the Counter app to decide on our first test. Now let’s begin fleshing out that test — not by jumping straight into code, but by describing the test in natural language.How Should We Continue?We have a name describing the first test we want

Read More

When you’re starting TDD, the hardest part is knowing where to begin.What should the first test be? What even counts as a “first step”? Table of Contents What’s the Essence?Create the Test FileWhat Should the First Test Be? What’s the Essence?We’re building a simple app — a counter, for counting things. And we want to

Read More

Xcode supports automated refactoring. Supposedly. In practice, the options are limited and often unavailable. You’ll right-click something, navigate to the Refactor submenu… only to find that the command you want is grayed out. It’s a waste of time. Eventually, you stop trying. That’s the real problem. Xcode’s poor support for refactoring discourages people from using it at all.

Read More

In my last post, we explored why unit testing SwiftUI is valuable — even though many argue against testing UI code. Before that, in my SwiftUI Testing Challenge, I showed some SwiftUI code and asked you to think through what you would test. One of the key questions was:What parts are worth testing, and what

Read More