MobileNativeFoundation / bluepill

Bluepill is a reliable iOS testing tool that runs UI tests using multiple simulators on a single machine
BSD 2-Clause "Simplified" License
3.19k stars 232 forks source link

Xcode 12.5 support #488

Closed chenxiao0228 closed 3 years ago

chenxiao0228 commented 3 years ago

Bluepill crashes on Xcode 12.5 either with

'NSInvalidArgumentException', reason: '-[__NSCFString identifierString]: unrecognized selector sent to instance 0x7fdb5d606b30'

or with

error: -[BluepillTests testRunUITest] : Selector _IDE_initiateControlSessionForTestProcessID:protocolVersion: is not part of the remote interface "XCTestManager_DaemonConnectionInterface" (NSGenericException)
YangSun33 commented 3 years ago

After some investigation, here are some issues I found caused by the changes in 12.5 SDK:

  1. In XCTestConfiguration, testsToRun & testsToSkip change from NSSet to XCTTestIdentifierSet, and the elements inside change from NSString to XCTTestIdentifier. Issue: The test app will crash as it tries to access [element identifierString], which is available for XCTTestIdentifier but not for NSString. Solution: a) Change from the infra level for BPConfiguration: make testCasesToSkip, testCasesToRun & allTestCases to be arrays of XCTTestIdentifier rather than NSString. b) Workaround by adding a category for NSString, returning self for selector 'identifierString'.

  2. The functions in protocol _XCTestManagerDaemonConnectionInterface have been deprecated. Issue: The test app could be launched but no tests would be run due to connection failed. Facts: We call function __IDEinitiateControlSessionForTestProcessID:protocolVersion: in [BPTestDaemonConnection connect], and it has been refactored into protocol _XCTMessagingRoleControlSessionInitiation. We call function __IDEinitiateSessionWithIdentifier:forClient:atPath:protocolVersion: in [BPTestBundleConnection connect], and it has been refactored into protocol _XCTMessagingRoleRunnerSessionInitiation. We need to change the logics in BPTestDaemonConnection & BPTestBundleConnection to get the correct object in DTXConnection so that the functions can be called. Solution: For now, I'm not sure what to do for this issue.