junit-team/junit — pull request #896 by BrianBerzins (2014-05-02 00:24:20+00:00)
Title: ParentRunner handling of AssumptionViolationException

The ParentRunner class swallows AssumptionViolationExceptions in the run(RunNotifier) method by letting it fall out of scope treating the evaluation as an ignored test rather than a skipped test.

Most RunListeners that I have seen (including the maven-surefire-plugin) treat skipped and ignored tests the same, but custom run listeners that have different behavior for testIgnored(Description) and testAssumptionFailure(Failure) are missing the information encapsulated in the AssumptionViolationException.

The behavior in the runLeaf(Statement, Description, Notifier) does pass the AssumptionViolationException on by firing the failed assumption method to the notifier, which does make me suspect that the behavior in the parent run method was simply overlooked.

A basic use case that I personally use: @BeforeClass method that checks a system and determines that the tests in the class will provide no meaningful results. An AssumptionViolationException is thrown. A custom run listener is used to distinguish the differences between @Ignored tests and tests that have had been marked with assumption failures.