Last active
August 29, 2015 14:01
-
-
Save steipete/e0bbeeac9b6c776a06c2 to your computer and use it in GitHub Desktop.
I'm using Aspects to hook into Xcode's test system to update the UI as the tests are running - this provides a nice feedback what's currently going on. https://github.com/steipete/Aspects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds]; | |
self.window.backgroundColor = [UIColor whiteColor]; | |
UIViewController *controller = [UIViewController new]; | |
controller.title = @"Testing..."; | |
self.rootViewController = [[UINavigationController alloc] initWithRootViewController:controller]; | |
self.window.rootViewController = self.rootViewController; | |
[self.window makeKeyAndVisible]; | |
// Use Aspects to hook into XCTestCase to get better feedback than just the log. | |
[NSClassFromString(@"XCTestCase") aspect_hookSelector:NSSelectorFromString(@"invokeTest") withOptions:AspectPositionBefore usingBlock:^(id<AspectInfo> info) { | |
controller.title = [info.instance description]; | |
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.001f]]; | |
} error:NULL]; | |
return YES; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Really cool. I tried adding a UITextView that logs the tests, would be easy to color them green/red as they progress. Not sure if super useful though.