-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Continue execution after test failure (#126)
- Loading branch information
1 parent
33d09bf
commit 6bc0b36
Showing
4 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
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
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
18 changes: 18 additions & 0 deletions
18
WebDriverAgentMac/WebDriverAgentRunner/XCTestSuite+AMPatcher.h
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
#import <XCTest/XCTest.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface XCTestSuite (AMPatcher) | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
33 changes: 33 additions & 0 deletions
33
WebDriverAgentMac/WebDriverAgentRunner/XCTestSuite+AMPatcher.m
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
#import "XCTestSuite+AMPatcher.h" | ||
|
||
#import <objc/runtime.h> | ||
|
||
static void (*originalHandleIssue)(id, SEL, id); | ||
|
||
static void swizzledHandleIssue(id self, SEL _cmd, id issue) | ||
{ | ||
[issue setValue:@(NO) forKey:@"_shouldInterruptTest"]; | ||
originalHandleIssue(self, _cmd, issue); | ||
} | ||
|
||
@implementation XCTestSuite (AMPatcher) | ||
|
||
+ (void)load | ||
{ | ||
SEL originalHandleIssueSelector = NSSelectorFromString(@"handleIssue:"); | ||
if (nil == originalHandleIssueSelector) return; | ||
Method originalHandleIssueMethod = class_getInstanceMethod(self.class, originalHandleIssueSelector); | ||
if (nil == originalHandleIssueMethod) return; | ||
originalHandleIssue = (void (*)(id, SEL, id)) method_setImplementation(originalHandleIssueMethod, (IMP)swizzledHandleIssue); | ||
} | ||
|
||
@end |