org.apache.maven.plugin.surefire
Class AbstractSurefireMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugin.surefire.AbstractSurefireMojo
All Implemented Interfaces:
ContextEnabled, Mojo, SurefireExecutionParameters

public abstract class AbstractSurefireMojo
extends AbstractMojo
implements SurefireExecutionParameters

Abstract base class for running tests using Surefire.

Version:
$Id: SurefirePlugin.java 945065 2010-05-17 10:26:22Z stephenc $
Author:
Stephen Connolly

Nested Class Summary
 class AbstractSurefireMojo.DynamicProviderInfo
           
 
Field Summary
protected  List<String> additionalClasspathElements
          Additional elements to be appended to the classpath.
protected  String argLine
          Arbitrary JVM options to set on the command line.
protected  ArtifactFactory artifactFactory
          Creates the artifact.
protected  ArtifactResolver artifactResolver
          Resolves the artifacts needed.
protected  File basedir
          The base directory of the project being tested.
protected  boolean childDelegation
          When false it makes tests run using the standard classloader delegation instead of the default Maven isolated classloader.
protected  File classesDirectory
          The directory containing generated classes of the project being tested.
protected  List<String> classpathDependencyExcludes
          List of dependencies to exclude from the test classpath.
protected  String classpathDependencyScopeExclude
          A dependency scope to exclude from the test classpath.
protected  boolean disableXmlReport
          Flag to disable the generation of report files in xml format.
protected  boolean enableAssertions
          By default, Surefire enables JVM assertions for the execution of your test cases.
protected  Map<String,String> environmentVariables
          Additional environment variables to set on the command line.
protected  String excludedGroups
          (TestNG/JUnit47 provider with JUnit4.8+ only) Excluded groups.
protected  List<String> excludes
          A list of <exclude> elements specifying the tests (by pattern) that should be excluded in testing.
protected  File excludesFile
          A file containing exclude patterns.
protected  Boolean failIfNoTests
          Set this to "true" to cause a failure if there are no tests to run.
static String FORK_NUMBER_PLACEHOLDER
          The placeholder that is replaced by the executing fork's running number.
protected  String forkMode
          DEPRECATED since version 2.14.
protected  String groups
          (TestNG/JUnit47 provider with JUnit4.8+ only) Groups for this test.
protected  File includesFile
          A file containing include patterns.
protected  String junitArtifactName
          Allows you to specify the name of the JUnit artifact.
protected  String jvm
          Option to specify the jvm (or path to the java executable) to use with the forking options.
protected  ArtifactRepository localRepository
          ArtifactRepository of the localRepository.
protected  ArtifactMetadataSource metadataSource
          For retrieval of artifact's metadata.
protected  String objectFactory
          (TestNG only) Define the factory class used to create all test instances.
protected  String parallel
          (TestNG only) When you use the parallel attribute, TestNG will try to run all your test methods in separate threads, except for methods that depend on each other, which will be run in the same thread in order to respect their order of execution.
protected  Boolean parallelMavenExecution
           
protected  boolean perCoreThreadCount
          (JUnit 4.7 provider) Indicates that threadCount is per cpu core.
protected  Map<String,Artifact> pluginArtifactMap
          Map of plugin artifacts.
protected  PluginDescriptor pluginDescriptor
          Information about this plugin, mainly used to lookup this plugin's configuration from the currently executing project.
protected  MavenProject project
          The Maven Project Object.
protected  Map<String,Artifact> projectArtifactMap
          Map of project artifacts.
protected  Properties properties
          List of properties for configuring all TestNG related configurations.
protected  boolean redirectTestOutputToFile
          Set this to "true" to redirect the unit test standard output to a file (found in reportsDirectory/testName-output.txt).
protected  List<ArtifactRepository> remoteRepositories
          The remote plugin repositories declared in the POM.
protected  String reportNameSuffix
          Add custom text into report filename: TEST-testClassName-reportNameSuffix.xml, testClassName-reportNameSuffix.txt and testClassName-reportNameSuffix-output.txt.
protected  String runOrder
          Defines the order the tests will be run in.
protected  MavenSession session
          The current build session instance.
protected  boolean skip
          Set this to "true" to bypass unit tests entirely.
protected  boolean skipExec
          Deprecated. Use skipTests instead.
protected  boolean skipTests
          Set this to "true" to skip running tests, but still compile them.
