Quality Coding

My Interview about TDD on the iPhreaks Podcast


iPhreaks is a terrific podcast done as a panel discussion. The panel often brings strong experience from other platforms. (In fact, iPhreaks is the iOS cousin to the Ruby Rogues panel.) They already discussed TDD in episode 95. Following up on that, I’m honored that they invited me as their guest to talk more about TDD and Testing in episode 116.


iPhreaks Podcast outline

Here’s the outline of our discussion:

  • Tools For Testing and Test-Driven Development (TDD)
  • Matching/Matchers
  • Getting Started with OCHamcrest
  • Partial Matching
  • Mocking and Stubbing
  • TDD Process and Workflow
  • TDD vs Unit Testing
  • iOS Code That Doesn’t/Does Adapt Well to TDD
  • User Interface Testing
  • End-to-End Testing
  • Communication and Collaboration
  • OCMock, OCMockito
  • OCMockito with Swift?
  • Inside-Out vs. Outside-In

Things I wish I’d said

Of course, listening to the podcast, I realize there are things I wish I’d said, such as:

  • The difference between mocks and stubs.
  • That the purpose of mocks is to verify interactions.
  • That you don’t need a mocking framework to make mocks and stubs. In fact, I recommend against it at first.

Chuck asked,

So let’s say that you wanted to add a feature to Skype where, every time somebody typed the word “whistle” their phone would whistle at them. How would you TDD something like that?

Here’s how I’d begin to break it down:

  • Text detection to create a Whistle command.
  • Executing the Whistle command, which plays a sound.
  • What if the user pastes text instead of typing it, and it contains multiple commands?

It’s challenging to take a workflow and break it down into smaller tests. Software design principles help a lot. In particular, don’t embed control into your UI. Instead, design a UI-ignorant command architecture.

What would you say, or ask?

I hope you’ll check out the podcast. I find the panel discussion format really engaging, and had a lot of fun.

If you’d been on the panel, what would you have said or asked about iOS TDD and Testing? Well, click here to have your say, or ask your question!

About the Author Jon Reid

Jon is a coach and consultant on iOS Clean Code (Test Driven Development, unit testing, refactoring, design). He's been practicing TDD since 2001. You can learn more about his background, or see what services he can bring to your organization.

follow me on:

Leave a Comment:

Add Your Reply