allending/Kiwi — Issue #84: JUnit-compatable XML output.
Author: SevInf
Created: 2012-01-21 14:08:58+00:00
State: open

Hi.
We are trying to use Kiwi on our Jenkins server. It expects JUnit-compatable XML test results output to be able to report test results and build trend graphs. There are few possible ways to achive this with OCUnit. One is https://github.com/threeve/BPOCUnitXMLReporter that captures OCUnit notifications, the other is Jenkins Xcode plugin (https://wiki.jenkins-ci.org/display/JENKINS/Xcode+Plugin) which parses console output. However, both this solutions doesn't work very well with Kiwi. Due to #69 all test cases named 'example' in reports:
![example screenshot](http://habrastorage.org/storage2/8d7/999/f3c/8d7999f3cd18b4a726b57c4db831c7ac.png)

Will be nice if Kiwi will support XML output (Cedar already has this option). I've tried to implement this using OCUnit notifications, however, example description are not avaliable yet when SenTestCaseDidStartNotification is posted and already gone when SenTestCaseDidStopNotification is posted.

So, I propose two possible solutions:
1. Implement NSNotifications for Kiwi examples. Post them when example started, finished, failed and pending. Pass valid example description in notifications. Capture them and generate XML, like BPOCUnitXMLReporter.

2. Implement something like:

```objective-c
@protocol KWOutput
-(void)reportExampleGroupStart:(NSString*)exampleGroupName;
-(void)reportExamplePassed:(KWItNode*)exampleNode;
-(void)reportExampleFailed:(KWItNode*)exampleNode;
-(void)reportExamplePending(KWItNode*)exampleNode;
-(void)reportExampleGroupFinish:(NSString*)exampleGroupName;
@end
```
And two classes implementing this protocol: KWConsoleOutput and KWXMLOutput.
Current implementation with reportFailure: for failed and NSLogs for passed and pending examples will go to KWConsoleOutput and xml output will be in KWXMLOutput. Class to use will be selected by preproccessor macro or environment variables.

Can you tell me please what you think on this problem and proposed solutions and which of them will have more chances to be merged?
Thanks.