This typically happens if anti-virus or firewall software on your computer is intercepting test traffic. Examples of this type of software include McAfee, Norton, and AVG. A properly configured firewall shouldn't cause issues with the test, but you can try momentarily disabling the software before a test to see if it's causing the problem. (Don't forget to enable it again afterwards.)
If that doesn't solve the issue—or it's happening for multiple computers in your network—you might also try restarting the router and modem used for your connection. They can sometimes have temporary issues that only show up when trying to upload data, and restarting them usually clears it up.