2016-05-06 21 views
1

ローカルコンピュータで動作するJenkinsマシンでコマンドラインからXcode UIテストを実行しようとしています。しかし、JenkinsでUIテストを実行しようとすると、シミュレータでアプリを起動できないように見えます。何が起こるかは、デバイスがシミュレータにロードされ、UIテストターゲットが開き、画面が黒くなります。そして、何も次のように私は(私はアプリが起動し、開始するには、自動化することが予想される)のエラーを取得するまで、30秒間発生するようだ:JenkinsでXcode(7.3)UIテストを実行できません

2016-04-22 11:44:54.549 XCTRunner[33303:299557] Running tests... 
11:44:54.707 XCTRunner[33303:299590] _XCT_testBundleReadyWithProtocolVersion:minimumVersion: reply received 
11:44:54.711 XCTRunner[33303:299587] _IDE_startExecutingTestPlanWithProtocolVersion:16 
2016-04-22 11:45:24.730 XCTRunner[33303:299557] *** Assertion failure in void _XCTFailInCurrentTest(NSString *, ...)(), /Library/Caches/com.apple.xbs/Sources/XCTest_Sim/XCTest-10112/XCTestFramework/Classes/XCTestCase.m:63 
2016-04-22 11:45:24.732 XCTRunner[33303:299557] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '_XCTFailInCurrentTest should only be called while a test is running. 
Failure description: Failed to receive completion for <XCDeviceEvent:0x7f88c85972c0 page 12 usage 64 duration 0.01s within 30.0s' 
*** First throw call stack: 
(
    0 CoreFoundation      0x0000000102369d85 __exceptionPreprocess + 165 
    1 libobjc.A.dylib      0x0000000101ddddeb objc_exception_throw + 48 
    2 CoreFoundation      0x0000000102369bea +[NSException raise:format:arguments:] + 106 
    3 Foundation       0x0000000101a27e1e -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 169 
    4 XCTest        0x0000000101875bbf _XCTFailInCurrentTest + 375 
    5 XCTest        0x000000010189717c -[XCUIDevice _dispatchEventWithPage:usage:duration:] + 847 
    6 XCTest        0x00000001018c2612 XCInitializeForUITesting + 575 
    7 XCTest        0x000000010186191d -[XCTestDriver _runSuite] + 141 
    8 XCTest        0x00000001018627d1 -[XCTestDriver _checkForTestManager] + 259 
    9 XCTest        0x00000001018aca9a _XCTestMain + 628 
    10 CoreFoundation      0x000000010228f2ec __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12 
    11 CoreFoundation      0x0000000102284f75 __CFRunLoopDoBlocks + 341 
    12 CoreFoundation      0x00000001022846d2 __CFRunLoopRun + 850 
    13 CoreFoundation      0x00000001022840f8 CFRunLoopRunSpecific + 488 
    14 GraphicsServices     0x0000000104424ad2 GSEventRunModal + 161 
    15 UIKit        0x000000010271ff09 UIApplicationMain + 171 
    16 XCTRunner       0x00000001017e68ad XCTRunner + 6317 
    17 libdyld.dylib      0x0000000104c4692d start + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
Build step 'Execute shell' marked build as failure 
Finished: FAILURE 

はアプリが私のジェンキンスマシンができないため、起動に失敗したことでした。 Xcodeが暗黙的にテストに失敗する前に十分に速く開きますか?または、アプリの起動をブロックする通知がある可能性がありますか?

答えて

1

何が起こるのは、XCTestがホームボタンプレスイベントをデバイスに送信しようとしたが、30秒間完了通知を受け取らないということです。

私の経験では、このような問題が別のエラーメッセージ("Failed to background test runner within ...")を発生させるため、ホームボタンがテストターゲットをバックグラウンドで送信するのをブロックする通知とは関係ありません。

私はJenkinsの解決策に慣れていませんが、タイムアウトが短すぎると思われる場合は、次のように変更してみてください。

(自分の__attribute__((constructor))機能を追加し、例えば、内部にこのコードを置く)、その後、以前[XCTestDriver _runSuite]を実行するコードに次の行を追加します

extern __attribute__((weak)) void* _XCTSetEventConfirmationTimeout(NSTimeInterval); 
// Change the default 30 seconds timeout. 
long MY_NEW_EC_TIMEOUT = 120; 
NSLog(@"Trying to call _XCTSetEventConfirmationTimeout(%ld)", MY_NEW_EC_TIMEOUT); 
if (&_XCTSetEventConfirmationTimeout) { 
    NSLog(@"_XCTSetEventConfirmationTimeout address found"); 
    _XCTSetEventConfirmationTimeout(MY_NEW_EC_TIMEOUT); 
    NSLog(@"_XCTSetEventConfirmationTimeout successfully called"); 
} else { 
    NSLog(@"_XCTSetEventConfirmationTimeout address not found"); 
} 
関連する問題