Posts

Showing posts with the label timeout

Set JUnit timeout in eclipse

Set JUnit timeout in eclipse Question When I run all our JUnit tests, using eclipse, can I set a default timeout? Background 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. I know an individual test can be annotated with: @Test(timeout=10000) 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). I also know I can create an ant task to set a default timeout for all tests, along the lines of: <junit timeout="10000"> ... </junit> The problem with that we typically run our tests from inside eclipse with Right Click >...