???????????Record UI Test??????Xcode???????????????????APP????????????APP???е???????????????????Xcode????UI Tests??????Test Case?????????????????????е????????????ε??Record UI Test???(??????????????Stop??)???????
????Case:
??????????????????????????

???????????

????????????д???д?????????????????????????????????棬???????????????????????????????????????????????????????...
?????????????????????UI Tests??????????飬????Ч?????????????????Test Case???????????δ???:
????let elementsQuery = XCUIApplication().otherElements.containing(.staticText?? identifier:"???")
????let textField = elementsQuery.children(matching: .textField).matching(identifier: "????????").element(boundBy: 0)
????textField.tap()
????textField.typeText("1xxxxx")
????let textField2 = elementsQuery.children(matching: .textField).matching(identifier: "????????").element(boundBy: 1)
????textField2.typeText("xx")
????textField2.tap()
????textField2.tap()
????textField2.typeText("123456")
??????????δ????е?typeText?????????????????????????????Command + U??????????в???????Xcode?????????????????????;??Щ????????????????д??????????????UI?????????????????????????????????????????????????????????????????????????????СCase
???????????????????????????????????????Command + U???е??Test Case???е??????????????????????????????????λ??????С??????????????????:


????
??е???????

???????????????????????????????????????????????
??????δ???е???????????????
????Unit Tests
??????????У?UI Test??????????????????????????Щ??????????.???????????????????????????緽????????罻????.
??????????????????????????????NSLog()??Print()????????????????鷳????????????Unit Test???????????Щ????;
????Case:
?????????????????????????????????????????????????????????????????????????????????????????????????????????????Щ????;?????????????Success???????????Failure
????func postForLoginAction(response: String) -> String {
????if response.contains("Failure") {
????return "Failure !"
????} else {
????return "Success !"
????}
????}
???????????????????Unit Test????д???Test Method?????????飬?????????????????
????func testNumberOfVowelsInString_shouldReturnNumberOfVowels() {
????let viewController = ViewController()
????let string = "Failure"
????let results = viewController.postForLoginAction(response: "xxx")
????XCTAssertEqual(string?? results?? "?????????????: (results)")
????}
?????????????XCTest??????????????????XCTAssertEqual(_:_:message:)???????????????????????????????????????????????????log?????;
??????д??????????к??????XCTAssertEqual???????????????????о??Щ?????:
????· XCTAssertTrue(\_:\_:file:line:): ?ж?????????
????· XCTAssertFalse(\_:\_:file:line:):?ж?????????
????· XCTAssertEqual(\_:\_:\_:file:line:): ?ж???????????????
????· XCTAssertNotEqual(\_:\_:\_:file:line:): ?ж?????
????· XCTAssertNil(\_:\_:file:line:): ?ж???????nil
????· XCTAssertNotNil(\_:\_:file:line:): ?ж???????nil
????????????????????XCTest?????????£??к??????????????????????????廯????????????????
????Unit Tests?????з?????UI Tests??Щ????Unit Tests???????????????????????Command + U?????в???
?????????Unit Tests???????е?????????????UI Tests????????????С???????
????OK??????????????о??????????????????????????????????????????log?????????????????
????Cool??...
??????????
????Conclusions(???)
????????????????????????????β???????????д?????????????????????????:
????· ?????????????test????????
????· ?????????????Test Case??????????????
????· ???????????????ò????????????????TDD(Test - Driver Development)
????· ??????????????????Command + U??????????е????
???????????????????????????????????????????????TDD(Test - Driver Development)???????????????????????????????????????????????????Ч???????.
??????????????????????????д???????¥????????????????д??????????????????????????????????;??????????????bug??????????????????:??????????????????????????bug????
??????????????????????????????2??????????????...
??????????? http://www.jianshu.com/p/2143182b9948