| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.maven.plugin.AbstractMojo
org.apache.maven.plugin.surefire.AbstractSurefireMojo
public abstract class AbstractSurefireMojo
Abstract base class for running tests using Surefire.
| Nested Class Summary | |
|---|---|
 class | 
AbstractSurefireMojo.DynamicProviderInfo
 | 
| Field Summary | |
|---|---|
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  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()
 | 
|
| 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 | 
| Field Detail | 
|---|
@Parameter(defaultValue="${plugin}",
           readonly=true)
protected PluginDescriptor pluginDescriptor
@Parameter(property="skipTests",
           defaultValue="false")
protected boolean skipTests
@Parameter(property="maven.test.skip.exec") protected boolean skipExec
skipTests, but bound to the old property "maven.test.skip.exec".
@Parameter(property="maven.test.skip",
           defaultValue="false")
protected boolean skip
skipTests parameter instead.
@Component protected MavenProject project
@Parameter(defaultValue="${basedir}")
protected File basedir
@Parameter(defaultValue="${project.build.testOutputDirectory}")
protected File testClassesDirectory
@Parameter(defaultValue="${project.build.outputDirectory}")
protected File classesDirectory
@Parameter(defaultValue="${project.build.testSourceDirectory}",
           required=true)
protected File testSourceDirectory
@Parameter protected File includesFile
includes are also specified these patterns are appended.
@Parameter protected List<String> excludes
test parameter is not specified, the default excludes will be 
 <excludes>
  <exclude>**/*$*</exclude>
 </excludes>
  (which excludes all inner classes).suiteXmlFiles parameter is specified.
 
 Each exclude item may also contain a comma-separated sublist of items, which will be treated as multiple
  <exclude> entries.
@Parameter protected File excludesFile
excludes are also specified these patterns are appended.
@Parameter(defaultValue="${localRepository}",
           required=true,
           readonly=true)
protected ArtifactRepository localRepository
@Parameter protected Properties systemProperties
@Parameter protected Map<String,String> systemPropertyVariables
@Parameter protected File systemPropertiesFile
@Parameter protected Properties properties
@Parameter(property="plugin.artifactMap",
           required=true,
           readonly=true)
protected Map<String,Artifact> pluginArtifactMap
@Parameter(property="project.artifactMap",
           readonly=true,
           required=true)
protected Map<String,Artifact> projectArtifactMap
@Parameter(property="surefire.reportNameSuffix",
           defaultValue="")
protected String reportNameSuffix
@Parameter(property="maven.test.redirectTestOutputToFile",
           defaultValue="false")
protected boolean redirectTestOutputToFile
@Parameter(property="failIfNoTests") protected Boolean failIfNoTests
@Parameter(property="forkMode",
           defaultValue="once")
protected String forkMode
forkCount and reuseForks instead.threadCount
 parallel forks, each executing one test-class. See also parameter reuseForks.
@Parameter(property="jvm") protected String jvm
@Parameter(property="argLine") protected String argLine
@Parameter protected Map<String,String> environmentVariables
@Parameter(property="basedir") protected File workingDirectory
@Parameter(property="childDelegation",
           defaultValue="false")
protected boolean childDelegation
@Parameter(property="groups") protected String groups
suiteXmlFiles parameter is specified.
@Parameter(property="excludedGroups") protected String excludedGroups
suiteXmlFiles parameter is specified.
@Parameter protected File[] suiteXmlFiles
suiteXmlFiles is incompatible with several other parameters of this plugin, like
 includes/excludes.test parameter is specified (allowing you to run a single test
 instead of an entire suite).
@Parameter(property="junitArtifactName",
           defaultValue="junit:junit")
protected String junitArtifactName
junit:junit will be used.
@Parameter(property="testNGArtifactName",
           defaultValue="org.testng:testng")
protected String testNGArtifactName
org.testng:testng will be used.
@Parameter(property="threadCount") protected int threadCount
parallel parameter.
@Parameter(property="perCoreThreadCount",
           defaultValue="true")
protected boolean perCoreThreadCount
@Parameter(property="useUnlimitedThreads",
           defaultValue="false")
protected boolean useUnlimitedThreads
parallel parameter and
 the actual number of classes/methods will decide. Setting this to "true" effectively disables
 perCoreThreadCount and threadCount. Defaults to "false".
@Parameter(property="parallel") protected String parallel
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.
@Parameter(property="trimStackTrace",
           defaultValue="true")
protected boolean trimStackTrace
@Component protected ArtifactResolver artifactResolver
@Component protected ArtifactFactory artifactFactory
@Parameter(defaultValue="${project.pluginArtifactRepositories}")
protected List<ArtifactRepository> remoteRepositories
@Component protected ArtifactMetadataSource metadataSource
@Parameter(property="disableXmlReport",
           defaultValue="false")
protected boolean disableXmlReport
@Parameter(property="enableAssertions",
           defaultValue="true")
protected boolean enableAssertions
@Component protected MavenSession session
@Parameter(property="objectFactory") protected String objectFactory
@Parameter(defaultValue="${session.parallel}",
           readonly=true)
protected Boolean parallelMavenExecution
@Parameter(defaultValue="filesystem") protected String runOrder
@Component protected ToolchainManager toolchainManager
public static final String THREAD_NUMBER_PLACEHOLDER
public static final String FORK_NUMBER_PLACEHOLDER
| Constructor Detail | 
|---|
public AbstractSurefireMojo()
| Method Detail | 
|---|
protected abstract String getPluginName()
public void execute()
             throws MojoExecutionException,
                    MojoFailureException
execute in interface MojoMojoExecutionException
MojoFailureExceptionprotected abstract boolean isSkipExecution()
protected void executeAfterPreconditionsChecked(DefaultScanResult scanResult)
                                         throws MojoExecutionException,
                                                MojoFailureException
MojoExecutionException
MojoFailureException
protected List<ProviderInfo> createProviders()
                                      throws MojoFailureException,
                                             MojoExecutionException
MojoFailureException
MojoExecutionException
public void showToLog(SurefireProperties props,
                      Log log,
                      String setting)
public static SurefireProperties createCopyAndReplaceForkNumPlaceholder(SurefireProperties effectiveSystemProperties,
                                                                        int threadNumber)
protected void cleanupForkConfiguration(ForkConfiguration forkConfiguration)
protected abstract void handleSummary(RunResult summary,
                                      NestedCheckedException firstForkException)
                               throws MojoExecutionException,
                                      MojoFailureException
MojoExecutionException
MojoFailureExceptionprotected void logReportsDirectory()
protected boolean isAnyConcurrencySelected()
protected boolean isAnyGroupsSelected()
public String getStatisticsFileName(String configurationHash)
protected ForkStarter createForkStarter(ProviderInfo provider,
                                        ForkConfiguration forkConfiguration,
                                        ClassLoaderConfiguration classLoaderConfiguration,
                                        RunOrderParameters runOrderParameters,
                                        Log log)
                                 throws MojoExecutionException,
                                        MojoFailureException
MojoExecutionException
MojoFailureException
protected InPluginVMSurefireStarter createInprocessStarter(ProviderInfo provider,
                                                           ClassLoaderConfiguration classLoaderConfiguration,
                                                           RunOrderParameters runOrderParameters)
                                                    throws MojoExecutionException,
                                                           MojoFailureException
MojoExecutionException
MojoFailureExceptionprotected ForkConfiguration getForkConfiguration()
protected int getEffectiveForkCount()
protected int convertWithCoreCount(String count)
protected void addPluginSpecificChecksumItems(ChecksumCalculator checksum)
protected boolean hasExecutedBefore()
protected ClassLoaderConfiguration getClassLoaderConfiguration(boolean isForking)
protected abstract String[] getDefaultIncludes()
public abstract List<String> getIncludes()
getIncludes in interface SurefireExecutionParameterspublic File getIncludesFile()
public abstract void setIncludes(List<String> includes)
setIncludes in interface SurefireExecutionParameterspublic List<String> getExcludes()
getExcludes in interface SurefireExecutionParameterspublic File getExcludesFile()
public void setExcludes(List<String> excludes)
setExcludes in interface SurefireExecutionParameterspublic ArtifactRepository getLocalRepository()
getLocalRepository in interface SurefireExecutionParameterspublic void setLocalRepository(ArtifactRepository localRepository)
setLocalRepository in interface SurefireExecutionParameterspublic Properties getSystemProperties()
public void setSystemProperties(Properties systemProperties)
public Map<String,String> getSystemPropertyVariables()
public void setSystemPropertyVariables(Map<String,String> systemPropertyVariables)
public File getSystemPropertiesFile()
public void setSystemPropertiesFile(File systemPropertiesFile)
public Properties getProperties()
public void setProperties(Properties properties)
public Map<String,Artifact> getPluginArtifactMap()
public void setPluginArtifactMap(Map<String,Artifact> pluginArtifactMap)
public Map<String,Artifact> getProjectArtifactMap()
public void setProjectArtifactMap(Map<String,Artifact> projectArtifactMap)
public String getReportNameSuffix()
public void setReportNameSuffix(String reportNameSuffix)
public boolean isRedirectTestOutputToFile()
public void setRedirectTestOutputToFile(boolean redirectTestOutputToFile)
public Boolean getFailIfNoTests()
public void setFailIfNoTests(Boolean failIfNoTests)
public String getForkMode()
public void setForkMode(String forkMode)
public String getJvm()
public String getArgLine()
public void setArgLine(String argLine)
public Map<String,String> getEnvironmentVariables()
public void setEnvironmentVariables(Map<String,String> environmentVariables)
public File getWorkingDirectory()
public void setWorkingDirectory(File workingDirectory)
public boolean isChildDelegation()
public void setChildDelegation(boolean childDelegation)
public String getGroups()
public void setGroups(String groups)
public String getExcludedGroups()
public void setExcludedGroups(String excludedGroups)
public File[] getSuiteXmlFiles()
public void setSuiteXmlFiles(File[] suiteXmlFiles)
public String getJunitArtifactName()
public void setJunitArtifactName(String junitArtifactName)
public String getTestNGArtifactName()
public void setTestNGArtifactName(String testNGArtifactName)
public int getThreadCount()
public void setThreadCount(int threadCount)
public boolean getPerCoreThreadCount()
public void setPerCoreThreadCount(boolean perCoreThreadCount)
public boolean getUseUnlimitedThreads()
public void setUseUnlimitedThreads(boolean useUnlimitedThreads)
public String getParallel()
public void setParallel(String parallel)
public boolean isTrimStackTrace()
public void setTrimStackTrace(boolean trimStackTrace)
public ArtifactResolver getArtifactResolver()
public void setArtifactResolver(ArtifactResolver artifactResolver)
public ArtifactFactory getArtifactFactory()
public void setArtifactFactory(ArtifactFactory artifactFactory)
public List<ArtifactRepository> getRemoteRepositories()
public void setRemoteRepositories(List<ArtifactRepository> remoteRepositories)
public ArtifactMetadataSource getMetadataSource()
public void setMetadataSource(ArtifactMetadataSource metadataSource)
public boolean isDisableXmlReport()
public void setDisableXmlReport(boolean disableXmlReport)
public boolean isEnableAssertions()
public boolean effectiveIsEnableAssertions()
public void setEnableAssertions(boolean enableAssertions)
public MavenSession getSession()
public void setSession(MavenSession session)
public String getObjectFactory()
public void setObjectFactory(String objectFactory)
public ToolchainManager getToolchainManager()
public void setToolchainManager(ToolchainManager toolchainManager)
public boolean isMavenParallel()
public String getRunOrder()
public void setRunOrder(String runOrder)
public String[] getDependenciesToScan()
public void setDependenciesToScan(String[] dependenciesToScan)
public PluginDescriptor getPluginDescriptor()
public MavenProject getProject()
public void setProject(MavenProject project)
public File getTestSourceDirectory()
getTestSourceDirectory in interface SurefireExecutionParameterspublic void setTestSourceDirectory(File testSourceDirectory)
setTestSourceDirectory in interface SurefireExecutionParameterspublic String getForkCount()
public boolean isReuseForks()
public String[] getAdditionalClasspathElements()
public void setAdditionalClasspathElements(String[] additionalClasspathElements)
public String[] getClasspathDependencyExcludes()
public void setClasspathDependencyExcludes(String[] classpathDependencyExcludes)
public String getClasspathDependencyScopeExclude()
public void setClasspathDependencyScopeExclude(String classpathDependencyScopeExclude)
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||