title: Dealing with Selenium tests that fail occasionally during automated deployment
body: <p>We have a C#/ASP .Net web application that is built and deployed by the build server (Jenkins). One of the build steps before the automated deployment is ensuring that all automated tests pass -- including functional tests we have using Selenium 2 WebDriver and NUnit.</p>
  
  <p>The problem: Sometimes these tests fail randomly. They will succeed for 100 builds and then one just fails. They fail for various reasons -- a .Click() event is just ignored, element can't be found, IE has a bad day, etc. We have an AJAX heavy web app and so we depend heavily on WebDriverWaits but we always take this into account while writing tests, and like I said the tests do pass most of the time. </p>
  
  <p>What are some ways to avoid or fix this problem? A couple that came to my mind: </p>
  
  <ul>
  <li>Accept a certain number of failures (seems like a bad idea) </li>
  <li>Rerun test failures? </li>
  </ul>