Re: Asynchronous Unit testing
Re: Asynchronous Unit testing
- Subject: Re: Asynchronous Unit testing
- From: Ruotger Skupin <email@hidden>
- Date: Wed, 8 Feb 2006 19:04:22 +0100
Unfortunately it's not as easy as that. My code requires that I
return and have the run loop call me back (thus the NSPostWhenIdle).
That seems to involve setting up a thread, a run loop, a lock etc,
etc...
Maybe it's easier to write my own testing kit?
Roddi
Am 08.02.2006 um 16:53 schrieb Mike Zornek:
On 2/8/06 9:09 AM, "Ruotger Skupin" <email@hidden> wrote:
Hi,
I hope this is the right list to ask...
I'd like to unit test some code that relies heavily on timers and
calls like
[[NSNotificationQueue defaultQueue] enqueueNotification:
[NSNotification
notificationWithName:kSomeNotification object:self]
postingStyle:NSPostWhenIdle];
i.e. my -(void) testSomething method returns immediately and
actual test will
run some time later. Is that possible at all with the SenTestingKit?
Roddi
I did some unit testing on a web spider I wrote. Had the same
issue .. I
wasn't sure when it would be done. Here's my code:
[websiteScanner startScan];
while ([websiteScanner isDoneProcessing] == NO) {
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate
dateWithTimeIntervalSinceNow:1.0]];
NSLog(@"Polling...");
}
After that I would do all of my asserts.
~ Mike
--
Work: http://ClickableBliss.com
Play: http://MikeZornek.com
---
"Less code is better code" - Wil Shipley
Ruotger Skupin, Mac OS X Software Engineering
ilink Kommunikationssysteme GmbH
Münzstr. 13; 10178 Berlin - Germany
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden