junit4 icon indicating copy to clipboard operation
junit4 copied to clipboard

fireTestRunFinished not called after throwing StoppedByUserException

Open Tibor17 opened this issue 10 years ago • 12 comments

In JUnitCore the fireTestRunFinished should be placed in finally block. This call is placed after runner.run(notifier);. The notifier method fireTestRunFinished() cannot be called after JUnit threw StoppedByUserException. The begin and the end of test-set should be completed. If started, then it must be finished. The problem is that we are not able to call RunNotifier outside because this is private variable in JUnitCore class. I made a hook to a Runner and took the notifier instance from run method. This is of course bad workaround. It would be great idea to have public pleaseStop() method on JUnitCore class and move notifier fireTestRunFinished in finally block.

https://github.com/junit-team/junit/blob/master/src/main/java/org/junit/runner/JUnitCore.java#L138

Tibor17 avatar Jul 31 '15 10:07 Tibor17

Hi there, I'd like to contribute, just as soon as I figure out my environment issues(Plugin execution not covered by lifecycle configuration: com.google.code.maven-replacer-plugin:replacer:1.5.3:replace)

Is this a good place to start?

DanielCatz avatar Mar 21 '17 01:03 DanielCatz

@DanielCatz This is a great place to start. The "up-for-grabs" label is used for non-contentious issues that should be moderately easy to resolve.

The hardest part of this one would be coming up with a good test.

kcooney avatar Mar 21 '17 02:03 kcooney

Is there a policy against using mocks in general, or just against using Mockito?

ghost avatar Sep 19 '17 18:09 ghost

If you change this, Maven has to be notified and we will run a test. Go ahead.

On Tue, Sep 19, 2017 at 8:18 PM, cttillman [email protected] wrote:

Is there a policy against using mocks in general, or just against using Mockito?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/junit-team/junit4/issues/1186#issuecomment-330625225, or mute the thread https://github.com/notifications/unsubscribe-auth/AA_yR0RZGv_7hcgM4ctw3NFbTCQ_uaH3ks5skARggaJpZM4FjZeT .

-- Cheers Tibor

Tibor17 avatar Sep 19 '17 18:09 Tibor17

@cttillman not sure I understand the question. If you are asking about the tests for JUnit 4.x itself, no we do not use mocking frameworks.

kcooney avatar Sep 19 '17 21:09 kcooney

@kcooney For instance, I noticed CorruptListener only exists in testing, and I guess I was calling that "mocking." Maybe I am using the wrong terminology here.

ghost avatar Sep 19 '17 22:09 ghost

@cttillman Yes, the tests of JUnit 4.x use hand-rolled test doubles (fakes, stubs and mocks).

kcooney avatar Sep 19 '17 22:09 kcooney

Hi, Can this be worked on? is it available?

somayaj avatar Nov 25 '20 18:11 somayaj

@somayaj There's currently no plan for another JUnit 4.x version.

marcphilipp avatar Nov 26 '20 06:11 marcphilipp

@marcphilipp sounds good. Are there any other opportunities to contribute?

somayaj avatar Nov 26 '20 13:11 somayaj

Sure, over on the junit5 repo: https://github.com/junit-team/junit5/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Aup-for-grabs

marcphilipp avatar Nov 26 '20 16:11 marcphilipp

Thanks Marc

On Thu, Nov 26, 2020 at 10:56 AM Marc Philipp [email protected] wrote:

Sure, over on the junit5 repo: https://github.com/junit-team/junit5/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Aup-for-grabs

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/junit-team/junit4/issues/1186#issuecomment-734404351, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIRAZGKL6DYFYGBJ7TQBYYDSR2CB7ANCNFSM4BMNS6JQ .

somayaj avatar Nov 26 '20 17:11 somayaj