????????????? View Controllers
???????????? ???????[ 2014/3/17 14:05:37 ] ???????????? ???????
????????????????????????e??????????????????????????????????
?????????鱣???
????????????????????????????????????????????????????????????????????????鱣???С??????????????????????????????????????????????????????????????????????????? TDD??????Щ???????????Щ???????????????????????????????????? TDD???????д????????д?ò????????????????????????? Wikipedia ?????????????????????????????????????????
???????? UI ??????????鷳???????????????????????????view controller ?????????? model ?? view ?????????? view controller ?????????????????????????
????????????????????? view controller ????????е??????????????ò???????????????????????Щ????????????????????????????????????????????????????2ο????????? view controller ?????????????Щ?????????????????????????????????????????£????????á????????????????????????
??????????????????????????????????????????????????????????????????????????????????
????Mocking
???????????????????С?????????С??????????????????????н??в???????????????????????????????????????????????ν?? mock ?? stub ??????????? mock ????????????λ????????????????????λ??????????????????????????????????????????????????????????????????ó?????????????
??????????????У??????и?????????? data source ??????????? data source ??????????? table view ???????dequeue????? cell???????????У?????? table view???????????????? mock table view???????????? table view?????????? data source???????????????????????????е?????????????κ???????????????????
????Objective-C ???и????? mocking ?????????? OCMock??????????????????????????????? Objective-C ?????????????????????????????Щ????????????? mock ????????????????????
????????????? data source ???????????????????????????Щ??????ι????????
????SenTestKit
???????????????????????????????????????????????????Sente ?? SenTestingKit?????????????? 1997 ????????? Objective-C ????????????????? iPhone ???????? 10 ????????????????? Xcode ?????SenTestingKit ???????????????? SenTestingKit????????????????С??????????????????????????????????????? Testing ??β??????????????????????
??????Щ??????????????????????????????????????? test ??????????????????????е???????????????? -setUp ?? -tearDown ??????????????????????????????????????????????????????????????а??????????????? properties ???????????
?????????????????????????????????????????????????????????棬?????ò??????????С????????????????е??????????????????????????????????? Xcode ???????壬????????????Ч?????????????????? .m ??????????????????? Tests ??β??????????????????????????????
?????? Xcode ????
????????? build ????? bundle?????а?????????????????????????????????????Щ??????????e???????????? target ?У?Xcode ????????????? bundle ?С????????????? NSBundle ????λ??Щ?????????????????????? -URLForResource:withExtension: ??????????????????
????Xcode ?е???? scheme ?????????????? bundle ?????????? ?-R ???г????-U ???в????
??????????????????????????У?????????????????? bundle ???????injected??????????????????????????????????£????????????????????????????????? app delegate ?У?
static BOOL isRunningTests(void) __attribute__((const)); - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if (isRunningTests()) { return YES; } // // Normal logic goes here // return YES; } static BOOL isRunningTests(void) { NSDictionary* environment = [[NSProcessInfo processInfo] environment]; NSString* injectBundle = environment[@"XCInjectBundle"]; return [[injectBundle pathExtension] isEqualToString:@"octest"]; }
?????? Scheme ???????????????????????????????????н??????????ж?????? bundle???????????????????á???????????????????????????????????????????????e????????????????
??????????????????????????????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11