Author: queso_grande

Honouring Jean MacDonald – ALD2015

For Ada Lovelace Day 2015, I’m honouring Jean MacDonald from App Camp for Girls. Jean was a partner at Smile Software and at one of Apple’s Developer Conferences, she noticed that there were very few women developers in attendance. Having been to Rock ‘n’ Roll Camp for Girls, Jean decided to start App Camp for Girls in 2012 with the express purpose “to empower girls by providing engaging and accessible educational programs in software development.”

App Camp for Girls kicked off with an IndieGoGo campaign to raise $50,000, and in a month managed to raise over $100,000. Beginning with a beta camp in Portland, Oregon in June 2013, the volunteer driven organization has now spread to provide App Camps for Girls in Seattle, Washington, and Vancouver, British Columbia – truly international!

And so it is truly well deserved that Jean is my honoree this year – she took it upon herself to attend Big Nerd Ranch to learn Apple iOS programming! Oh, and she also plays guitar and the drums in Ruby Calling!

Unit Testing in Xcode 4

One of the nice things in Xcode 4 is the integration of the OCUnit, or SenTestKit, Unit Test suite into the environment. My last foray into unit testing was with JUnit in Eclipse. I’m currently working on an Objective-C library using JSON for data transmission and needed to test its methods.

Here’s a good guide on setting up a project to use OCUnit and OCMock for mock objects – Unit Testing in Xcode 4 Quick Start Guide | Ray Wenderlich. The article also mentions GHUnit which has some additional features over OCUnit – will have to look at that too!

So I’ve written my test cases and run them. I then see several test failures which seemed out of the ordinary. Now, the test cases are written in the order I expect them to run in the file, and I noticed that they were being run in an order other than the sequence in the file, which is what I was used to in JUnit. The Unit Test documentation on the Apple developer site Xcode Unit Testing Guide doesn’t mention anything about the order of test case execution, and I could not find anything relevant on the ‘net.

After scrutinising the test case run order, I came to the conclusion that it was in alphabetical order! And now I’ve taken to numbering the test cases thusly – test_0010_xxx and so forth – shades of BASIC line numbers!

And there’s more – unit tests are by their intent, tests for a unit. Each is a single entity which performs a set of operations as an independent standalone code segment. I had instead written test methods which were dependent on the previous method’s results – not a real unit test at all, and therefore a new lesson learnt! In fact, Apple documentation states: “When Xcode runs unit tests, it invokes each test case method independently.” Might not need those line numbers after all…

So chalk this one up to experience, and blog it for all to find out!