???????
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????80????????????????????????????????????????????????????????????????????????????????????????????A4?????????????????μ???????????????????????????????????????????????????
?????????????2?????????????????????????′??????????????UI???????????????????????????????
????UI Tests
????IOS??UI???????????????????????????????UI Tests??Xcode7????????UI??????????????????apple?????????????????????????????????д?????????????????????????????????????????????????????????????????????????????
??????÷???
????· ???UI Tests
?????????????????????????????????Include UI Tests?????С?


??
?????UI Tests

????????????????????????????????????target???????UI Tests??


????
???target


????
???target

????????????????л????xxxxUITests.m????????UI Tests?????????


????
???

????· ????????
????????й????????????????ú????????????UI Test????????????????????????????????????2????????- (void)setUp ??- (void)tearDown ???????????????????????????á????????Щ?????????????????д???????ɡ??????

??????????????????UI?????????????????????????????????????????????
????· ????
?????????????????ж????????????????????????????о??Щ?????????
????XCTFail(format…) ???????????????
????XCTAssertNil(a1?? format...)????ж??a1???????????????????
????XCTAssertNotNil(a1?? format…)??????ж??a1?????????????????????
????XCTAssert(expression?? format...)??expression????TRUE??????
????XCTAssertTrue(expression?? format...)??expression????TRUE??????
????XCTAssertFalse(expression?? format...)??expression????False??????
????XCTAssertEqualObjects(a1?? a2?? format...)?ж?????[a1 isEqual:a2]??TRUE????????????????????????????
????XCTAssertNotEqualObjects(a1?? a2?? format...)?ж?????[a1 isEqual:a2]??False??????
????XCTAssertEqual(a1?? a2?? format...)?ж???????a1??a2?? C??????????????????????????????????NSString????????
????XCTAssertNotEqual(a1?? a2?? format...)?ж???????a1??a2?? C???????????????????????????
????XCTAssertEqualWithAccuracy(a1?? a2?? accuracy?? format...)?ж???????double??float?????????????Χ?????????Χ??+/-accuracy??????????????????
????XCTAssertNotEqualWithAccuracy(a1?? a2?? accuracy?? format...) ?ж???????double??float?????????????Χ?????????Χ????????????????
????XCTAssertThrows(expression?? format...)?????????expression??????????????????????????????
????XCTAssertThrowsSpecific(expression?? specificException?? format...) ?????????expression????specificException??????????????????????????????????????
????XCTAssertThrowsSpecificNamed(expression?? specificException?? exception_name?? format...)?????????expression????????????????????????????????????????????
????XCTAssertNoThrow(expression?? format…)?????????expression??з??????????????
????XCTAssertNoThrowSpecific(expression?? specificException?? format...)?????????expression??з???????????????????????????????????????????
????XCTAssertNoThrowSpecificNamed(expression?? specificException?? exception_name?? format...)?????????expression??з?????????????????????????????????????????
????· XCTest UI Testing API
???????д?ò???????????????????UI Test??API????????XCUIApplication??XCUIElement??XCUIElementQuery??
????XCUIApplication
???????????????????????????????????????????????????в??????????ζ????????????????????Щ???????????????????????????????????????????????????Щ?????????????2????????
????- (void)launch;//???????
????- (void)terminate;//???????
????XCUIElement
???????NSObject?????Э??XCUIElementAttributes?? XCUIElementTypeQueryProvider
?????????????????UI????????UIView??UIButton??UITestField???
?????????????
????- (BOOL)exists;//?ж???????????
????- (XCUIElementQuery *)descendantsMatchingType:(XCUIElementType)type;//?????????????????????????
????- (XCUIElementQuery *)childrenMatchingType:(XCUIElementType)type;//??????????????????????????????
????//????????
????- (void)tap;//???????????testField??y???
????- (void)doubleTap;//???
????- (void)swipeUp;//pan????
????- (void)typeText:(NSString *)text;//????????
????- (void)pressForDuration:(NSTimeInterval)duration;//????
????· ?????????
????Xcode???????????????????????????????????????????????????????????????????????????


????
??????

????????????????????????????????????????
????XCUIApplication *app = [[XCUIApplication alloc] init];
????XCUIElement *element = [[[[app childrenMatchingType:XCUIElementTypeWindow] elementBoundByIndex:0] childrenMatchingType:XCUIElementTypeOther].element childrenMatchingType:XCUIElementTypeOther].element;
????[element tap];
????????????????????????????????????????????????????????????????????????????????????ο??£????????????????