SPYTestLog 0.0.3

SPYTestLog 0.0.3

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Scott Petit.



  • By
  • Scott Petit

XCTest meet XcodeColors

SPYTestLog is a simple test utility to add some color to your Xcode console. Instead of the drab and plain logs of plain ole XCTestLog

XCTestLog

You get the colorful output of SPYTestLog

SPYTestLog

Integration

SPYTestLog has a dependency on XcodeColors to display colorful output in your Xcode console. You should first follow the instructions to get that installed (probably easiest through Alcatraz). Please note that if you’re working with a team and they don’t have XcodeColors installed then they will continue to see the same default XCTestLogs.

The best and fastest way of integrating SPYTestLog is with CocoaPods. SPYTestLog should only be added to your test target so adding it would look something like

target :YOUR_TEST_TARGET, :exclusive => true do
  pod 'SPYTestLog’
end

Caveats

One caveat is that SPYTestLog will add the format for XcodeColors to command line builds as well. This means that if locally you run ‘xcodebuild’ there will be formatting in some of your test logs. This also means that if locally you use ‘xcodebuild’ with something like XCPretty you won’t get any output for your test logs. If you have any suggestions for a way to fix this I’m all ears.

This however shouldn’t effect Continuous Integration servers (assuming they don’t have XcodeColors installed) as SPYTestLog will just fall back to the normal log if XcodeColors is not installed.

This also doesn’t seem to effect command line builds using XCTool.

Subclassing

Subclasses can override the colors of the output by overriding

- (NSString *)testCasePassedColor;
- (NSString *)testCaseFailedColor;

and providing a properly formatted XcodeColor. For reference the implementation of looks like this.

- (NSString *)testCasePassedColor
{
    return @"fg127,175,27;";
}