Need to test an ajax timeout condition
Question
As the title mentions, I have a timeout callback handler on an ajax call, and I want to be able to test that condition but nothing is coming to mind immediately on ways I can force my application to hit that state, any suggestions?
Solution
First off, I think you need to be clearer in your question - what technology are you using and where is this process that is timing out - server-side or client-side?
If you want to have the server-side code take a long time and you are using .NET, place this line in the method you call server-side:
System.Threading.Thread.Sleep(timeoutMilliseconds);
As long as you use a number sufficient so that your client-side code assumes the server has timed out, you should be good.
OTHER TIPS
You could always run a server-side script that keeps running for a period of time. For example:
<?php
sleep(10); //sleep for 10 seconds.
print "This script has finished.";
>
YUI Connection Manager allows you to introduce slowdown in your Javascript to test AJAX against latency.