apache / apache/maven-surefire

[SUREFIRE-2054] Support pluggable starters

Open
#2,790 0 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

**[Christoph Läubrich](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=laeubi)** opened **[SUREFIRE-2054](https://issues.apache.org/jira/browse/SUREFIRE-2054?redirect=false)** and commented

Currently Surefire has two (internal) Starters:

Forked:
https://github.com/apache/maven-surefire/blob/daf717e65716e3e77951757596c11d83754338e2/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L2437

InProcess:
https://github.com/apache/maven-surefire/blob/daf717e65716e3e77951757596c11d83754338e2/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L2454

[Tycho](https://www.eclipse.org/tycho/sitedocs/tycho-surefire-plugin/plugin-info.html) (and [BND](https://github.com/bndtools/bnd/tree/master/maven/bnd-testing-maven-plugin)) both offer "surefire-like" plugins that internally use surefire/junit.

I think this is a bit wasted effort, as actually most parts of surefire (configuration and alike) could simply be reused, both plugins simply need a mean to start the process differently.

My idea would be to make the Starters plugable, like one can plug in different platforms. Lookin at both Forked/InProcess the share a lot of common parameters and the run methods only differ in passing the effectiveProperties.

So I think it should be possible to derive a common "SurefireStarter" interface that an extender has to implement togehter with a "SurefireStarterFactory" that is used to construct such a starter passing the necessary information (e.g. the AbstractSurefireMojo and selected providers and so on...).

Of course this would be more an SPI than a API and result in rather tightly coupled plugins, but could make all this more reusable.

---
No further details from [SUREFIRE-2054](https://issues.apache.org/jira/browse/SUREFIRE-2054?redirect=false)

Contributor guide

Open the contributing guide

Research direction

Start with the Forked and InProcess starter construction and run methods in AbstractSurefireMojo.java at the linked locations. Compare their shared parameters and differing effectiveProperties handling, then investigate how a SurefireStarter interface and factory could support external plugins such as Tycho and BND. Done means the starter mechanism can be extended without duplicating the existing Surefire configuration and execution logic.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.