ios自动化WebDriverAgent测试报错

解决方法:

修改 WebDriverAgentLib/Utilities/FBFailureProofTestCase.m  第26行

self.internalImplementation = (_XCTestCaseImplementation *)[FBXCTestCaseImplementationFailureHoldingProxy proxyWithXCTestCaseImplementation:self.internalImplementation];

修改后

  if ([self respondsToSelector:@selector(internalImplementation)]) {
    // The `internalImplementation` API has been removed since Xcode 11.4
    self.internalImplementation =
      (_XCTestCaseImplementation *)[FBXCTestCaseImplementationFailureHoldingProxy
                                    proxyWithXCTestCaseImplementation:self.internalImplementation];
  } else {
    self.shouldHaltWhenReceivesControl = NO;
  }
}

报错详情:

输出提示:

2020-06-12 19:57:31.235846-0700 WebDriverAgentRunner-Runner[1849:82950] Running tests...
Test Suite 'All tests' started at 2020-06-12 19:57:32.209
Test Suite 'WebDriverAgentRunner.xctest' started at 2020-06-12 19:57:32.212
Test Suite 'UITestingUITests' started at 2020-06-12 19:57:32.213
Test Case '-[UITestingUITests testRunner]' started.
    t =     0.00s Start Test at 2020-06-12 19:57:32.226
    t =     0.01s Set Up
2020-06-12 19:57:32.240001-0700 WebDriverAgentRunner-Runner[1849:82950] -[UITestingUITests internalImplementation]: unrecognized selector sent to instance 0x283250c30
    t =     0.05s     Assertion Failure: <unknown>:0: failed: caught "NSInvalidArgumentException", "-[UITestingUITests internalImplementation]: unrecognized selector sent to instance 0x283250c30"
