Archives For Screencasts

How can we use Test-Driven Development for JSON parsing? Most developers are concerned with ways to implement the production code. There are various approaches, various libraries… But what about the unit test side of things?

If we write effective unit tests, the design can appear incrementally. And with a strong suite of tests, you’re free to change the implementation — even radically. When the results are guaranteed by tests, whatever approach you take or library you use becomes an implementation detail!

Last time, we looked at design principles, such as sticking to the Single Responsibility Principle and returning a Response Model. This time, let’s look at:

  • Test principles
  • A TDD demo in Objective-C

Continue Reading…

TDD doesn’t make anything happen automatically. You really need to level up on two other skills as you go: design, and unit testing. Doing so can shift TDD from being daunting to being simple.

Let’s look at how a change to unit testing empowers TDD.

Key with label "Leverage the synergies": TDD + Design + Unit Testing

leverage the synergies keychain by , used under CC BY 2.0 / / Added text to original

Continue Reading…

AppCode vs. Xcode: Which is easier to use for unit testing? Which gives better feedback?

AppCode vs. Xcode

Day 500-Shadowboxing by Michael Dunn, used under CC BY-NC-SA 2.0 / Logos added to original

Continue Reading…

xUnit Test PatternsI’ve given you 3 Reasons Why It’s Important to Refactor Tests. But what’s actually involved in refactoring tests?

The definitive book on this topic is xUnit Test Patterns: Refactoring Test Code by Gerard Meszaros. It’s a big book, full of patterns and smells. But there are 3 simple steps I take most often.

Here’s a five-minute screencast where I’m refactoring tests in my iOS TDD sample app using those 3 steps: Continue Reading…

A Value Object is a handy way to combine multiple values in a single object. It sounds simple — you just make each value a property, right? Well, there’s usually more to it than that. There’s even an entire objc.io article about Value Objects. …So how do you define a new Value Object?

I believe in laziness. Let’s do as little work as possible!

Continue Reading…

AppCode is an alternative IDE for Objective-C development. When it comes to test driven development, it’s superior to Xcode. But that’s not all. Check out the “inside-out” coding style it makes possible.

In general, AppCode lets me focus more quickly on semantics and less on fiddling with source code.

Are you interested in the AppCode templates I use?

Question: What other AppCode tricks do you like? Leave a comment below.

Remember my iOS Model-View-Controller TDD screencast? Eric Baker took it a few extra steps with his own follow-up screencast, demonstrating:

There’s a lot of interesting stuff here. But I also want to acknowledge that this screencast changed my mind about dot notation. Yes, really!

What are your thoughts about ReactiveCocoa, Kiwi, or AppCode? Leave a comment below.

The UIViewController TDD screencast ended with all the code in the view controller. Unfortunately, this is where many iOS programmers leave things! Let’s TDD our way to something better…

In part 2, we pick up from there and TDD to extract a model class, which the controller observes. You’ll see it evolve into true Model-View-Controller, driven by unit tests.

In particular, you’ll see how to TDD:

  • a model that posts notifications when it changes, and
  • a controller that observes those notifications.

Continue Reading…

This screencast focuses on the question I get the most: “Do you do test-driven development for view controllers?” It’s clearly a roadblock for many people. This screencast should remove that roadblock.

It also answers the question, “Is it worth doing?”


Outline:

  • Three types of unit test verification
  • View controller unit tests: the trick
  • TDD demo
  • How UIViewController TDD can actually help you code faster

Continue Reading…

February 26, 2016 Update: Read to the end for Git repo bonus!

TDD is a series of small steps. It can be difficult to grasp until you see those steps demonstrated.

That’s why I made this screencast. It was sparked by a Stack Overflow question that said, “All the examples of unit testing I read about seem to be extremely simple and trivial.” The question asks how to write unit tests for a piece of sample code that uses NSUserDefaults.

Outline: Continue Reading…