protected  File[] suiteXmlFiles
          (TestNG) List of <suiteXmlFile> elements specifying TestNG suite xml file locations.
protected  Properties systemProperties
          Deprecated. Use systemPropertyVariables instead.
protected  File systemPropertiesFile
          List of System properties, loaded from a file, to pass to the JUnit tests.
protected  Map<String,String> systemPropertyVariables
          List of System properties to pass to the JUnit tests.
protected  File testClassesDirectory
          The directory containing generated test classes of the project being tested.
protected  String testNGArtifactName
          Allows you to specify the name of the TestNG artifact.
protected  File testSourceDirectory
          The test source directory containing test class sources.
static String THREAD_NUMBER_PLACEHOLDER
          The placeholder that is replaced by the executing thread's running number.
protected  int threadCount
          (TestNG/JUnit 4.7 provider) The attribute thread-count allows you to specify how many threads should be allocated for this execution.
protected  ToolchainManager toolchainManager
           
protected  boolean trimStackTrace
          Whether to trim the stack trace in the reports to just the lines within the test, or show the full trace.
protected  boolean useUnlimitedThreads
          (JUnit 4.7 provider) Indicates that the thread pool will be unlimited.
protected  File workingDirectory
          Command line working directory.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractSurefireMojo()
           
 
Method Summary
protected  void addPluginSpecificChecksumItems(ChecksumCalculator checksum)
           
protected  void cleanupForkConfiguration(ForkConfiguration forkConfiguration)
           
protected  int convertWithCoreCount(String count)
           
static SurefireProperties createCopyAndReplaceForkNumPlaceholder(SurefireProperties effectiveSystemProperties, int threadNumber)
           
protected  ForkStarter createForkStarter(ProviderInfo provider, ForkConfiguration forkConfiguration, ClassLoaderConfiguration classLoaderConfiguration, RunOrderParameters runOrderParameters)
           
protected  InPluginVMSurefireStarter createInprocessStarter(ProviderInfo provider, ClassLoaderConfiguration classLoaderConfiguration, RunOrderParameters runOrderParameters)
           
protected  List<ProviderInfo> createProviders()
           
 boolean effectiveIsEnableAssertions()
           
 void execute()
           
protected  void executeAfterPreconditionsChecked(DefaultScanResult scanResult)
           
 String getArgLine()
           
 ArtifactFactory getArtifactFactory()
           
 ArtifactResolver getArtifactResolver()
           
protected  ClassLoaderConfiguration getClassLoaderConfiguration(boolean isForking)
           
protected abstract  String[] getDefaultIncludes()
           
protected  int getEffectiveForkCount()
           
 Map<String,String> getEnvironmentVariables()
           
 String getExcludedGroups()
           
 List<String> getExcludes()
           
 File getExcludesFile()
           
 Boolean getFailIfNoTests()
           
protected  ForkConfiguration getForkConfiguration()
           
 String getForkCount()
           
 String getForkMode()
           
 String getGroups()
           
abstract  List<String> getIncludes()
           
 File getIncludesFile()
           
 String getJunitArtifactName()
           
 String getJvm()
           
 ArtifactRepository getLocalRepository()
           
 ArtifactMetadataSource getMetadataSource()
           
 String getObjectFactory()
           
 String getParallel()
           
 boolean getPerCoreThreadCount()
           
 Map<String,Artifact> getPluginArtifactMap()
           
 PluginDescriptor getPluginDescriptor()
           
protected abstract  String getPluginName()
           
 MavenProject getProject()
           
 Map<String,Artifact> getProjectArtifactMap()
           
 Properties getProperties()
           
 List<ArtifactRepository> getRemoteRepositories()
           
 String getReportNameSuffix()
           
 String getRunOrder()
           
 MavenSession getSession()
           
 String getStatisticsFileName(String configurationHash)
           
 File[] getSuiteXmlFiles()
           
 Properties getSystemProperties()
           
 File getSystemPropertiesFile()
           
 Map<String,String> getSystemPropertyVariables()
           
 String getTestNGArtifactName()
           
 File getTestSourceDirectory()
           
 int getThreadCount()
           
 ToolchainManager getToolchainManager()
           
 boolean getUseUnlimitedThreads()
           
 File getWorkingDirectory()
           
protected abstract  void handleSummary(RunResult summary, NestedCheckedException firstForkException)
           