(
    0   CoreFoundation                      0x000000019a21e9a4 <redacted> + 252
    1   libobjc.A.dylib                     0x00000001993f79f8 objc_exception_throw + 56
    2   CoreFoundation                      0x000000019a13b1c8 <redacted> + 0
    3   CoreFoundation                      0x000000019a2241d4 <redacted> + 1408
    4   CoreFoundation                      0x000000019a225e6c _CF_forwarding_prep_0 + 92
    5   WebDriverAgentLib                   0x0000000103019e0c -[FBFailureProofTestCase setUp] + 136
    6   XCTest                              0x0000000101136c88 __48-[XCTestCase _performSetUpSequenceWithSelector:]_block_invoke_2 + 492
    7   XCTest                              0x000000010118c0d8 +[XCTestCase(Failures) performFailableBlock:testCase:testCaseRun:shouldInterruptTest:] + 84
    8   XCTest                              0x000000010118bfdc -[XCTestCase(Failures) _performTurningExceptionsIntoFailuresInterruptAfterHandling:block:] + 132
    9   XCTest                              0x0000000101136a7c __48-[XCTestCase _performSetUpSequenceWithSelector:]_block_invoke + 116
    10  XCTest                              0x000000010119dd7c -[XCTContext _runActivityNamed:type:block:] + 248
    11  XCTest                              0x000000010113f480 -[XCTestCase startActivityWithTitle:type:block:] + 200
    12  XCTest                              0x000000010113f630 -[XCTestCase startActivityWithTitle:block:] + 72
    13  XCTest                              0x00000001011369f8 -[XCTestCase _performSetUpSequenceWithSelector:] + 108
    14  XCTest                              0x0000000101134d68 -[XCTestCase invokeTest] + 728
    15  XCTest                              0x00000001011368b8 __26-[XCTestCase performTest:]_block_invoke_2 + 44
    16  XCTest                              0x000000010118c0d8 +[XCTestCase(Failures) performFailableBlock:testCase:testCaseRun:shouldInterruptTest:] + 84
    17  XCTest                              0x000000010118bfdc -[XCTestCase(Failures) _performTurningExceptionsIntoFailuresInterruptAfterHandling:block:] + 132
    18  XCTest                              0x00000001011367f0 __26-[XCTestCase performTest:]_block_invoke.366 + 96
    19  XCTest                              0x000000010119e48c +[XCTContext runInContextForTestCase:block:] + 212
    20  XCTest                              0x00000001011360dc -[XCTestCase performTest:] + 540
    21  XCTest                              0x000000010117986c -[XCTest runTest] + 60
    22  XCTest                              0x00000001011305c8 __27-[XCTestSuite performTest:]_block_invoke + 268
    23  XCTest                              0x000000010112fe58 __59-[XCTestSuite _performProtectedSectionForTest:testSection:]_block_invoke + 40
    24  XCTest                              0x000000010119e48c +[XCTContext runInContextForTestCase:block:] + 212
    25  XCTest                              0x000000010112fe00 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 156
    26  XCTest                              0x0000000101130150 -[XCTestSuite performTest:] + 320
    27  XCTest                              0x000000010117986c -[XCTest runTest] + 60
    28  XCTest                              0x00000001011305c8 __27-[XCTestSuite performTest:]_block_invoke + 268
    29  XCTest                              0x000000010112fe58 __59-[XCTestSuite _performProtectedSectionForTest:testSection:]_block_invoke + 40
    30  XCTest                              0x000000010119e48c +[XCTContext runInContextForTestCase:block:] + 212
    31  XCTest                              0x000000010112fe00 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 156
    32  XCTest                              0x0000000101130150 -[XCTestSuite performTest:] + 320
    33  XCTest                              0x000000010117986c -[XCTest runTest] + 60
    34  XCTest                              0x00000001011305c8 __27-[XCTestSuite performTest:]_block_invoke + 268
    35  XCTest                              0x000000010112fe58 __59-[XCTestSuite _performProtectedSectionForTest:testSection:]_block_invoke + 40
    36  XCTest                              0x000000010119e48c +[XCTContext runInContextForTestCase:block:] + 212
    37  XCTest                              0x000000010112fe00 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 156
    38  XCTest                              0x0000000101130150 -[XCTestSuite performTest:] + 320
    39  XCTest                              0x000000010117986c -[XCTest runTest] + 60
    40  XCTest                              0x00000001011b05f0 __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke + 176
    41  XCTest                              0x00000001011b06f0 __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke.100 + 108
    42  XCTest                              0x000000010114a354 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 588
    43  XCTest                              0x00000001011b0388 -[XCTTestRunSession runTestsAndReturnError:] + 592
    44  XCTest                              0x0000000101114bbc -[XCTestDriver runTestsAndReturnError:] + 428
    45  XCTest                              0x000000010119a424 _XCTestMain + 2396
    46  WebDriverAgentRunner-Runner         0x0000000100c8f818 -[_XCTRunnerAppDelegate applicationWillResignActive:] + 0
    47  WebDriverAgentRunner-Runner         0x0000000100c8f720 _XCTRunnerRunTests + 0
    48  CoreFoundation                      0x000000019a1b0578 <redacted> + 20
    49  CoreFoundation                      0x000000019a1afe7c <redacted> + 272
    50  CoreFoundation                      0x000000019a1aaee0 <redacted> + 1024
    51  CoreFoundation                      0x000000019a1aa7c0 CFRunLoopRunSpecific + 436
    52  GraphicsServices                    0x000000019c3ab79c GSEventRunModal + 104
    53  UIKitCore                           0x00000001c6b29c38 UIApplicationMain + 212
    54  WebDriverAgentRunner-Runner         0x0000000100c8f9e4 main + 192
    55  libdyld.dylib                       0x0000000199c6e8e0 <redacted> + 4
)
    t =     0.06s Tear Down
Test Case '-[UITestingUITests testRunner]' failed (0.066 seconds).
Test Suite 'UITestingUITests' failed at 2020-06-12 19:57:32.290.
     Executed 1 test, with 1 failure (1 unexpected) in 0.066 (0.077) seconds
Test Suite 'WebDriverAgentRunner.xctest' failed at 2020-06-12 19:57:32.295.
     Executed 1 test, with 1 failure (1 unexpected) in 0.066 (0.083) seconds
Test Suite 'WebDriverAgentLib.framework' started at 2020-06-12 19:57:32.297
Test Suite 'WebDriverAgentLib.framework' passed at 2020-06-12 19:57:32.302.
     Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.004) seconds
Test Suite 'All tests' failed at 2020-06-12 19:57:32.304.
     Executed 1 test, with 1 failure (1 unexpected) in 0.066 (0.095) seconds

 

参考资料 :

  https://github.com/appium/WebDriverAgent/pull/286 [1]

  https://github.com/appium/appium/issues/13949 [2]

上述方法可能会报错,不行的化按照下面的方法解决试试。

https://blog.csdn.net/ManyPeng/article/details/106547750

 

posted @ 2020-06-13 12:26  Hlikex  阅读(3160)  评论(0编辑  收藏  举报