8

我有一个 XCTest 包,我可以使用simctl. 我正在使用具有以下环境变量的 iPhone 6 iOS 9.1 模拟器:

export SIMCTL_CHILD_TestBundleLocation="/Users/User/ios_app/DerivedData/primus/Build/Products/Debug-iphonesimulator/Tests.xctest"
export SIMCTL_CHILD_XCInjectBundle="/Users/User/ios_app/DerivedData/primus/Build/Products/Debug-iphonesimulator/Tests.xctest"
export SIMCTL_CHILD_XCInjectBundleInto="/Users/User/ios_app/DerivedData/primus/Build/Products/Debug-iphonesimulator/ios_app.app/ios_app"
export SIMCTL_CHILD_XCTestConfigurationFilePath="/Users/User/ios_app/DerivedData/primus/Build/Products/Debug-iphonesimulator/Tests.xctest/Tests-7025D700-AA6C-4343-9C7A-92F9CC3A1C42.xctestconfiguration"
export SIMCTL_CHILD_DYLD_LIBRARY_PATH="/Users/User/ios_app/DerivedData/primus/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks"
export SIMCTL_CHILD_DYLD_FRAMEWORK_PATH="/Users/User/ios_app/DerivedData/primus/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks"

至此,该应用程序已经安装在模拟器上,模拟器正在运行,我运行:

xcrun simctl launch booted uk.co.company.ios.app -NSTreatUnknownArgumentsAsOpen NO -ApplePersistenceIgnoreState YES -XCTest All 

该应用程序启动,从模拟器日志中我可以看到 XCTest 包已加载,但测试未运行。我已经注销了它似乎停止的地方,并且有一个私有方法_checkForTestManager,更具体地说_checkManagerForDaemonStateAndConnectIfAvailable。据我所知,XCTest 正在尝试连接testmanagerd但失败。所以我尝试testmanagerd使用以下方法在模拟器上启动:

xcrun simctl spawn booted launchctl kickstart system/com.apple.testmanagerd 

但这似乎对正在运行的测试没有影响,但我确实在模拟器日志中看到了一些额外的输出:

testmanagerd[41610]: Received new test session connection (-[XCTestManager listener:shouldAcceptNewConnection:])
testmanagerd[41610]: Initial orientation 0
testmanagerd[41610]: Test session <__NSConcreteUUID 0x7fd2bb804a00> 7025D700-AA6C-4343-9C7A-92F9CC3A1C42 requested socket (-[XCTestSession _XCT_requestSocketForSessionIdentifier:reply:])
testmanagerd[41610]: Test session <__NSConcreteUUID 0x7fd2bb804a00> 7025D700-AA6C-4343-9C7A-92F9CC3A1C42 requested socket (__57-[XCTestManager requestSocketForSessionIdentifier:reply:]_block_invoke)
testmanagerd[41610]: -[XCTestManager _handleRequestForSessionWithIdentifier:]

但在那之后什么都没有。与通过 Xcode 运行时相比:

testmanagerd[41309]: Test session <__NSConcreteUUID 0x7fd162b016a0> 64B7815C-A0A2-4213-9A5E-E0BB0139F35A requested socket (-[XCTestSession _XCT_requestSocketForSessionIdentifier:reply:])
testmanagerd[41309]: Test session <__NSConcreteUUID 0x7fd162b016a0> 64B7815C-A0A2-4213-9A5E-E0BB0139F35A requested socket (__57-[XCTestManager requestSocketForSessionIdentifier:reply:]_block_invoke)
testmanagerd[41309]: -[XCTestManager _handleRequestForSessionWithIdentifier:]
testmanagerd[41309]: Closing IDE connection before sending socket 8 to test host.
testmanagerd[41309]: -[XCIDESession closeIDEConnection:] sending barrier
testmanagerd[41309]: barrier flushed, closing DTXConnection to IDE, socket will not be closed
testmanagerd[41309]: Socket disconnected
testmanagerd[41309]: __33-[XCTestManager closeIDESession:]_block_invoke <XCIDESession: 0x7fd160514d80>
testmanagerd[41309]: Considering exiting, 1 test sessions, 0 sessions with identifiers, 0 unidentified sessions...
assertiond[39075]: assertion failed: 14F1021 13B137: assertiond + 12188 [93FFE0B6-5C27-387F-B32A-6EE378BBB22A]: 0x1
testmanagerd[41309]: Sending socket 8 to test host
testmanagerd[41309]: __33-[XCTestManager closeIDESession:]_block_invoke <XCIDESession: 0x7fd160514d80>
testmanagerd[41309]: Considering exiting, 1 test sessions, 0 sessions with identifiers, 0 unidentified sessions...
testmanagerd[41309]: IDE connected over socket 7 (__47-[XCTestManagerIDEServer initWithListenSocket:]_block_invoke)
testmanagerd[41309]: Created session with socket 7
testmanagerd[41309]: Handling a proxy request from the IDE
testmanagerd[41309]: -[XCIDESession _IDE_initiateControlSessionForTestProcessID:] 41398
testmanagerd[41309]: Set control session <XCIDESession: 0x7fd160716f60>

是否可以通过这种方式通过 simctl 运行测试?

4

0 回答 0