apache / apache/maven-surefire

[SUREFIRE-1743] Allow custom listeners to request stop

Open
#3,107 9 comments 0 reactions 0 assignees View on GitHub
enhancement priority:major
Dominant language
Java
Stars
461
Forks
588
Avg merge
1d 8h
Merged PRs (30d)
19

Description

**[Andrew Neeson](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=andyrokit)** opened **[SUREFIRE-1743](https://issues.apache.org/jira/browse/SUREFIRE-1743?redirect=false)** and commented

Currently Surefire gives you the ability to [add custom listeners and reporters](https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit.html#Using_Custom_Listeners_and_Reporters).  However, those listeners do not have a hook on the Notifier which created them.

I would like to be able to create listeners which have the ability to request that the test run is stopped (RunNotifier.pleaseStop) under specific conditions.  These conditions are not currently covered by existing mechanisms such as [skipAfterFailure](https://maven.apache.org/surefire/maven-surefire-plugin/examples/skip-after-failure.html).

Note:  I originally considered this as [a change to Cucumber JVM](https://github.com/cucumber/cucumber-jvm/issues/1854), but I realise that it's more generic than that (hence this ticket).

---

**Issue Links:**
- [SUREFIRE-1710](https://issues.apache.org/jira/browse/SUREFIRE-1710) skipAfterFailureCount in JUnit5 provider
(_**"Dependent"**_)

Contributor guide

Open the contributing guide

Research direction

Start by tracing how custom listeners and reporters are created and how the JUnit RunNotifier is made available to them. Compare the requested stop behavior with the existing skipAfterFailure mechanism and the linked JUnit 5 provider work. Done means a custom listener can request that the test run stops under its own conditions.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.