<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="" style="margin: 0px; font-size: 18px; line-height: normal;"><span class="" style="-webkit-font-kerning: none;">Swift3 rewriting for XCTest APIs</span></div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"><span class="" style="-webkit-font-kerning: none;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="-webkit-font-kerning: none;">For the most part, the automatic heuristics seem to be doing the right things for Xcode’s XCTest. We have identified a few cases where we should perhaps discuss doing a little extra. Almost everything seems like it imports reasonably according to the API guidelines (<a href="https://swift.org/documentation/api-design-guidelines/" class=""><span class="" style="line-height: normal; -webkit-font-kerning: none;">https://swift.org/documentation/api-design-guidelines/</span></a>). The few cases that we think need tweaking are detailed here.</span></div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"><span class="" style="-webkit-font-kerning: none;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;">These are the changes from how the API imports automatically that we are considering. I would love to hear any comments or suggestions.</div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="-webkit-font-kerning: none;"><b class="">addTest[Run]()</b></span></div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"><span class="" style="-webkit-font-kerning: none;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="-webkit-font-kerning: none;">There’s a glitch in the importer that is making XCTestSuioteRun’s addTestRun: import as addTest. We’re tracking this as a bug in the importer. </span>In the meantime, I would fix this in Xcode’s XCTest explicitly.</div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"><span class="" style="-webkit-font-kerning: none;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="-webkit-font-kerning: none;"><span class="Apple-tab-span" style="white-space: pre;">        </span><i class="">Existing imported method</i></span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="-webkit-font-kerning: none;"><span class="Apple-tab-span" style="white-space: pre;">        </span>XCTestSuiteRun.</span><span class="" style="-webkit-font-kerning: none; color: rgb(159, 21, 0);">addTest</span><span class="" style="-webkit-font-kerning: none;">(testRun: XCTestRun) </span></div><div class="" style="margin: 0px; line-height: normal;"><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="-webkit-font-kerning: none;"><i class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>Suggested new name</i></span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="-webkit-font-kerning: none;"><span class="Apple-tab-span" style="white-space: pre;">        </span>XCTestSuiteRun.</span><span class="" style="-webkit-font-kerning: none; color: rgb(5, 108, 19);">addTestRun</span><span class="" style="-webkit-font-kerning: none;">(testRun: XCTestRun)</span></div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"><span class="" style="-webkit-font-kerning: none;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="-webkit-font-kerning: none;"><b class="">Bound(by: vs. (boundBy:</b></span></div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"><span class="" style="-webkit-font-kerning: none;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="-webkit-font-kerning: none;">Here, the importer just isn't smart enough to detect that the prepositional phrase that really identifies the argument is "boundBy", not "by”. We’re also tracking this as a possible thing to fix in the importer. In the meantime, I would fix this in Xcode’s XCTest explicitly.</span></div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"><span class="" style="-webkit-font-kerning: none;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="-webkit-font-kerning: none;"><span class="Apple-tab-span" style="white-space: pre;">        </span><i class="">Existing imported method</i></span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="-webkit-font-kerning: none;"><span class="Apple-tab-span" style="white-space: pre;">        </span>XCUIElementQuery.</span><span class="" style="-webkit-font-kerning: none; color: rgb(159, 21, 0);">elementBound</span><span class="" style="-webkit-font-kerning: none;">(</span><span class="" style="-webkit-font-kerning: none; color: rgb(159, 21, 0);">by</span><span class="" style="-webkit-font-kerning: none;"> index: UInt) -> XCUIElement</span></div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"><span class="" style="-webkit-font-kerning: none;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="-webkit-font-kerning: none;"><i class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>Suggested new name</i></span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="-webkit-font-kerning: none;"><span class="Apple-tab-span" style="white-space: pre;">        </span>XCUIElementQuery.</span><span class="" style="-webkit-font-kerning: none; color: rgb(5, 108, 19);">element</span><span class="" style="-webkit-font-kerning: none;">(</span><span class="" style="-webkit-font-kerning: none; color: rgb(5, 108, 19);">boundBy</span><span class="" style="-webkit-font-kerning: none;"> index: UInt) -> XCUIElement</span></div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"><span class="" style="-webkit-font-kerning: none;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="-webkit-font-kerning: none;"><b class="">Query "matching..."</b></span></div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"><span class="" style="-webkit-font-kerning: none;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="-webkit-font-kerning: none;">This next little family is a bit more subtle. The first two have a noun which just restates the type, so by the guidelines we would remove them. Technically the last one's noun is a role, not a type and so what the importer is doing is correct. But it feels inconsistent if we remove the type names but leave that one alone. To make it a little more consistent, the suggestion is to move identifier inside the parens as a required label so all these related functions have the same "outside the parens" part of their names.</span></div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"><span class="" style="-webkit-font-kerning: none;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="-webkit-font-kerning: none;"><span class="Apple-tab-span" style="white-space: pre;">        </span><i class="">Existing imported method</i></span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="-webkit-font-kerning: none;"><span class="Apple-tab-span" style="white-space: pre;">        </span>XCUIElementQuery.</span><span class="" style="-webkit-font-kerning: none; color: rgb(159, 21, 0);">matchingPredicate</span><span class="" style="-webkit-font-kerning: none;">(predicate: NSPredicate) -> XCUIElementQuery</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="-webkit-font-kerning: none;"><span class="Apple-tab-span" style="white-space: pre;">        </span>XCUIElementQuery.</span><span class="" style="-webkit-font-kerning: none; color: rgb(159, 21, 0);">matchingType</span><span class="" style="-webkit-font-kerning: none;">(elementType: XCUIElementType, identifier: String?) -> XCUIElementQuery</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="-webkit-font-kerning: none;"><span class="Apple-tab-span" style="white-space: pre;">        </span>XCUIElementQuery.</span><span class="" style="-webkit-font-kerning: none; color: rgb(159, 21, 0);">matchingIdentifier</span><span class="" style="-webkit-font-kerning: none;">(identifier: String) -> XCUIElementQuery</span></div><div class="" style="margin: 0px; line-height: normal; min-height: 14px;"><span class="" style="-webkit-font-kerning: none;"></span><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="-webkit-font-kerning: none;"><i class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>Suggested new name</i></span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="-webkit-font-kerning: none;"><span class="Apple-tab-span" style="white-space: pre;">        </span>XCUIElementQuery.</span><span class="" style="-webkit-font-kerning: none; color: rgb(5, 108, 19);">matching</span><span class="" style="-webkit-font-kerning: none;">(predicate: NSPredicate) -> XCUIElementQuery</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="-webkit-font-kerning: none;"><span class="Apple-tab-span" style="white-space: pre;">        </span>XCUIElementQuery.</span><span class="" style="-webkit-font-kerning: none; color: rgb(5, 108, 19);">matching</span><span class="" style="-webkit-font-kerning: none;">(elementType: XCUIElementType, identifier: String?) -> XCUIElementQuery</span></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo;"><span class="" style="-webkit-font-kerning: none;"><span class="Apple-tab-span" style="white-space: pre;">        </span>XCUIElementQuery.</span><span class="" style="-webkit-font-kerning: none; color: rgb(5, 108, 19);">matching</span><span class="" style="-webkit-font-kerning: none;">(</span><span class="" style="-webkit-font-kerning: none; color: rgb(5, 108, 19);">identifier</span><span class="" style="-webkit-font-kerning: none;"> identifier: String) -> XCUIElementQuery</span></div><div class=""><span class="" style="-webkit-font-kerning: none;"><br class=""></span></div></body></html>