protected  boolean hasExecutedBefore()
           
protected  boolean isAnyConcurrencySelected()
           
protected  boolean isAnyGroupsSelected()
           
 boolean isChildDelegation()
           
 boolean isDisableXmlReport()
           
 boolean isEnableAssertions()
           
 boolean isMavenParallel()
           
 boolean isRedirectTestOutputToFile()
           
 boolean isReuseForks()
           
protected abstract  boolean isSkipExecution()
           
 boolean isTrimStackTrace()
           
protected  void logReportsDirectory()
           
 void setArgLine(String argLine)
           
 void setArtifactFactory(ArtifactFactory artifactFactory)
           
 void setArtifactResolver(ArtifactResolver artifactResolver)
           
 void setChildDelegation(boolean childDelegation)
           
 void setDisableXmlReport(boolean disableXmlReport)
           
 void setEnableAssertions(boolean enableAssertions)
           
 void setEnvironmentVariables(Map<String,String> environmentVariables)
           
 void setExcludedGroups(String excludedGroups)
           
 void setExcludes(List<String> excludes)
           
 void setFailIfNoTests(Boolean failIfNoTests)
           
 void setForkMode(String forkMode)
           
 void setGroups(String groups)
           
abstract  void setIncludes(List<String> includes)
           
 void setJunitArtifactName(String junitArtifactName)
           
 void setLocalRepository(ArtifactRepository localRepository)
           
 void setMetadataSource(ArtifactMetadataSource metadataSource)
           
 void setObjectFactory(String objectFactory)
           
 void setParallel(String parallel)
           
 void setPerCoreThreadCount(boolean perCoreThreadCount)
           
 void setPluginArtifactMap(Map<String,Artifact> pluginArtifactMap)
           
 void setProject(MavenProject project)
           
 void setProjectArtifactMap(Map<String,Artifact> projectArtifactMap)
           
 void setProperties(Properties properties)
           
 void setRedirectTestOutputToFile(boolean redirectTestOutputToFile)
           
 void setRemoteRepositories(List<ArtifactRepository> remoteRepositories)
           
 void setReportNameSuffix(String reportNameSuffix)
           
 void setRunOrder(String runOrder)
           
 void setSession(MavenSession session)
           
 void setSuiteXmlFiles(File[] suiteXmlFiles)
           
 void setSystemProperties(Properties systemProperties)
           
 void setSystemPropertiesFile(File systemPropertiesFile)
           
 void setSystemPropertyVariables(Map<String,String> systemPropertyVariables)
           
 void setTestNGArtifactName(String testNGArtifactName)
           
 void setTestSourceDirectory(File testSourceDirectory)
           
 void setThreadCount(int threadCount)
           
 void setToolchainManager(ToolchainManager toolchainManager)
           
 void setTrimStackTrace(boolean trimStackTrace)
           
 void setUseUnlimitedThreads(boolean useUnlimitedThreads)
           
 void setWorkingDirectory(File workingDirectory)
           
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.maven.plugin.surefire.SurefireExecutionParameters
getAdditionalClasspathElements, getBasedir, getClassesDirectory, getClasspathDependencyExcludes, getClasspathDependencyScopeExclude, getDebugForkedProcess, getFailIfNoSpecifiedTests, getForkedProcessTimeoutInSeconds, getReportFormat, getReportsDirectory, getTest, getTestClassesDirectory, getTestMethod, isPrintSummary, isSkip, isSkipExec, isSkipTests, isUseFile, isUseManifestOnlyJar, isUseSystemClassLoader, setAdditionalClasspathElements, setBasedir, setClassesDirectory, setClasspathDependencyExcludes, setClasspathDependencyScopeExclude, setDebugForkedProcess, setFailIfNoSpecifiedTests, setForkedProcessTimeoutInSeconds, setPrintSummary, setReportFormat, setReportsDirectory, setSkip, setSkipExec, setSkipTests, setTest, setTestClassesDirectory, setUseFile, setUseManifestOnlyJar, setUseSystemClassLoader
 

Field Detail

pluginDescriptor

@Parameter(defaultValue="${plugin}",
           readonly=true)
protected PluginDescriptor pluginDescriptor
Information about this plugin, mainly used to lookup this plugin's configuration from the currently executing project.

Since:
2.12

skipTests

@Parameter(property="skipTests",
           defaultValue="false")
