Skip to content

Debugging FitNesse acceptance tests in Xcode for iOS and macOS

For those of you who haven’t heard of FitNesse yet Paul Stringer has made it very easy to get started.

I started writing acceptance tests using FitNesse a few months ago and loved it from the start. Finally I was able to move those flakey, sluggish UI tests down to the integration test layer and focus on testing the raw logic of my app – the important stuff!

But there was a problem with FitNesse. I found that it was impossible to debug when there was an error in my code. It could crash and FitNesse wouldn’t give me any information; it could fail and I couldn’t set a break point to figure out why. Disaster! Or so I thought.

FitNesse tests don’t run like unit tests. You run them from the command line or from the FitNesse wiki so you don’t have control over the running process. But there’s a simple solution to this – attach your acceptance tests process to Xcode. I knew you could attach Xcode to an already running process but I had no idea that you could tell Xcode to wait for a process to launch and then attach. Perfect!

Step 1. Select attach to process by PID or name.
Screen Shot 2016-08-18 at 21.04.29

Step 2. Type in your acceptance tests process name and attach.
Screen Shot 2016-08-18 at 20.59.32

You should now see that Xcode is waiting for your acceptance tests to launch.
Screen Shot 2016-08-18 at 20.59.47

Step 3. Set a break point and run the tests.
Xcode will attach to the process and stop at your break point 🎉
Screen Shot 2016-08-18 at 21.01.43

It’s as easy as that! For extra ease you can add a custom keyboard shortcut in System Preferences to make attaching a process much quicker. I went for ⌥A. Another useful tip is to make sure you have an ‘All Exceptions’ break point too.

I hope this will help you to speed up the building of your acceptance tests!

Thanks to Mark Carter for showing me how to do this 👍

Published iniOS


  1. Dude this is awesome, I’ve known this trick for a while and it saved me from a lot of pain when I was getting started with Fitnesse. Thanks for sharing this neat trick.

    • Thanks Paul. It was a major ‘aha’ moment on my Fitnesse journey that I had to share.

Leave a Reply