I\'m trying to use xcodebuild and OCUnit with my Continuous Integration server (TeamCity).
JetBrains offers test observer implementations for boost::test and CppUnit t
I have implemented a simple Teamcity Adapter, you can view the gist here. SenTestObserver isn't exactly broken, it simply doesn't adhere to the best practices:
This is what you need to call in your Observer subclass to have it properly registered:
+(void)initialize
{
[[NSUserDefaults standardUserDefaults] setValue:@"TeamCityAdapter" forKey:@"SenTestObserverClass"];
// we need to force SenTestObserver to register us as a handler
// SenTestObserver is properly guarding against this invocation so nothing bad will hapen
// but this is required (bad design on SenTestObserver's side)...
[super initialize];
}
because SenTestObserver's initialize looks like this:
+ (void) initialize
{
if ([self class] == [SenTestObserver class]) {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *registeredDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
@"SenTestLog" , @"SenTestObserverClass",
nil];
[defaults registerDefaults:registeredDefaults];
[NSClassFromString ([defaults objectForKey:@"SenTestObserverClass"]) class]; // make sure default observer is loaded
}
if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"SenTestObserverClass"] isEqualToString:NSStringFromClass(self)]) {
[self setCurrentObserver:self];
}
}
I hope this will help others out there looking for a teamcity adapter for OCUnit / SenTestingKit.