protected boolean skipTests
Set this to "true" to skip running tests, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.

Since:
2.4

skipExec

@Parameter(property="maven.test.skip.exec")
protected boolean skipExec
Deprecated. Use skipTests instead.
This old parameter is just like skipTests, but bound to the old property "maven.test.skip.exec".

Since:
2.3

skip

@Parameter(property="maven.test.skip",
           defaultValue="false")
protected boolean skip
Set this to "true" to bypass unit tests entirely. Its use is NOT RECOMMENDED, especially if you enable it using the "maven.test.skip" property, because maven.test.skip disables both running the tests and compiling the tests. Consider using the skipTests parameter instead.


project

@Component
protected MavenProject project
The Maven Project Object.


basedir

@Parameter(defaultValue="${basedir}")
protected File basedir
The base directory of the project being tested. This can be obtained in your integration test via System.getProperty("basedir").


testClassesDirectory

@Parameter(defaultValue="${project.build.testOutputDirectory}")
protected File testClassesDirectory
The directory containing generated test classes of the project being tested. This will be included at the beginning of the test classpath. *


classesDirectory

@Parameter(defaultValue="${project.build.outputDirectory}")
protected File classesDirectory
The directory containing generated classes of the project being tested. This will be included after the test classes in the test classpath.


classpathDependencyExcludes

@Parameter
protected List<String> classpathDependencyExcludes
List of dependencies to exclude from the test classpath. Each dependency string must follow the format groupId:artifactId. For example: org.acme:project-a

Since:
2.6

classpathDependencyScopeExclude

@Parameter(defaultValue="")
protected String classpathDependencyScopeExclude
A dependency scope to exclude from the test classpath. The scope should be one of the scopes defined by org.apache.maven.artifact.Artifact. This includes the following:

Since:
2.6

additionalClasspathElements

@Parameter
protected List<String> additionalClasspathElements
Additional elements to be appended to the classpath.

Since:
2.4

testSourceDirectory

@Parameter(defaultValue="${project.build.testSourceDirectory}",
           required=true)
protected File testSourceDirectory
The test source directory containing test class sources.

Since:
2.2

includesFile

@Parameter
protected File includesFile
A file containing include patterns. Blank lines, or lines starting with # are ignored. If includes are also specified these patterns are appended.


excludes

