ocunit

How do I trap OCUnit test pass/failure messages/events.

I'm trying to use xcodebuild and OCUnit with my Continuous Integration server (TeamCity). JetBrains offers test observer implementations for boost::test and CppUnit that format test output in a way that TeamCity can interpret. I need to do something similar for OCUnit if I want to use it. There appears to be a SenTestObserver class ...

iPhone Unit Tests Hang; Fail to Call -applicationDidFinishLaunching:

I have unit tests set up for my iPhone project built using the Google Toolkit for Mac framework on top of OCUnit. I have a dependent project called "Unit Tests" that builds and runs the tests as needed. But then it all stopped working, for no reason that I can fathom. Suddenly, my "Unit Tests" executable launches and just sits there, wa...

Can't build OCUnit in GNUstep/Win32 environment - objc/runtime.h not found

I'm trying to unit test objective-c classes built in the MinGW shell. Since OCUnit has been embraced by Apple for XCode, it seems that the developer, Sen:te, has now focused on that. So, the last source distro that claims to support GNUstep is v27. Anyway, I downloaded the v27 tarball and tried to build in MinGW. You first have to bu...

OCUnit, NSLog, and XCode 3.1

I'd been using OCUnit (the default installation that comes with XCode) in XCode 3.0. I've been happy being able to run my tests and see the results in the Build Results window, as well as any NSLog() messages I output. However, with XCode 3.1 the tests run fine, but I suddenly lose my NSLog() output. Anybody know where it went? ...

OCUnit test for protocols/callbacks/delegate in Objective-C

Using OCUnit, is there a way to test delegate protocols? I'm trying this, which doesn't work. -(void) testSomeObjDelegate { SomeObj obj = [[SomeObj alloc] initWithDelegate:self]; [obj executeMethod]; } -(void) someObjDelegateMethod { //test something here } I'm going to try calling the obj method on a different thread and have ...

How to run OCTest from command-line, not XCode

XCode 3.1.2 using built-in OCTest unit testing. I'm getting a crash when unit tests run. I want to run w/ a few extra environment variables (MallocCheckHeapStart, MallocCheckHeapEach, for example). I'm a beginner with this and can't figure out how to run my app's OCTest unit tests from the command-line. Or alternatively, to convince ...

iPhone - Retrieving Resources for logical unit tests

I've been following Apple's documentation on writing unit tests for the iPhone, and out of the box, the routine doesn't seem to work. I'm not sure I understand where the unit test is going to get the reference to the application delegate. My Dependencies are like the following: My_Program_target -> UnitTesting_target -> UnitTests_bundl...

Unit Testing of private methods in Xcode

I'm trying out test driven development in a toy project. I can get the tests working for the public interface to my classes (although I'm still on the fence because I'm writing more testing code than there is in the methods being tested). I tend to use a lot of private methods becuase I like to keep the public interfaces clean; however,...

Why do my OCUnit tests fail with "code 138"?

I'm currently trying to learn objective-c using XCode 3.1. I've been working on a small program and decided to add unit testing to it. I followed the steps on the Apple Developer page - Automated Unit Testing with Xcode 3 and Objective-C. When I added my first test, it worked fine when the tests failed, but when I corrected the tests...

How do I link my executable to my test bundle when debugging test using otest?

I'm using kind of a hybrid of Chris Hanson's excellent Xcode unit testing guide. My program is a (command-line) application (which precludes using the executable itself to run the tests), but I need to be able to debug my unit tests. So what I have is as follows: Create test bundle and tests. Create new test target, set bundle loader ...

How do I run a subset of OCUnit tests in XCode

I have a suite of unit tests that I use before checking in my project. However, very often it's the case that only one of them finds some regression in the code. In these cases I'd like to only run that particular unit test while debugging the failure. I haven't found any way to do this in XCode. Is it possible? ...

Testing View Controllers --iPhone

My question is 2-fold. 1. Can I use OCUnit to test View Controllers. If so, how should I do it? If not, is there another Testing Kit I can use? ...

Why doesn't gcov report any lines being covered by my unit tests?

I am using Xcode 3.2 on 10.6, with the shipped version of gcov and default GCC compiler (both version 4.2.1). I have created a dependent Cocoa unit test bundle which is injected into my app, and followed Apple's documentation on setting up a gcov-instrumented build configuration - based on the Debug configuration which doesn't have any c...

Does OCUnit allow application tests to be run on the iPhone Simulator?

Apple's "iPhone Development Guide" suggests on page 62 that "Because application tests run only on a device, you can also use these tests to perform hardware testing...". I'd like to run my OCUnit test cases in the simulator as well -- but haven't figured out how to do that. Is it possible? Or do I have to use Google's toolkit instead? ...

iPhone: Application Testing and Core Location

I'm trying to implement Application Tests as described here. So far, so good, but i fail to test, for instance, the location of the device using Core Location. I have added the appropriate Framework to the Target, and have initiated the update of location, but i have no clue of how to wait for the location to be loaded, the test suite ju...

Should you still do memory management in a unit test? (OCUnit)

Hi! Should I still bother with releasing objects in a unit test? I noticed in Apple's "iPhoneUnitTests" sample project objects are [[object alloc] init] in the setup method but never released anywhere in the unit test? Thanks! ...

Using OCUnit in Xcode for iPhone projects?

After configuring my iPhone app for unit testing, I belatedly noticed this warning in the documentation: iPhone OS Unit Testing Support: Unit tests are not supported for iPhone applications. As some of the other Xcode documentation regarding unit testing is out of date...is this still the case? ...

Unit testing and TDD, OCUnit vs Google Tool Box.

Hi, I'm trying to choose between OCUnit and Google Tool Box, do you have any preferences, would recommend one or the other, why ? I would be very interested to hear about your experiences with any of the 2. The main problem i have with both of them is the managment of crashes in tested methods (ex: BAD ACCESS) None of them was able to ...

OCUnit (SenTestingKit) error file is not of required architecture

I'm trying to build a project that uses OCUnit to run tests but get the following errors when linking: ld: warning: in /Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks//SenTestingKit.framework/SenTestingKit, file is not of required architecture Undefined symbols: "_STComposeString", referenced from: -[ReaderTest testEmptyFile] ...

Simplified asserts in OCUnit

I just started jusing OCUnit and find the asserts a bit cumbersome. In JUnit I can write a test to compare numbers like below. This test will obviously fail, but this shows the nice, simple assert I can write for two numbers and the feedback I get: "expected <2> but was <3>" with very little code. What I tried so far i XCode is: Wh...