testing timeout resumes

15 views
Skip to first unread message

pelleter

unread,
Nov 15, 2010, 10:50:16 PM11/15/10
to ASIHTTPRequest
Hi Ben,
I've been creating my own unit tests and I have been wanting to create
a timeout unit test. I saw that you had a
'testResumeWithAutomaticTimeoutRetry' test which unfortunately cannot
be used by us. I was wondering if you'd be able to point me in the
right direction for creating a similar test.
Thanks,
Ben Pettit.

Ben Copsey

unread,
Nov 30, 2010, 7:01:46 PM11/30/10
to asihttp...@googlegroups.com
Hi Ben

Sorry I missed your message!

Just incase this is still helpful, or might be helpful to someone googling...

If I'm understanding correctly, and you want to know how to write the server portion of this test, IIRC I was using the equivalent of calling sleep() to delay sending the response on the server. So, if the timeout is 10 seconds, the server end waits 15 seconds before sending the response. In languages designed for concurrency this would probably be no big deal, but in my setup this would kill my server if too many people ran it at once, which is why it isn't available for you to try.

At some point, I'd like to publish the source for all the tests, but I haven't got around to it yet.

Best

Ben

pelleter

unread,
Dec 1, 2010, 10:15:08 PM12/1/10
to ASIHTTPRequest
thanks Ben.
I've just been messing around with the 'timeout seconds' setting to
get the requests to timeout in my unit tests so far.
however i think i will need to get a good test server set up in the
future to test varying speeds and conditions, i saw an apache module
which can cap the speed of a request depending on its file path on the
webserver its called mod_cband.
It will be great when you publish your test code, it will give a more
complete set of unit tests.

Ben Copsey

unread,
Dec 3, 2010, 11:15:23 AM12/3/10
to asihttp...@googlegroups.com
Hi

> I've just been messing around with the 'timeout seconds' setting to
> get the requests to timeout in my unit tests so far.

Incidentally, I think GHUnit (the testing framework ASIHTTPRequest uses) recently got some new features that look very helpful for writing asynchronous tests. If you aren't already using GHUnit for your own tests, I can certainly recommend it.

> It will be great when you publish your test code, it will give a more
> complete set of unit tests.

I'll add it to the to do list.

Best

Ben

pelleter

unread,
Dec 4, 2010, 9:07:36 AM12/4/10
to ASIHTTPRequest
Hey

> Incidentally, I think GHUnit (the testing framework ASIHTTPRequest uses) recently got some new features that look very helpful for writing asynchronous tests. If you aren't already using GHUnit for your own tests, I can certainly recommend it.

I'll have to get the latest GHUnit and give it a go, yeah I've been
using it for my tests so far, trying to do TDD for the first time :)

Thanks for the help,
Cheers,
Ben.
Reply all
Reply to author
Forward
0 new messages