@Parameter
protected List<String> excludes
A list of <exclude> elements specifying the tests (by pattern) that should be excluded in testing. When not specified and when the test parameter is not specified, the default excludes will be
<excludes>
 <exclude>**/*$*</exclude>
</excludes>
(which excludes all inner classes).
This parameter is ignored if the TestNG suiteXmlFiles parameter is specified.

Each exclude item may also contain a comma-separated sublist of items, which will be treated as multiple  <exclude> entries.


excludesFile

@Parameter
protected File excludesFile
A file containing exclude patterns. Blank lines, or lines starting with # are ignored. If excludes are also specified these patterns are appended.


localRepository

@Parameter(defaultValue="${localRepository}",
           required=true,
           readonly=true)
protected ArtifactRepository localRepository
ArtifactRepository of the localRepository. To obtain the directory of localRepository in unit tests use System.getProperty("localRepository").


systemProperties

@Parameter
protected Properties systemProperties
Deprecated. Use systemPropertyVariables instead.
List of System properties to pass to the JUnit tests.


systemPropertyVariables

@Parameter
protected Map<String,String> systemPropertyVariables
List of System properties to pass to the JUnit tests.

Since:
2.5

systemPropertiesFile

@Parameter
protected File systemPropertiesFile
List of System properties, loaded from a file, to pass to the JUnit tests.

Since:
2.8.2

properties

@Parameter
protected Properties properties
List of properties for configuring all TestNG related configurations. This is the new preferred method of configuring TestNG.

Since:
2.4

pluginArtifactMap

@Parameter(property="plugin.artifactMap",
           required=true,
           readonly=true)
protected Map<String,Artifact> pluginArtifactMap
Map of plugin artifacts.


projectArtifactMap

@Parameter(property="project.artifactMap",
           readonly=true,
           required=true)
protected Map<String,Artifact> projectArtifactMap
Map of project artifacts.


reportNameSuffix

@Parameter(property="surefire.reportNameSuffix",
           defaultValue="")
protected String reportNameSuffix
Add custom text into report filename: TEST-testClassName-reportNameSuffix.xml, testClassName-reportNameSuffix.txt and testClassName-reportNameSuffix-output.txt. File TEST-testClassName-reportNameSuffix.xml has changed attributes 'testsuite'--'name' and 'testcase'--'classname' - reportNameSuffix is added to the attribute value.


redirectTestOutputToFile

@Parameter(property="maven.test.redirectTestOutputToFile",
           defaultValue="false")
protected boolean redirectTestOutputToFile
Set this to "true" to redirect the unit test standard output to a file (found in reportsDirectory/testName-output.txt).

Since:
2.3

failIfNoTests

@Parameter(property="failIfNoTests")
protected Boolean failIfNoTests
Set this to "true" to cause a failure if there are no tests to run. Defaults to "false".

Since:
2.4

forkMode

@Parameter(property="forkMode",
           defaultValue="once")
protected String forkMode
DEPRECATED since version 2.14. Use forkCount and reuseForks instead.

Option to specify the forking mode. Can be "never", "once", "always", "perthread". "none" and "pertest" are also accepted for backwards compatibility. "always" forks for each test-class. "perthread" will create threadCount parallel forks, each executing one test-class. See also parameter reuseForks.

Since:
2.1

jvm

@Parameter(property="jvm")
protected String jvm
Option to specify the jvm (or path to the java executable) to use with the forking options. For the default, the jvm will be a new instance of the same VM as the one used to run Maven. JVM settings are not inherited from MAVEN_OPTS.

Since:
2.1

argLine

@Parameter(property="argLine")
protected String argLine
Arbitrary JVM options to set on the command line.

Since:
2.1

environmentVariables

@Parameter
protected Map<String,String> environmentVariables
Additional environment variables to set on the command line.

Since:
2.1.3

workingDirectory

@Parameter(property="basedir")
protected File workingDirectory
Command line working directory.

Since:
2.1.3

childDelegation

@Parameter(property="childDelegation",
           defaultValue="false")
protected boolean childDelegation
When false it makes tests run using the standard classloader delegation instead of the default Maven isolated classloader. Only used when forking (forkMode is not "none").
Setting it to false helps with some problems caused by conflicts between xml parsers in the classpath and the Java 5 provider parser.

Since:
2.1

groups

@Parameter(property="groups")
protected String groups
(TestNG/JUnit47 provider with JUnit4.8+ only) Groups for this test. Only classes/methods/etc decorated with one of the groups specified here will be included in test run, if specified.
For JUnit, this parameter forces the use of the 4.7 provider
This parameter is ignored if the suiteXmlFiles parameter is specified.

Since:
2.2

excludedGroups

@Parameter(property="excludedGroups")
protected String excludedGroups
(TestNG/JUnit47 provider with JUnit4.8+ only) Excluded groups. Any methods/classes/etc with one of the groups specified in this list will specifically not be run.
For JUnit, this parameter forces the use of the 4.7 provider
This parameter is ignored if the suiteXmlFiles parameter is specified.

Since:
2.2

suiteXmlFiles

@Parameter
protected File[] suiteXmlFiles
(TestNG) List of <suiteXmlFile> elements specifying TestNG suite xml file locations. Note that suiteXmlFiles is incompatible with several other parameters of this plugin, like includes/excludes.
This parameter is ignored if the test parameter is specified (allowing you to run a single test instead of an entire suite).

Since:
2.2

junitArtifactName

@Parameter(property="junitArtifactName",
           defaultValue="junit:junit")
protected String junitArtifactName
Allows you to specify the name of the JUnit artifact. If not set, junit:junit will be used.

Since:
2.3.1

testNGArtifactName

@Parameter(property="testNGArtifactName",
           defaultValue="org.testng:testng")
protected String testNGArtifactName
Allows you to specify the name of the TestNG artifact. If not set, org.testng:testng will be used.

Since:
2.3.1

threadCount

@Parameter(property="threadCount")
protected int threadCount
(TestNG/JUnit 4.7 provider) The attribute thread-count allows you to specify how many threads should be allocated for this execution. Only makes sense to use in conjunction with the parallel parameter.

Since:
2.2

perCoreThreadCount

@Parameter(property="perCoreThreadCount",
           defaultValue="true")
protected boolean perCoreThreadCount
(JUnit 4.7 provider) Indicates that threadCount is per cpu core.

Since:
2.5

useUnlimitedThreads

@Parameter(property="useUnlimitedThreads",
           defaultValue="false")
protected boolean useUnlimitedThreads
(JUnit 4.7 provider) Indicates that the thread pool will be unlimited. The parallel parameter and the actual number of classes/methods will decide. Setting this to "true" effectively disables perCoreThreadCount and threadCount. Defaults to "false".

Since:
2.5

parallel

@Parameter(property="parallel")
protected String parallel
(TestNG only) When you use the parallel attribute, TestNG will try to run all your test methods in separate threads, except for methods that depend on each other, which will be run in the same thread in order to respect their order of execution.

(JUnit 4.7 provider) Supports values "classes"/"methods"/"both" to run in separate threads, as controlled by threadCount.

Since:
2.2

trimStackTrace

@Parameter(property="trimStackTrace",
           defaultValue="true")
protected boolean trimStackTrace
Whether to trim the stack trace in the reports to just the lines within the test, or show the full trace.

Since:
2.2

artifactResolver

@Component
protected ArtifactResolver artifactResolver
Resolves the artifacts needed.


artifactFactory

@Component
protected ArtifactFactory artifactFactory
Creates the artifact.


remoteRepositories

@Parameter(defaultValue="${project.pluginArtifactRepositories}")
protected List<ArtifactRepository> remoteRepositories
The remote plugin repositories declared in the POM.

Since:
2.2

metadataSource

@Component
protected ArtifactMetadataSource metadataSource
For retrieval of artifact's metadata.


disableXmlReport

@Parameter(property="disableXmlReport",
           defaultValue="false")
protected boolean disableXmlReport
Flag to disable the generation of report files in xml format.

Since:
2.2

enableAssertions

@Parameter(property="enableAssertions",
           defaultValue="true")
protected boolean enableAssertions
By default, Surefire enables JVM assertions for the execution of your test cases. To disable the assertions, set this flag to "false".

Since:
2.3.1

session

@Component
protected MavenSession session
The current build session instance.


objectFactory

@Parameter(property="objectFactory")
protected String objectFactory
(TestNG only) Define the factory class used to create all test instances.

Since:
2.5

parallelMavenExecution

@Parameter(defaultValue="${session.parallel}",
           readonly=true)
protected Boolean parallelMavenExecution

runOrder

@Parameter(defaultValue="filesystem")
protected String runOrder
Defines the order the tests will be run in. Supported values are "alphabetical", "reversealphabetical", "random", "hourly" (alphabetical on even hours, reverse alphabetical on odd hours), "failedfirst", "balanced" and "filesystem".

Odd/Even for hourly is determined at the time the of scanning the classpath, meaning it could change during a multi-module build.

Failed first will run tests that failed on previous run first, as well as new tests for this run.

Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests to make all tests complete at the same time, reducing the overall execution time.

Note that the statistics are stored in a file named .surefire-XXXXXXXXX beside pom.xml, and should not be checked into version control. The "XXXXX" is the SHA1 checksum of the entire surefire configuration, so different configurations will have different statistics files, meaning if you change any config settings you will re-run once before new statistics data can be established.

Since:
2.7

toolchainManager

@Component
protected ToolchainManager toolchainManager

THREAD_NUMBER_PLACEHOLDER

public static final String THREAD_NUMBER_PLACEHOLDER
The placeholder that is replaced by the executing thread's running number. The thread number range starts with 1 Deprecated.

See Also:
Constant Field Values

FORK_NUMBER_PLACEHOLDER

public static final String FORK_NUMBER_PLACEHOLDER
The placeholder that is replaced by the executing fork's running number. The fork number range starts with 1

See Also:
Constant Field Values
Constructor Detail

AbstractSurefireMojo

public AbstractSurefireMojo()
Method Detail

getPluginName

protected abstract String getPluginName()

execute

public void execute()
             throws MojoExecutionException,
                    MojoFailureException
Specified by:
execute in interface Mojo
Throws:
MojoExecutionException
MojoFailureException

isSkipExecution

protected abstract boolean isSkipExecution()

executeAfterPreconditionsChecked

protected void executeAfterPreconditionsChecked(DefaultScanResult scanResult)
                                         throws MojoExecutionException,
                                                MojoFailureException
Throws:
MojoExecutionException
MojoFailureException

createProviders

protected List<ProviderInfo> createProviders()
                                      throws MojoFailureException,
                                             MojoExecutionException
Throws:
MojoFailureException
MojoExecutionException

createCopyAndReplaceForkNumPlaceholder

public static SurefireProperties createCopyAndReplaceForkNumPlaceholder(SurefireProperties effectiveSystemProperties,
                                                                        int threadNumber)

cleanupForkConfiguration

protected void cleanupForkConfiguration(ForkConfiguration forkConfiguration)

handleSummary

protected abstract void handleSummary(RunResult summary,
                                      NestedCheckedException firstForkException)
                               throws MojoExecutionException,
                                      MojoFailureException
Throws:
MojoExecutionException
MojoFailureException

logReportsDirectory

protected void logReportsDirectory()

isAnyConcurrencySelected

protected boolean isAnyConcurrencySelected()

isAnyGroupsSelected

protected boolean isAnyGroupsSelected()

getStatisticsFileName

public String getStatisticsFileName(String configurationHash)

createForkStarter

protected ForkStarter createForkStarter(ProviderInfo provider,
                                        ForkConfiguration forkConfiguration,
                                        ClassLoaderConfiguration classLoaderConfiguration,
                                        RunOrderParameters runOrderParameters)
                                 throws MojoExecutionException,
                                        MojoFailureException
Throws:
MojoExecutionException
MojoFailureException

createInprocessStarter

protected InPluginVMSurefireStarter createInprocessStarter(ProviderInfo provider,
                                                           ClassLoaderConfiguration classLoaderConfiguration,
                                                           RunOrderParameters runOrderParameters)
                                                    throws MojoExecutionException,
                                                           MojoFailureException
Throws:
MojoExecutionException
MojoFailureException

getForkConfiguration

protected ForkConfiguration getForkConfiguration()

getEffectiveForkCount

protected int getEffectiveForkCount()

convertWithCoreCount

protected int convertWithCoreCount(String count)

addPluginSpecificChecksumItems

protected void addPluginSpecificChecksumItems(ChecksumCalculator checksum)

hasExecutedBefore

protected boolean hasExecutedBefore()

getClassLoaderConfiguration

protected ClassLoaderConfiguration getClassLoaderConfiguration(boolean isForking)

getDefaultIncludes

protected abstract String[] getDefaultIncludes()

getIncludes

public abstract List<String> getIncludes()
Specified by:
getIncludes in interface SurefireExecutionParameters

getIncludesFile

public File getIncludesFile()

setIncludes

public abstract void setIncludes(List<String> includes)
Specified by:
setIncludes in interface SurefireExecutionParameters

getExcludes

public List<String> getExcludes()
Specified by:
getExcludes in interface SurefireExecutionParameters

getExcludesFile

public File getExcludesFile()

setExcludes

public void setExcludes(List<String> excludes)
Specified by:
setExcludes in interface SurefireExecutionParameters

getLocalRepository

public ArtifactRepository getLocalRepository()
Specified by:
getLocalRepository in interface SurefireExecutionParameters

setLocalRepository

public void setLocalRepository(ArtifactRepository localRepository)
Specified by:
setLocalRepository in interface SurefireExecutionParameters

getSystemProperties

public Properties getSystemProperties()

setSystemProperties

public void setSystemProperties(Properties systemProperties)

getSystemPropertyVariables

public Map<String,String> getSystemPropertyVariables()

setSystemPropertyVariables

public void setSystemPropertyVariables(Map<String,String> systemPropertyVariables)

getSystemPropertiesFile

public File getSystemPropertiesFile()

setSystemPropertiesFile

public void setSystemPropertiesFile(File systemPropertiesFile)

getProperties

public Properties getProperties()

setProperties

public void setProperties(Properties properties)

getPluginArtifactMap

public Map<String,Artifact> getPluginArtifactMap()

setPluginArtifactMap

public void setPluginArtifactMap(Map<String,Artifact> pluginArtifactMap)

getProjectArtifactMap

public Map<String,Artifact> getProjectArtifactMap()

setProjectArtifactMap

public void setProjectArtifactMap(Map<String,Artifact> projectArtifactMap)

getReportNameSuffix

public String getReportNameSuffix()

setReportNameSuffix

public void setReportNameSuffix(String reportNameSuffix)

isRedirectTestOutputToFile

public boolean isRedirectTestOutputToFile()

setRedirectTestOutputToFile

public void setRedirectTestOutputToFile(boolean redirectTestOutputToFile)

getFailIfNoTests

public Boolean getFailIfNoTests()

setFailIfNoTests

public void setFailIfNoTests(Boolean failIfNoTests)

getForkMode

public String getForkMode()

setForkMode

public void setForkMode(String forkMode)

getJvm

public String getJvm()

getArgLine

public String getArgLine()

setArgLine

public void setArgLine(String argLine)

getEnvironmentVariables

public Map<String,String> getEnvironmentVariables()

setEnvironmentVariables

public void setEnvironmentVariables(Map<String,String> environmentVariables)

getWorkingDirectory

public File getWorkingDirectory()

setWorkingDirectory

public void setWorkingDirectory(File workingDirectory)

isChildDelegation

public boolean isChildDelegation()

setChildDelegation

public void setChildDelegation(boolean childDelegation)

getGroups

public String getGroups()

setGroups

public void setGroups(String groups)

getExcludedGroups

public String getExcludedGroups()

setExcludedGroups

public void setExcludedGroups(String excludedGroups)

getSuiteXmlFiles

public File[] getSuiteXmlFiles()

setSuiteXmlFiles

public void setSuiteXmlFiles(File[] suiteXmlFiles)

getJunitArtifactName

public String getJunitArtifactName()

setJunitArtifactName

public void setJunitArtifactName(String junitArtifactName)

getTestNGArtifactName

public String getTestNGArtifactName()

setTestNGArtifactName

public void setTestNGArtifactName(String testNGArtifactName)

getThreadCount

public int getThreadCount()

setThreadCount

public void setThreadCount(int threadCount)

getPerCoreThreadCount

public boolean getPerCoreThreadCount()

setPerCoreThreadCount

public void setPerCoreThreadCount(boolean perCoreThreadCount)

getUseUnlimitedThreads

public boolean getUseUnlimitedThreads()

setUseUnlimitedThreads

public void setUseUnlimitedThreads(boolean useUnlimitedThreads)

getParallel

public String getParallel()

setParallel

public void setParallel(String parallel)

isTrimStackTrace

public boolean isTrimStackTrace()

setTrimStackTrace

public void setTrimStackTrace(boolean trimStackTrace)

getArtifactResolver

public ArtifactResolver getArtifactResolver()

setArtifactResolver

public void setArtifactResolver(ArtifactResolver artifactResolver)

getArtifactFactory

public ArtifactFactory getArtifactFactory()

setArtifactFactory

public void setArtifactFactory(ArtifactFactory artifactFactory)

getRemoteRepositories

public List<ArtifactRepository> getRemoteRepositories()

setRemoteRepositories

public void setRemoteRepositories(List<ArtifactRepository> remoteRepositories)

getMetadataSource

public ArtifactMetadataSource getMetadataSource()

setMetadataSource

public void setMetadataSource(ArtifactMetadataSource metadataSource)

isDisableXmlReport

public boolean isDisableXmlReport()

setDisableXmlReport

public void setDisableXmlReport(boolean disableXmlReport)

isEnableAssertions

public boolean isEnableAssertions()

effectiveIsEnableAssertions

public boolean effectiveIsEnableAssertions()

setEnableAssertions

public void setEnableAssertions(boolean enableAssertions)

getSession

public MavenSession getSession()

setSession

public void setSession(MavenSession session)

getObjectFactory

public String getObjectFactory()

setObjectFactory

public void setObjectFactory(String objectFactory)

getToolchainManager

public ToolchainManager getToolchainManager()

setToolchainManager

public void setToolchainManager(ToolchainManager toolchainManager)

isMavenParallel

public boolean isMavenParallel()

getRunOrder

public String getRunOrder()

setRunOrder

public void setRunOrder(String runOrder)

getPluginDescriptor

public PluginDescriptor getPluginDescriptor()

getProject

public MavenProject getProject()

setProject

public void setProject(MavenProject project)

getTestSourceDirectory

public File getTestSourceDirectory()
Specified by:
getTestSourceDirectory in interface SurefireExecutionParameters

setTestSourceDirectory

public void setTestSourceDirectory(File testSourceDirectory)
Specified by:
setTestSourceDirectory in interface SurefireExecutionParameters

getForkCount

public String getForkCount()

isReuseForks

public boolean isReuseForks()


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