Bug 339742 - Allow a repeat count for JUnit in the UI.
Summary: Allow a repeat count for JUnit in the UI.
Status: REOPENED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 499806 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-03-11 13:21 EST by Gary Gregory CLA
Modified: 2016-09-19 09:52 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gary Gregory CLA 2011-03-11 13:21:42 EST
Build Identifier: I20110127-2034

The idea is allow the developer to run a unit test 10, 20, or 100 times. This is useful to find apparently random bugs.

Reproducible: Always
Comment 1 Markus Keller CLA 2011-03-15 14:07:44 EDT
That's not something we want to add in the UI. It's also unclear how it should behave if you run a suite multiple times: Stop after the first failure? Or continue? Or collect all failures? What about PDE JUnit tests?

If necessary, this can be implemented either directly in your test, or as a reusable add-on to JUnit (see e.g. http://stackoverflow.com/questions/1835523/is-there-a-way-to-make-eclipse-run-a-junit-test-mulitple-times-until-failure ).
Comment 2 Gary Gregory CLA 2011-03-15 15:07:25 EDT
Hi,

Thank you for the pointer. 

>Stop after the first failure?
No, JUnit does not stop a test case or suite class when a method fails a test. Repeating tests should not be any different. 

>Or collect all failures?
Yes, just like failures are collected now when running a test class or test suite.
Comment 3 Gary Gregory CLA 2011-03-17 13:38:49 EDT
I now see that JUnit does support this feature through the RepeatedTest test decorator. 

It seems more legitimate to me now to surface this JUnit (4.x) feature in the UI.

public static Test suite(  ) {
    // run the entire test suite ten times
    return new RepeatedTest(new TestSuite(TestGame.class), 10);
}
Comment 4 Noopur Gupta CLA 2016-09-19 03:00:49 EDT
*** Bug 499806 has been marked as a duplicate of this bug. ***
Comment 5 Andrey Loskutov CLA 2016-09-19 09:52:55 EDT
From bug 499806:

Ideally, the JUnit launch configurations would have a checkbox "[ ] Repeat test N times:" and a text filed next to it allowing users to specify how many times the test should be repeated. 

Additionally to that one could add "[ ] Stop execution on first failure" checkbox, which can be used not only for the proposed case but also in general.