Alex Rivera | Logout

In Eclipse, how do I run a JUnit test case multiple times

Asked 2012-01-10T14:58:04.623
9

I have a unit test that fails sometimes and debugging it is a pain because I don't know why it sometimes fails.

Is there a way inside Eclipse that I can run a JUnit test 5 times or 50 times or something?

Thanks.

Edit
Report

1 Answer

8

Have you tried something like this?

@Test
public void runMultipleTests() {
    for (int i = 0; i < 10; i++) {
        myTestMethod();
    }
}
answered 2012-01-10T15:09:42.113

Your Answer