Unit Testing and Xcode take II
Spent the last 2 night adding unit testing to MetaBiff.
Yes, write the tests then code, but I was struggling through Cocoa, Xcode, and objective-c, I really did not have much of anything I really wanted to keep. I treated the whole session as 1 big spike solution.
I have a good grasp on OCUnit. Still stumbling on OCMock, but that might be my design ad much as lack of knowledge.
To help myself on unit tests and mock objects I started to refactor my code using Key-Value Coding. It seems OCMock makes heavy use of technology.
I do love @property and @synthesize for compiler generated setters and getter. I highly recommend it!
The lessons learned today.
How to check for an exception in OCUnit?
STAssertThrows([parser parse:@"a"], @”Protocol ‘a’ unknown.”);
When you want to compile NSString objects use STAssertEqualObjects!
STAssertEqualObjects(returnedVersion, expectedVersion,
@"Protocol header type did not match: return=%@ expected=%@", returnedVersion, expectedVersion);
STAssertEqualObjects([continuum valueForKey:@"name"], @”continuum.real-time.com”, @”Names does not match.”);
Next up to really understand Run Loops and how they relate to threads.