org.apache.maven.surefire.providerapi
Interface SurefireProvider

All Known Implementing Classes:
AbstractProvider

public interface SurefireProvider

Interface to be implemented by all Surefire providers.

NOTE: This class is part of the proposed public api for surefire providers for 2.7. It may still be subject to changes, even for minor revisions.

The api covers this interface and all the types reachable from it. And nothing else.

Called in one of three ways: Forkmode = never: getSuites is not called, invoke is called with null parameter Forkmode = once: getSuites is not called, invoke is called with null parameter Forkmode anything else: getSuites is called, invoke is called on new provider instance for each item in getSuites response.

Author:
Kristian Rosenvold

Method Summary
 void cancel()
          Makes an attempt at cancelling the current run, giving the provider a chance to notify reporting that the remaining tests have been cancelled due to timeout.
 Iterator getSuites()
          Determines the number of forks.
 RunResult invoke(Object forkTestSet)
          Runs a forked test
 

Method Detail

getSuites

Iterator getSuites()
Determines the number of forks.

Called when forkmode is different from "never" or "always", allows the provider to define how to behave for the fork.

Returns:
An iterator that will trigger one fork per item

invoke

RunResult invoke(Object forkTestSet)
                 throws TestSetFailedException,
                        ReporterException,
                        InvocationTargetException
Runs a forked test

Parameters:
forkTestSet - An item from the iterator in #getSuites. Will be null for forkmode never or always. When this is non-null, the forked process will run only that test and probably not scan the classpath
Returns:
A result of the invocation
Throws:
ReporterException - When reporting fails
TestSetFailedException - When testset fails
InvocationTargetException

cancel

void cancel()
Makes an attempt at cancelling the current run, giving the provider a chance to notify reporting that the remaining tests have been cancelled due to timeout.

If the provider thinks it can terminate properly it is the responsibility of the invoke method to return a RunResult with a booter code of failure.

It is up to the provider to find out how to implement this method properly. A provider may also choose to not do anything at all in this method, which means surefire will kill the forked process soon afterwards anyway.

Will be called on a different thread than the one calling invoke.



Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.