TDD??iOS???????????Kiwi???????
???????????? ???????[ 2014/2/24 13:42:41 ] ???????????????
??????????????????????????????????????????????????????????????????????????????????????з??????·?????????????????NSMutableArray???洢??????????top?????????????????????VVStack.m?????????飬????????
//VVStack.m
@interface VVStack()
@property (nonatomic?? strong) NSMutableArray *numbers;
@end
@implementation VVStack
- (id)init {
if (self = [super init]) {
_numbers = [NSMutableArray new];
}
return self;
}
- (void)push:(double)num {
[self.numbers addObject:@(num)];
}
- (double)top {
return [[self.numbers lastObject] doubleValue];
}
@end
|
??????????????????-testStackObjectCanBeCreated??testPushANumberAndGetIt?????????ж??????????VVStack?????????????????л??????????????????????????????????????????????????????VVStack???????????????????е????????????-setUp?У?????-tearDown??????
??????????????????????????pop?????????????????????????????????????????????????????????????????????????????????????????????????????Ч????£??????????????????????????????????????????????????????ж?????“??????”????е??????????????????ú????????????????????????????????????XCTest???????????????????github???????
Kiwi??BDD????????
????XCTest?????OCUnit???????????????д??????????????á??????????????????????????????????????????????????????????????????????????????????????????????????????????????顣???е????????????????????????????????岢?????????????????????????????μ?????????????????????????????????????????????????????????????????д???????????????????У????????????XCTest????????????????????????mock????stub????????????????????????????????mock???????????????????м?????????
?????????????????BDD?????????????????????????????????????????BDD??????????????????????????????????????????????????????????????????????????д??????????????????????/?????????????????????????????????????????????????????????????д???????BDD?????????????????????BDD????????????????????????????????????????????Given..When..Then???????????????????BDD???????????????????Щ???????????Java??JBehave??????????Ruby??RSpec??Cucumber??????objc??????BDD???????????????????????????objc???????????????????????????C???????????????????п???д??????????????????objc?У??????????е?BDD?????cedar??specta??Kiwi?????и????????Kiwi?????Kiwiд???????????????????????????
describe(@"Team"?? ^{
context(@"when newly created"?? ^{
it(@"should have a name"?? ^{
id team = [Team team];
[[team.name should] equal:@"Black Hawks"];
});
it(@"should have 11 players"?? ^{
id team = [Team team];
[[[team should] have:11] players];
});
});
});
|
??????
???·???
??????????????????
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