I have pushed a proposal of Surefire Extensions in new branch

https://github.com/apache/maven-surefire/tree/s1

Added new module maven-surefire-extensions
<https://github.com/apache/maven-surefire/tree/s1/maven-surefire-extensions>
and extended the existing module
maven-surefire-common
<https://github.com/apache/maven-surefire/tree/s1/maven-surefire-common>.

Basically these are different from typical Maven extensions. The idea is to
provide SPI interfaces and let the user implement them. We do not need to
modify the lifecycle, and no need to access plugin configuration. I expect
the users implement Test List Processor and customize Run-Order of tests.
Meanwhile we may concentrate on migrating surefire|failsafe plugin towards
Maven 3.x, fixing JIRA issues and later observe extension implementations
from our users regarding SCM controlled test-set (only changed tests from
SCM or incremental javac).

We should let user implement interfaces from package
org.apache.maven.surefire.spi.

While developing the extensions, I was inspired by the Extensions mechanism
in Java EE.

The user should implement interfaces in his beans like this
(ExecutionLifeCycleListener  is optional):

public class MyRunOrder implements Extension,
RunOrderCalculator, ExecutionLifeCycleListener {

public void contextInitialized( PluginExecutionContext context ) {
   /// store plugin parameters from context in this bean and configure
your RunOrder
}

public TestsToRun orderTestClasses( TestsToRun scannedClasses ) {
    /// the plugin executes this method after context was initialized
}

}

With Java 8 these methods can be implemented by default in the interfaces
or the Context
methods from singleton. But that's users modification.

Cheers
Tibor

Reply via email to