Kiwi 规范的运行就像 OCUnit 测试。在 Xcode 中,按 ⌘U
会运行当前方案中的所有测试。
describe(@"a public method or feature", ^{
beforeEach(^{
//set up
[[someClass stubAndReturn:aResult] aMethod];
});
context(@"when some precondition exists", ^{
beforeEach(^{
//set the precondition
});
it(@"should have a specific behavior", ^{
//verify the behavior
[[aThing shouldNot] equal:someOtherThing];
});
pending(@"should eventually have another behavior", ^{
//pending specs will not execute and generate warnings
[[[anObject should] receive] aMethodWith:anArgument];
[anObject doStuff];
});
context(@"and another condition exists", ^{
//...
});
});
});
单元测试不会与 StackMob 发起网络请求。该项目包括一个单独的集成测试目标,用于验证与 StackMob API 的通信。
cp integration-tests/StackMobCredentials.plist.example integration-tests/StackMobCredentials.plist
open integration-tests/StackMobCredentials.plist
git checkout -b make_sdk_better
。git checkout master && git pull && git checkout - && git merge master
(如果您喜欢本地分支,请使用 git rebase master
)。git push origin make_sdk_better
。