Skip to content

fireTestRunFinished not called after throwing StoppedByUserException #1186

Open
@Tibor17

Description

@Tibor17

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions