title: Set JUnit timeout in eclipse
body: <p><strong>Question</strong></p>
  
  <p>When I run all our JUnit tests, using eclipse, can I set a default timeout?</p>
  
  <p><strong>Background</strong></p>
  
  <p>My manager insists on writing Unit tests that sometimes take up to 5 minutes to complete.  When I try to run our entire test suite (only about 300 tests) it can take over 30 minutes.  I want to put something in place that will stop any test that takes longer than 10 seconds.</p>
  
  <p>I know an individual test can be annotated with:</p>
  
  <pre><code>@Test(timeout=10000)
  </code></pre>
  
  <p>But doing this would make his long tests always fail.  I want them to work when he runs them on his box (if I have to make minor adjustments to the project before checking it in, that's acceptable. However, deleting the timeouts from 40 different test files is not practical).</p>
  
  <p>I also know I can create an ant task to set a default timeout for all tests, along the lines of:</p>
  
  <pre><code>&lt;junit timeout="10000"&gt;
    ...
  &lt;/junit&gt;
  </code></pre>
  
  <p>The problem with that we typically run our tests from inside eclipse with <em>Right Click > Run As > JUnit Test</em>.</p>
  
  <p><strong>Summary</strong></p>
  
  <p>So is there a relatively painless way to set a timeout for all tests, perhaps using a Run Configuration setting, or project setting, or JUnit preference, or environment variable, or something?  I'd even settle for installing some other plugin that lets me right click on particular test folders and run all the tests in some other manner like through ant or something...</p>