Skip to content

Commit

Permalink
improve test failure logging
Browse files Browse the repository at this point in the history
  • Loading branch information
talkol committed Oct 9, 2016
1 parent cfc9587 commit 9d01548
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions detox/ios/Detox/TestFailureHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ @implementation TestFailureHandler

- (void)handleException:(GREYFrameworkException *)exception details:(NSString *)details
{
NSLog(@"Detox Test Failed: %@", details);
NSString *description = [NSString stringWithFormat:@"%@\n%@", [exception description], details];

NSLog(@"Detox Test Failed:\n%@", description);

UIWindow* window = [[UIApplication sharedApplication] keyWindow];
NSLog(@"UI Hierarchy on test failure: %@", [GREYElementHierarchy hierarchyStringForElement:window]);
NSLog(@"UI Hierarchy on test failure:\n%@", [GREYElementHierarchy hierarchyStringForElement:window]);

if (self.delegate) [self.delegate onTestFailed:details];
if (self.delegate) [self.delegate onTestFailed:description];
}

- (void)setInvocationFile:(NSString *)fileName andInvocationLine:(NSUInteger)lineNumber
Expand Down

0 comments on commit 9d01548

Please sign in to comment.