title: PHPUnit - Automatically retry failed tests X times?
body: <p>I have a complex set of PHPUnit tests, some of which involve connecting to servers around the world that, for whatever reason, timeout sometimes.</p>
  
  <p>Rather than having the test fail when the server times out, I'd like to simply retry that test one or more times before actually marking it as failed.</p>
  
  <p>Now, I understand that this may not be the best way to handle my situation at hand.  One better solution would be to fix the servers.  But, this is out of my control right now.</p>
  
  <p>So, what I'd really like, is a way to tell PHPUnit to re-test each failing testcase X times, and only mark it as failed if it failed every time.</p>
  
  <p>Any ideas?</p>
  
  <p><strong>Edit: Many of you have responded with helpful suggestions that I <em>not</em> do this.  I understand, thank you.  However, specifically what I am trying to do is create a test suite that tests the operation of the <em>full</em> system, including the remote servers.</strong> I understand the concept of testing certain parts of my code with "mock" responses from the outside...but I also sleep better at night if part of my tests test the "full stack".</p>