Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
478 views
in Technique[技术] by (71.8m points)

iphone - Testing asynchronous code on iOS with OCunit

Does anyone know of any existing library that allows testing asynchronous code with OCUnit? I'm thinking about something like GHAsyncTestCase but that delivers from SenTestCase.

I'm asking because if I don't find any I'm going to port GHAsyncTestCase to OCUnit but I don't want to duplicate work done already by someone else.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Piotr:

You might be interested in the work I've done with Mimic, a network stubbing tool written in Ruby which lets you stub requests at a high-level and can be used from your Objective-C using the supplied wrapper.

With regards to asynchronous testing, please take a look at a little utility I wrote called AssertEventually.

This example shows both Mimic and assertEventually in action.

In addition, you might want to look at Kiwi - it's a great little Objective-C testing framework that is built on top of OCUnit. I recently contributed a patch to port my AssertEventually behaviour over to Kiwi which lets you write things like:

id someObject = nil;
[do SomethingThatFetchesSomeObjectAsynchronously];
[[theObject(&someObject) shouldEventually] equal:@"some result"];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...