Package org.apache.maven.plugin.surefire
Class AbstractSurefireMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugin.surefire.AbstractSurefireMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
,SurefireExecutionParameters
- Direct Known Subclasses:
IntegrationTestMojo
,SurefirePlugin
public abstract class AbstractSurefireMojo
extends org.apache.maven.plugin.AbstractMojo
implements SurefireExecutionParameters
Abstract base class for running tests using Surefire.
- Version:
- $Id: SurefirePlugin.java 945065 2010-05-17 10:26:22Z stephenc $
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
(package private) final class
Provides the Provider information for manually configured providers.(package private) final class
(package private) final class
(package private) final class
(package private) final class
(package private) static enum
Determines whether the plugin should fail if no tests found to run.(package private) final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String[]
Additional elements to be appended to the classpath.private String
Arbitrary JVM options to set on the command line.protected File
The base directory of the project being tested.private boolean
When false it makes tests run using the standard classloader delegation instead of the default Maven isolated classloader.private final AbstractSurefireMojo.ClasspathCache
private String[]
List of dependencies to exclude from the test classpath.private String
A dependency scope to exclude from the test classpath.private List<CommandLineOption>
private PluginConsoleLogger
private SurefireConsoleOutputReporter
private String[]
List of dependencies to scan for test classes to include in the test run.private boolean
Deprecated.private int
private boolean
By default, Surefire enables JVM assertions for the execution of your test cases.Additional environment variables to set on the command line.private String
(TestNG/JUnit47 provider with JUnit4.8+ only and JUnit5+ provider since 2.22.0) Excluded groups/categories/tags.private boolean
Set this to "true" to cause a failure if there are no tests to run.private static final String
private static final String
private static final String
private static final String
private String
Option to specify the number of VMs to fork in parallel in order to execute the tests.private String
DEPRECATED since version 2.14.private String
(TestNG/JUnit47 provider with JUnit4.8+ only and JUnit5+ provider since 2.22.0) Groups/categories/tags for this test.private TestListResolver
Allow for configuration of the test jvm via maven toolchains.private String
Allows you to specify the name of the JUnit artifact.private String
Option to specify the jvm (or path to the java executable) to use with the forking options.private org.apache.maven.artifact.repository.ArtifactRepository
ArtifactRepository of the localRepository.private org.codehaus.plexus.languages.java.jpms.LocationManager
private org.codehaus.plexus.logging.Logger
private String
(TestNG only) Define the factory class used to create all test instances.private String
(TestNG provider) When you use the parameterparallel
, 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.private Boolean
Parallel Maven Execution.private boolean
(JUnit 4.7 / provider only) The thread counts do not exceed the number of parallel suite, class runners and average number of methods per class if set to true.private boolean
(JUnit 4.7 provider) Indicates that threadCount, threadCountSuites, threadCountClasses, threadCountMethods are per cpu core.private static final Platform
Map of plugin artifacts.private org.apache.maven.plugin.descriptor.PluginDescriptor
Information about this plugin, mainly used to lookup this plugin's configuration from the currently executing project.private org.apache.maven.project.MavenProject
The Maven Project Object.Map of project artifacts.private File
Read-only parameter with value of Maven property project.build.directory.private List<org.apache.maven.artifact.repository.ArtifactRepository>
private Properties
List of properties for configuring all TestNG related configurations.private ProviderDetector
private boolean
Set this to "true" to redirect the unit test standard output to a file (found in reportsDirectory/testName-output.txt).private List<org.apache.maven.artifact.repository.ArtifactRepository>
The remote plugin repositories declared in the POM.private String
Add custom text into report filename: TEST-testClassName-reportNameSuffix.xml, testClassName-reportNameSuffix.txt and testClassName-reportNameSuffix-output.txt.private org.apache.maven.repository.RepositorySystem
private org.apache.maven.artifact.resolver.ResolutionErrorHandler
private boolean
Indicates if forked VMs can be reused.private org.apache.maven.execution.MavenSession
The current build session instance.protected boolean
Set this to "true" to bypass unit tests entirely.protected boolean
Deprecated.Use skipTests instead.protected boolean
Set this to "true" to skip running tests, but still compile them.private TestListResolver
private SurefireStatelessReporter
Note: use the legacy system property disableXmlReport set totrue
to disable the report.private SurefireDependencyResolver
private Properties
Deprecated.Use systemPropertyVariables instead.List of System properties to pass to the JUnit tests.private String
Relative path to temporary-surefire-boot directory containing internal Surefire temporary files.protected File
The directory containing generated test classes of the project being tested.private String
Allows you to specify the name of the TestNG artifact.private File
The test source directory containing test class sources.private int
(TestNG/JUnit 4.7 provider) The attribute thread-count allows you to specify how many threads should be allocated for this execution.private int
(JUnit 4.7 provider) This attribute allows you to specify the concurrency in test classes, i.e.: number of concurrent classes ifthreadCount
is 0 or unspecified limited classes concurrency ifuseUnlimitedThreads
is set to true ifthreadCount
and certain thread-count parameters are > 0 forparallel
, the concurrency is computed from ratio.private int
(JUnit 4.7 provider) This attribute allows you to specify the concurrency in test methods, i.e.: number of concurrent methods ifthreadCount
is 0 or unspecified limited concurrency of methods ifuseUnlimitedThreads
is set to true ifthreadCount
and certain thread-count parameters are > 0 forparallel
, the concurrency is computed from ratio.private int
(JUnit 4.7 provider) This attribute allows you to specify the concurrency in test suites, i.e.: number of concurrent suites ifthreadCount
is 0 or unspecified limited suites concurrency ifuseUnlimitedThreads
is set to true ifthreadCount
and certain thread-count parameters are > 0 forparallel
, the concurrency is computed from ratio.private org.apache.maven.toolchain.Toolchain
private org.apache.maven.toolchain.ToolchainManager
private boolean
Whether to trim the stack trace in the reports to just the lines within the test, or show the full trace.private boolean
(JUnit 4.7 provider) Indicates that the thread pool will be unlimited.private File
Command line working directory.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
private boolean
canExecuteProviderWithModularPath
(Platform platform, ResolvePathResultWrapper resolvedJavaModularityResult) private void
checkMethodFilterInIncludesExcludes
(Iterable<String> patterns) private void
checkNonForkedThreads
(String parallel) private static void
checkThreadCountEntity
(int count, String entity) protected void
cleanupForkConfiguration
(ForkConfiguration forkConfiguration) private List<CommandLineOption>
private void
private void
private void
Converts old JUnit configuration parameters over to new properties based configuration method.private void
private void
Converts old TestNG configuration parameters over to new properties based configuration method.protected int
convertWithCoreCount
(String count) static SurefireProperties
createCopyAndReplaceForkNumPlaceholder
(SurefireProperties effectiveSystemProperties, int threadNumber) private ForkConfiguration
createForkConfiguration
(Platform platform, ResolvePathResultWrapper resolvedJavaModularityResult) private ForkStarter
createForkStarter
(ProviderInfo provider, ForkConfiguration forkConfiguration, ClassLoaderConfiguration classLoaderConfiguration, RunOrderParameters runOrderParameters, ConsoleLogger log, DefaultScanResult scanResult, TestClassPath testClasspathWrapper, Platform platform, ResolvePathResultWrapper resolvedJavaModularityResult) private static Classpath
createInProcClasspath
(Classpath providerClasspath, Set<org.apache.maven.artifact.Artifact> newArtifacts) private InPluginVMSurefireStarter
createInprocessStarter
(ProviderInfo provider, ClassLoaderConfiguration classLoaderConfig, RunOrderParameters runOrderParameters, DefaultScanResult scanResult, Platform platform, TestClassPath testClasspathWrapper) private ProviderConfiguration
createProviderConfiguration
(RunOrderParameters runOrderParameters) protected List<ProviderInfo>
createProviders
(TestClassPath testClasspath) private StartupConfiguration
createStartupConfiguration
(ProviderInfo provider, boolean isForking, ClassLoaderConfiguration classLoaderConfiguration, DefaultScanResult scanResult, TestClassPath testClasspathWrapper, Platform platform, ResolvePathResultWrapper resolvedJavaModularity) (package private) File
(package private) File
private org.apache.maven.artifact.versioning.VersionRange
boolean
private void
private void
private void
private void
void
execute()
private void
executeAfterPreconditionsChecked
(DefaultScanResult scanResult, Platform platform) private RunResult
executeProvider
(ProviderInfo provider, DefaultScanResult scanResult, TestClassPath testClasspathWrapper, Platform platform, ResolvePathResultWrapper resolvedJavaModularityResult) private boolean
existsModuleDescriptor
(ResolvePathResultWrapper resolvedJavaModularityResult) private static Set<org.apache.maven.artifact.Artifact>
filterArtifacts
(Set<org.apache.maven.artifact.Artifact> artifacts, org.apache.maven.artifact.resolver.filter.ArtifactFilter filter) Return a new set containing only the artifacts accepted by the given filter.filterNulls
(List<String> toFilter) private ResolvePathResultWrapper
findModuleDescriptor
(File jdkHome) private ResolvePathResultWrapper
findModuleDescriptor
(File jdkHome, File buildPath, boolean isMainDescriptor) private TestClassPath
Generates the test classpath.String[]
private org.apache.maven.artifact.Artifact
private Classpath
getArtifactClasspath
(org.apache.maven.artifact.Artifact surefireArtifact) private org.apache.maven.artifact.Artifact
protected ClassLoaderConfiguration
String[]
private org.apache.maven.artifact.Artifact
private String
Operates on raw plugin parameters, not the "effective" values.private static String
getConfiguratorName
(org.apache.maven.artifact.versioning.ArtifactVersion version, PluginConsoleLogger log) protected final PluginConsoleLogger
private String
protected abstract String[]
String[]
private String
protected int
(package private) String
private static String
getEffectiveForkMode
(String forkMode) private JdkAttributes
protected abstract String
protected abstract String[]
getExcludeList
(boolean asScanList) Computes a merge list of test exclusions.abstract File
private org.apache.maven.artifact.Artifact
boolean
protected abstract ForkNodeFactory
private ForkNodeFactory
private TestListResolver
getIncludeList
(boolean asScanList) Computes a merge list of test inclusions.abstract File
private org.apache.maven.artifact.Artifact
private org.apache.maven.artifact.Artifact
private org.apache.maven.artifact.Artifact
private org.apache.maven.artifact.Artifact
getJvm()
org.apache.maven.artifact.repository.ArtifactRepository
private org.codehaus.plexus.languages.java.jpms.LocationManager
For testing purposes - Mockito.private org.apache.maven.artifact.Artifact
protected org.apache.maven.artifact.Artifact
This plugin MOJO artifact.boolean
org.apache.maven.plugin.descriptor.PluginDescriptor
protected abstract String
org.apache.maven.project.MavenProject
List<org.apache.maven.artifact.repository.ArtifactRepository>
(package private) List<org.apache.maven.artifact.Artifact>
private Properties
List<org.apache.maven.artifact.repository.ArtifactRepository>
protected abstract String
org.apache.maven.repository.RepositorySystem
protected abstract int
abstract String
abstract Long
org.apache.maven.execution.MavenSession
private org.apache.maven.artifact.Artifact
private org.apache.maven.artifact.Artifact
private StartupReportConfiguration
getStartupReportConfiguration
(String configChecksum, boolean isForkMode) private File
getStatisticsFile
(String configurationHash) abstract File[]
private org.apache.maven.artifact.Artifact
(package private) File
Where surefire stores its own temp filesabstract File
List of System properties, loaded from a file, to pass to the JUnit tests.private org.apache.maven.artifact.Artifact
int
int
int
int
private org.apache.maven.toolchain.Toolchain
org.apache.maven.toolchain.ToolchainManager
private static <T extends org.apache.maven.toolchain.ToolchainManager>
org.apache.maven.toolchain.ToolchaingetToolchainMaven33x
(Class<T> toolchainManagerType, T toolchainManager, org.apache.maven.execution.MavenSession session, Map<String, String> toolchainArgs) private Properties
boolean
protected abstract void
handleSummary
(RunResult summary, Exception firstForkException) protected boolean
private static boolean
hasGroupArtifactId
(String groupId, String artifactId, org.apache.maven.artifact.Artifact artifact) protected abstract boolean
protected boolean
protected boolean
private boolean
isAnyJunit4
(org.apache.maven.artifact.Artifact artifact) boolean
boolean
boolean
protected boolean
private static boolean
isForkModeNever
(String forkMode) private boolean
isJunit47Compatible
(org.apache.maven.artifact.Artifact artifact) boolean
private static boolean
private boolean
boolean
boolean
boolean
protected abstract boolean
private boolean
boolean
private static String
protected void
protected void
private StartupConfiguration
newStartupConfigWithClasspath
(ClassLoaderConfiguration classLoaderConfiguration, ProviderInfo providerInfo, TestClassPath testClasspathWrapper) private StartupConfiguration
newStartupConfigWithModularPath
(ClassLoaderConfiguration classLoaderConfiguration, ProviderInfo providerInfo, ResolvePathResultWrapper moduleDescriptor, DefaultScanResult scanResult, String javaHome, TestClassPath testClasspathWrapper) private boolean
private void
readListFromFile
(File file) private boolean
private static Set<org.apache.maven.artifact.Artifact>
retainInProcArtifactsUnique
(Set<org.apache.maven.artifact.Artifact> providerArtifacts, org.apache.maven.artifact.Artifact... inPluginArtifacts) (package private) DefaultScanResult
private DefaultScanResult
private DefaultScanResult
void
setAdditionalClasspathElements
(String[] additionalClasspathElements) void
setArgLine
(String argLine) void
setChildDelegation
(boolean childDelegation) void
setClasspathDependencyExcludes
(String[] classpathDependencyExcludes) void
setClasspathDependencyScopeExclude
(String classpathDependencyScopeExclude) void
setDependenciesToScan
(String[] dependenciesToScan) void
setDisableXmlReport
(boolean disableXmlReport) void
setEnableAssertions
(boolean enableAssertions) void
setEnvironmentVariables
(Map<String, String> environmentVariables) void
setExcludedGroups
(String excludedGroups) void
setFailIfNoTests
(boolean failIfNoTests) void
setForkMode
(String forkMode) void
abstract void
setIncludes
(List<String> includes) void
setJdkToolchain
(Map<String, String> jdkToolchain) void
setJunitArtifactName
(String junitArtifactName) void
setLocalRepository
(org.apache.maven.artifact.repository.ArtifactRepository localRepository) (package private) void
setLogger
(org.codehaus.plexus.logging.Logger logger) void
setObjectFactory
(String objectFactory) void
setParallel
(String parallel) void
setParallelOptimized
(boolean parallelOptimized) void
setPerCoreThreadCount
(boolean perCoreThreadCount) void
setPluginArtifactMap
(Map<String, org.apache.maven.artifact.Artifact> pluginArtifactMap) (package private) void
setPluginDescriptor
(org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor) void
setProject
(org.apache.maven.project.MavenProject project) void
setProjectArtifactMap
(Map<String, org.apache.maven.artifact.Artifact> projectArtifactMap) void
setProjectBuildDirectory
(File projectBuildDirectory) void
setProjectRemoteRepositories
(List<org.apache.maven.artifact.repository.ArtifactRepository> projectRemoteRepositories) void
setProperties
(Properties properties) void
setRedirectTestOutputToFile
(boolean redirectTestOutputToFile) void
setRemoteRepositories
(List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories) void
setReportNameSuffix
(String reportNameSuffix) void
setRepositorySystem
(org.apache.maven.repository.RepositorySystem repositorySystem) void
setResolutionErrorHandler
(org.apache.maven.artifact.resolver.ResolutionErrorHandler resolutionErrorHandler) abstract void
setRunOrder
(String runOrder) abstract void
setRunOrderRandomSeed
(Long runOrderRandomSeed) void
setSession
(org.apache.maven.execution.MavenSession session) abstract void
setSuiteXmlFiles
(File[] suiteXmlFiles) void
setSystemProperties
(Properties systemProperties) abstract void
setSystemPropertiesFile
(File systemPropertiesFile) void
setSystemPropertyVariables
(Map<String, String> systemPropertyVariables) void
setTempDir
(String tempDir) void
setTestNGArtifactName
(String testNGArtifactName) void
setTestSourceDirectory
(File testSourceDirectory) void
setThreadCount
(int threadCount) void
setThreadCountClasses
(int threadCountClasses) void
setThreadCountMethods
(int threadCountMethods) void
setThreadCountSuites
(int threadCountSuites) void
setToolchainManager
(org.apache.maven.toolchain.ToolchainManager toolchainManager) void
setTrimStackTrace
(boolean trimStackTrace) private SurefireProperties
private void
protected abstract void
setUseModulePath
(boolean useModulePath) void
setUseUnlimitedThreads
(boolean useUnlimitedThreads) void
setWorkingDirectory
(File workingDirectory) private <T> void
private void
private void
showToLog
(SurefireProperties props, ConsoleLogger log) CallsgetSuiteXmlFiles()
aslist
.toStringProperties
(Properties properties) protected abstract boolean
(package private) boolean
private void
private void
protected void
private void
private void
private void
private void
private void
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
getBasedir, getDebugForkedProcess, getEncoding, getExcludeJUnit5Engines, getExcludes, getFailIfNoSpecifiedTests, getForkedProcessExitTimeoutInSeconds, getForkedProcessTimeoutInSeconds, getIncludeJUnit5Engines, getMainBuildPath, getParallelTestsTimeoutForcedInSeconds, getParallelTestsTimeoutInSeconds, getReportFormat, getReportsDirectory, getShutdown, getSkipAfterFailureCount, getTest, getTestClassesDirectory, isPrintSummary, isSkip, isSkipExec, isSkipTests, isUseFile, isUseManifestOnlyJar, isUseSystemClassLoader, setBasedir, setDebugForkedProcess, setEncoding, setExcludeJUnit5Engines, setExcludes, setFailIfNoSpecifiedTests, setForkedProcessExitTimeoutInSeconds, setForkedProcessTimeoutInSeconds, setIncludeJUnit5Engines, setMainBuildPath, setParallelTestsTimeoutForcedInSeconds, setParallelTestsTimeoutInSeconds, setPrintSummary, setReportFormat, setReportsDirectory, setSkip, setSkipExec, setSkipTests, setTest, setTestClassesDirectory, setUseFile, setUseManifestOnlyJar, setUseSystemClassLoader
-
Field Details
-
FORK_ONCE
- See Also:
-
FORK_ALWAYS
- See Also:
-
FORK_NEVER
- See Also:
-
FORK_PERTHREAD
- See Also:
-
JAVA_9_MATCHER_OLD_NOTATION
-
JAVA_9_MATCHER
-
PLATFORM
-
classpathCache
-
statelessTestsetReporter
Note: use the legacy system property disableXmlReport set totrue
to disable the report. -
consoleOutputReporter
-
statelessTestsetInfoReporter
-
pluginDescriptor
@Parameter(defaultValue="${plugin}", readonly=true, required=true) private org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptorInformation 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 skipTestsSet this to "true" to skip running tests, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.
Failsafe plugin deprecated the parameterskipTests
and the parameter will be removed in Failsafe 3.0.0 as it is a source of conflicts between Failsafe and Surefire plugin.- Since:
- 2.4
-
skipExec
Deprecated.Use skipTests instead.This old parameter is just likeskipTests
, but bound to the old property "maven.test.skip.exec".- Since:
- 2.3
-
skip
@Parameter(property="maven.test.skip", defaultValue="false") protected boolean skipSet 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 theskipTests
parameter instead. -
project
@Parameter(defaultValue="${project}", required=true, readonly=true) private org.apache.maven.project.MavenProject projectThe Maven Project Object. -
basedir
The base directory of the project being tested. This can be obtained in your integration test via System.getProperty("basedir"). -
testClassesDirectory
The directory containing generated test classes of the project being tested. This will be included at the beginning of the test classpath. * -
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
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:
- compile - system, provided, compile
- runtime - compile, runtime
- compile+runtime - system, provided, compile, runtime
- runtime+system - system, compile, runtime
- test - system, provided, compile, runtime, test
- Since:
- 2.6
-
additionalClasspathElements
Additional elements to be appended to the classpath.- Since:
- 2.4
-
testSourceDirectory
The test source directory containing test class sources. Important only for TestNG HTML reports.- Since:
- 2.2
-
localRepository
@Parameter(defaultValue="${localRepository}", required=true, readonly=true) private org.apache.maven.artifact.repository.ArtifactRepository localRepositoryArtifactRepository of the localRepository. To obtain the directory of localRepository in unit tests use System.getProperty("localRepository"). -
systemProperties
Deprecated.Use systemPropertyVariables instead.List of System properties to pass to the JUnit tests. -
systemPropertyVariables
List of System properties to pass to the JUnit tests.- Since:
- 2.5
-
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) private Map<String,org.apache.maven.artifact.Artifact> pluginArtifactMapMap of plugin artifacts. -
projectArtifactMap
@Parameter(property="project.artifactMap", readonly=true, required=true) private Map<String,org.apache.maven.artifact.Artifact> projectArtifactMapMap of project artifacts. -
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") private boolean redirectTestOutputToFileSet 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", defaultValue="false") private boolean failIfNoTestsSet this to "true" to cause a failure if there are no tests to run. Defaults to "false".- Since:
- 2.4
-
forkMode
DEPRECATED since version 2.14. UseforkCount
andreuseForks
instead.
Option to specify the forking mode. Can benever
,once
,always
,perthread
.
Thenone
andpertest
are also accepted for backwards compatibility.
Thealways
forks for each test-class.
Theperthread
creates the number of parallel forks specified bythreadCount
, where each forked JVM is executing one test-class. See also the parameterreuseForks
for the lifetime of JVM.- Since:
- 2.1
-
tempDir
Relative path to temporary-surefire-boot directory containing internal Surefire temporary files.
The temporary-surefire-boot directory is project.build.directory on most platforms or system default temporary-directory specified by the system propertyjava.io.tmpdir
on Windows (see SUREFIRE-1400).
It is deleted after the test set has completed.- Since:
- 2.20
-
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
Arbitrary JVM options to set on the command line.
Since the Version 2.17 using an alternate syntax forargLine
, @{...} allows late replacement of properties when the plugin is executed, so properties that have been modified by other plugins will be picked up correctly. See the Frequently Asked Questions page with more details:
http://maven.apache.org/surefire/maven-surefire-plugin/faq.html
http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html- Since:
- 2.1
-
environmentVariables
Additional environment variables to set on the command line.- Since:
- 2.1.3
-
workingDirectory
Command line working directory.- Since:
- 2.1.3
-
childDelegation
@Parameter(property="childDelegation", defaultValue="false") private boolean childDelegationWhen false it makes tests run using the standard classloader delegation instead of the default Maven isolated classloader. Only used when forking (forkMode
is notnone
).
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
(TestNG/JUnit47 provider with JUnit4.8+ only and JUnit5+ provider since 2.22.0) Groups/categories/tags for this test. Only classes/methods/etc decorated with one of the groups/categories/tags specified here will be included in test run, if specified.
For JUnit4 tests, this parameter forces the use of the 4.7 provider. For JUnit5 tests, this parameter forces the use of the JUnit platform provider.
This parameter is ignored if thesuiteXmlFiles
parameter is specified.
Since version 2.18.1 and JUnit 4.12, the@Category
annotation type is automatically inherited from superclasses, see@java.lang.annotation.Inherited
. Make sure that test class inheritance still makes sense together with@Category
annotation of the JUnit 4.12 or higher appeared in superclass.- Since:
- 2.2
-
excludedGroups
(TestNG/JUnit47 provider with JUnit4.8+ only and JUnit5+ provider since 2.22.0) Excluded groups/categories/tags. Any methods/classes/etc with one of the groups/categories/tags specified in this list will specifically not be run.
For JUnit4, this parameter forces the use of the 4.7 provider. For JUnit5, this parameter forces the use of the JUnit platform provider.
This parameter is ignored if thesuiteXmlFiles
parameter is specified.
Since version 2.18.1 and JUnit 4.12, the@Category
annotation type is automatically inherited from superclasses, see@java.lang.annotation.Inherited
. Make sure that test class inheritance still makes sense together with@Category
annotation of the JUnit 4.12 or higher appeared in superclass.- Since:
- 2.2
-
junitArtifactName
@Parameter(property="junitArtifactName", defaultValue="junit:junit") private String junitArtifactNameAllows 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") private String testNGArtifactNameAllows 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") private 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 theparallel
parameter.- Since:
- 2.2
-
forkCount
Option to specify the number of VMs to fork in parallel in order to execute the tests. When terminated with "C", the number part is multiplied with the number of CPU cores. Floating point value are only accepted together with "C". If set to "0", no VM is forked and all tests are executed within the main process.
Example values: "1.5C", "4"
The system properties and theargLine
of the forked processes may contain the place holder string${surefire.forkNumber}
, which is replaced with a fixed number for each of the parallel forks, ranging from 1 to the effective value offorkCount
times the maximum number of parallel Surefire executions in maven parallel builds, i.e. the effective value of the -T command line argument of maven core.- Since:
- 2.14
-
reuseForks
@Parameter(property="reuseForks", defaultValue="true") private boolean reuseForksIndicates if forked VMs can be reused. If set to "false", a new VM is forked for each test class to be executed. If set to "true", up toforkCount
VMs will be forked and then reused to execute all tests.- Since:
- 2.13
-
perCoreThreadCount
@Parameter(property="perCoreThreadCount", defaultValue="true") private boolean perCoreThreadCount(JUnit 4.7 provider) Indicates that threadCount, threadCountSuites, threadCountClasses, threadCountMethods are per cpu core.- Since:
- 2.5
-
useUnlimitedThreads
@Parameter(property="useUnlimitedThreads", defaultValue="false") private boolean useUnlimitedThreads(JUnit 4.7 provider) Indicates that the thread pool will be unlimited. Theparallel
parameter and the actual number of classes/methods will decide. Setting this to "true" effectively disablesperCoreThreadCount
andthreadCount
. Defaults to "false".- Since:
- 2.5
-
parallel
(TestNG provider) When you use the parameterparallel
, 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. Supports two values:classes
ormethods
.
(JUnit 4.7 provider) Supports valuesclasses
,methods
,both
to run in separate threads been controlled bythreadCount
.
Since version 2.16 (JUnit 4.7 provider), the valueboth
is DEPRECATED. UseclassesAndMethods
instead.
Since version 2.16 (JUnit 4.7 provider), additional vales are available:
suites
,suitesAndClasses
,suitesAndMethods
,classesAndMethods
,all
.
By default, Surefire does not execute tests in parallel. You can set the parameterparallel
tonone
to explicitly disable parallel execution (e.g. when disabling parallel execution in special Maven profiles when executing coverage analysis).- Since:
- 2.2
-
parallelOptimized
@Parameter(property="parallelOptimized", defaultValue="true") private boolean parallelOptimized(JUnit 4.7 / provider only) The thread counts do not exceed the number of parallel suite, class runners and average number of methods per class if set to true.
True by default.- Since:
- 2.17
-
threadCountSuites
@Parameter(property="threadCountSuites", defaultValue="0") private int threadCountSuites(JUnit 4.7 provider) This attribute allows you to specify the concurrency in test suites, i.e.:- number of concurrent suites if
threadCount
is 0 or unspecified - limited suites concurrency if
useUnlimitedThreads
is set to true - if
threadCount
and certain thread-count parameters are > 0 forparallel
, the concurrency is computed from ratio. For instanceparallel=all
and the ratio betweenthreadCountSuites
:threadCountClasses
:threadCountMethods
is 2:3:5, there is 20% ofthreadCount
which appeared in concurrent suites.
parallel
parameter. The default value 0 behaves same as unspecified one.- Since:
- 2.16
- number of concurrent suites if
-
threadCountClasses
@Parameter(property="threadCountClasses", defaultValue="0") private int threadCountClasses(JUnit 4.7 provider) This attribute allows you to specify the concurrency in test classes, i.e.:- number of concurrent classes if
threadCount
is 0 or unspecified - limited classes concurrency if
useUnlimitedThreads
is set to true - if
threadCount
and certain thread-count parameters are > 0 forparallel
, the concurrency is computed from ratio. For instanceparallel=all
and the ratio betweenthreadCountSuites
:threadCountClasses
:threadCountMethods
is 2:3:5, there is 30% ofthreadCount
in concurrent classes. - as in the previous case but without this leaf thread-count. Example:
parallel=suitesAndClasses
,threadCount=16
,threadCountSuites=5
,threadCountClasses
is unspecified leaf, the number of concurrent classes is varying from >= 11 to 14 or 15. ThethreadCountSuites
become given number of threads.
parallel
parameter. The default value 0 behaves same as unspecified one.- Since:
- 2.16
- number of concurrent classes if
-
threadCountMethods
@Parameter(property="threadCountMethods", defaultValue="0") private int threadCountMethods(JUnit 4.7 provider) This attribute allows you to specify the concurrency in test methods, i.e.:- number of concurrent methods if
threadCount
is 0 or unspecified - limited concurrency of methods if
useUnlimitedThreads
is set to true - if
threadCount
and certain thread-count parameters are > 0 forparallel
, the concurrency is computed from ratio. For instance parallel=all and the ratio betweenthreadCountSuites
:threadCountClasses
:threadCountMethods
is 2:3:5, there is 50% ofthreadCount
which appears in concurrent methods. - as in the previous case but without this leaf thread-count. Example:
parallel=all
,threadCount=16
,threadCountSuites=2
,threadCountClasses=3
, butthreadCountMethods
is unspecified leaf, the number of concurrent methods is varying from >= 11 to 14 or 15. ThethreadCountSuites
andthreadCountClasses
become given number of threads.
parallel
parameter. The default value 0 behaves same as unspecified one.- Since:
- 2.16
- number of concurrent methods if
-
trimStackTrace
@Parameter(property="trimStackTrace", defaultValue="false") private boolean trimStackTraceWhether to trim the stack trace in the reports to just the lines within the test, or show the full trace.- Since:
- 2.2
-
remoteRepositories
@Parameter(defaultValue="${project.pluginArtifactRepositories}", readonly=true, required=true) private List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositoriesThe remote plugin repositories declared in the POM.- Since:
- 2.2
-
projectRemoteRepositories
@Parameter(defaultValue="${project.remoteArtifactRepositories}", required=true, readonly=true) private List<org.apache.maven.artifact.repository.ArtifactRepository> projectRemoteRepositories -
disableXmlReport
@Deprecated @Parameter(property="disableXmlReport", defaultValue="false") private boolean disableXmlReportDeprecated.Flag to disable the generation of report files in xml format. Deprecated since 3.0.0-M4. Instead use disable withinstatelessTestsetReporter
since of 3.0.0-M6.- Since:
- 2.2
-
enableAssertions
@Parameter(property="enableAssertions", defaultValue="true") private boolean enableAssertionsBy 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
@Parameter(defaultValue="${session}", required=true, readonly=true) private org.apache.maven.execution.MavenSession sessionThe current build session instance. -
logger
@Component private org.codehaus.plexus.logging.Logger logger -
objectFactory
(TestNG only) Define the factory class used to create all test instances.- Since:
- 2.5
-
parallelMavenExecution
@Parameter(defaultValue="${session.parallel}", readonly=true) private Boolean parallelMavenExecutionParallel Maven Execution. -
projectBuildDirectory
@Parameter(defaultValue="${project.build.directory}", readonly=true, required=true) private File projectBuildDirectoryRead-only parameter with value of Maven property project.build.directory.- Since:
- 2.20
-
dependenciesToScan
List of dependencies to scan for test classes to include in the test run. The child elements of this element must be <dependency> elements, and the contents of each of these elements must be a string which follows the general form:groupId[:artifactId[:type[:classifier][:version]]]
The wildcard character
*
can be used within the sub parts of those composite identifiers to do glob-like pattern matching. The classifier may be omitted when matching dependencies without a classifier.Examples:
group
or, equivalently,group:*
g*p:*rtifac*
group:*:jar
group:artifact:*:1.0.0
(no classifier)group:*:test-jar:tests
*:artifact:*:*:1.0.0
Since version 2.22.0 you can scan for test classes from a project dependency of your multi-module project.
In versions before 3.0.0-M4, only
groupId:artifactId
is supported.- Since:
- 2.15
-
jdkToolchain
Allow for configuration of the test jvm via maven toolchains. This permits a configuration where the project is built with one jvm and tested with another. This is similar to
jvm
, but avoids hardcoding paths. The two parameters are mutually exclusive (jvm wins)Examples:
(see Guide to Toolchains for more info)<configuration> ... <jdkToolchain> <version>1.11</version> </jdkToolchain> </configuration> <configuration> ... <jdkToolchain> <version>1.8</version> <vendor>zulu</vendor> </jdkToolchain> </configuration>
- Since:
- 3.0.0-M5 and Maven 3.3.x
-
toolchainManager
@Component private org.apache.maven.toolchain.ToolchainManager toolchainManager -
locationManager
@Component private org.codehaus.plexus.languages.java.jpms.LocationManager locationManager -
repositorySystem
@Component private org.apache.maven.repository.RepositorySystem repositorySystem -
providerDetector
-
resolutionErrorHandler
@Component private org.apache.maven.artifact.resolver.ResolutionErrorHandler resolutionErrorHandler -
toolchain
private org.apache.maven.toolchain.Toolchain toolchain -
effectiveForkCount
private int effectiveForkCount -
surefireDependencyResolver
-
specificTests
-
includedExcludedTests
-
cli
-
consoleLogger
-
-
Constructor Details
-
AbstractSurefireMojo
public AbstractSurefireMojo()
-
-
Method Details
-
getPluginName
-
getRerunFailingTestsCount
protected abstract int getRerunFailingTestsCount() -
getIncludes
- Specified by:
getIncludes
in interfaceSurefireExecutionParameters
-
getIncludesFile
-
setIncludes
- Specified by:
setIncludes
in interfaceSurefireExecutionParameters
-
getExcludesFile
-
suiteXmlFiles
- Returns:
- list of TestNG suite XML files provided by MOJO
-
hasSuiteXmlFiles
protected abstract boolean hasSuiteXmlFiles()- Returns:
true
ifsuite-xml files array
is not empty.
-
getExcludedEnvironmentVariables
-
getSuiteXmlFiles
-
setSuiteXmlFiles
-
getRunOrder
-
setRunOrder
-
getRunOrderRandomSeed
-
setRunOrderRandomSeed
-
handleSummary
protected abstract void handleSummary(RunResult summary, Exception firstForkException) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException - Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
isSkipExecution
protected abstract boolean isSkipExecution() -
getDefaultIncludes
-
getReportSchemaLocation
-
useModulePath
protected abstract boolean useModulePath() -
setUseModulePath
protected abstract void setUseModulePath(boolean useModulePath) -
getEnableProcessChecker
-
getForkNode
-
getMojoArtifact
protected org.apache.maven.artifact.Artifact getMojoArtifact()This plugin MOJO artifact.- Returns:
- non-null plugin artifact
-
getDefaultExcludes
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Specified by:
execute
in interfaceorg.apache.maven.plugin.Mojo
- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
setLogger
void setLogger(org.codehaus.plexus.logging.Logger logger) -
getConsoleLogger
-
getToolchainMaven33x
private static <T extends org.apache.maven.toolchain.ToolchainManager> org.apache.maven.toolchain.Toolchain getToolchainMaven33x(Class<T> toolchainManagerType, T toolchainManager, org.apache.maven.execution.MavenSession session, Map<String, String> toolchainArgs) throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
getToolchain
private org.apache.maven.toolchain.Toolchain getToolchain() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
setupStuff
private void setupStuff() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
scanForTestClasses
@Nonnull private DefaultScanResult scanForTestClasses() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
scanDirectories
- Throws:
org.apache.maven.plugin.MojoFailureException
-
getProjectTestArtifacts
List<org.apache.maven.artifact.Artifact> getProjectTestArtifacts() -
scanDependencies
- Throws:
org.apache.maven.plugin.MojoFailureException
-
verifyParameters
boolean verifyParameters() throws org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
-
warnIfForkCountIsZero
private void warnIfForkCountIsZero() -
executeAfterPreconditionsChecked
private void executeAfterPreconditionsChecked(@Nonnull DefaultScanResult scanResult, @Nonnull Platform platform) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException - Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
createProviders
protected List<ProviderInfo> createProviders(TestClassPath testClasspath) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
setupProperties
-
systemPropertiesMatchingArgLine
-
showToLog
-
executeProvider
@Nonnull private RunResult executeProvider(@Nonnull ProviderInfo provider, @Nonnull DefaultScanResult scanResult, @Nonnull TestClassPath testClasspathWrapper, @Nonnull Platform platform, @Nonnull ResolvePathResultWrapper resolvedJavaModularityResult) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException, SurefireExecutionException, SurefireBooterForkException, TestSetFailedException - Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
SurefireExecutionException
SurefireBooterForkException
TestSetFailedException
-
createCopyAndReplaceForkNumPlaceholder
public static SurefireProperties createCopyAndReplaceForkNumPlaceholder(SurefireProperties effectiveSystemProperties, int threadNumber) -
cleanupForkConfiguration
-
logReportsDirectory
protected void logReportsDirectory() -
getRepositorySystem
public org.apache.maven.repository.RepositorySystem getRepositorySystem() -
setRepositorySystem
public void setRepositorySystem(org.apache.maven.repository.RepositorySystem repositorySystem) -
existsModuleDescriptor
-
findModuleDescriptor
-
findModuleDescriptor
private ResolvePathResultWrapper findModuleDescriptor(File jdkHome, File buildPath, boolean isMainDescriptor) -
isModule
-
canExecuteProviderWithModularPath
private boolean canExecuteProviderWithModularPath(@Nonnull Platform platform, @Nonnull ResolvePathResultWrapper resolvedJavaModularityResult) -
convertTestNGParameters
private void convertTestNGParameters() throws org.apache.maven.plugin.MojoExecutionExceptionConverts old TestNG configuration parameters over to new properties based configuration method. (if any are defined the old way)- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getConfiguratorName
private static String getConfiguratorName(org.apache.maven.artifact.versioning.ArtifactVersion version, PluginConsoleLogger log) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
convertGroupParameters
private void convertGroupParameters() -
convertJunitEngineParameters
private void convertJunitEngineParameters() -
join
-
isAnyConcurrencySelected
protected boolean isAnyConcurrencySelected() -
isAnyGroupsSelected
protected boolean isAnyGroupsSelected() -
convertJunitCoreParameters
private void convertJunitCoreParameters() throws org.apache.maven.plugin.MojoExecutionExceptionConverts old JUnit configuration parameters over to new properties based configuration method. (if any are defined the old way)- Throws:
org.apache.maven.plugin.MojoExecutionException
-
checkNonForkedThreads
private void checkNonForkedThreads(String parallel) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
onlyThreadCount
private boolean onlyThreadCount() -
checkThreadCountEntity
private static void checkThreadCountEntity(int count, String entity) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
isJunit47Compatible
private boolean isJunit47Compatible(org.apache.maven.artifact.Artifact artifact) -
isAnyJunit4
private boolean isAnyJunit4(org.apache.maven.artifact.Artifact artifact) -
isForkModeNever
-
isForking
protected boolean isForking() -
getEffectiveForkMode
String getEffectiveForkMode() -
getRunOrders
-
requiresRunHistory
private boolean requiresRunHistory() -
getEffectiveFailIfNoTests
-
createProviderConfiguration
private ProviderConfiguration createProviderConfiguration(RunOrderParameters runOrderParameters) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException - Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
toStringProperties
-
getStatisticsFile
-
createStartupConfiguration
private StartupConfiguration createStartupConfiguration(@Nonnull ProviderInfo provider, boolean isForking, @Nonnull ClassLoaderConfiguration classLoaderConfiguration, @Nonnull DefaultScanResult scanResult, @Nonnull TestClassPath testClasspathWrapper, @Nonnull Platform platform, @Nonnull ResolvePathResultWrapper resolvedJavaModularity) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
newStartupConfigWithClasspath
private StartupConfiguration newStartupConfigWithClasspath(@Nonnull ClassLoaderConfiguration classLoaderConfiguration, @Nonnull ProviderInfo providerInfo, @Nonnull TestClassPath testClasspathWrapper) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
retainInProcArtifactsUnique
-
hasGroupArtifactId
-
createInProcClasspath
-
getLocationManager
private org.codehaus.plexus.languages.java.jpms.LocationManager getLocationManager()For testing purposes - Mockito.- Returns:
- plexus component
-
newStartupConfigWithModularPath
private StartupConfiguration newStartupConfigWithModularPath(@Nonnull ClassLoaderConfiguration classLoaderConfiguration, @Nonnull ProviderInfo providerInfo, @Nonnull ResolvePathResultWrapper moduleDescriptor, @Nonnull DefaultScanResult scanResult, @Nonnull String javaHome, @Nonnull TestClassPath testClasspathWrapper) throws org.apache.maven.plugin.MojoExecutionException, IOException - Throws:
org.apache.maven.plugin.MojoExecutionException
IOException
-
getCommonArtifact
private org.apache.maven.artifact.Artifact getCommonArtifact() -
getExtensionsArtifact
private org.apache.maven.artifact.Artifact getExtensionsArtifact() -
getSpiArtifact
private org.apache.maven.artifact.Artifact getSpiArtifact() -
getApiArtifact
private org.apache.maven.artifact.Artifact getApiArtifact() -
getLoggerApiArtifact
private org.apache.maven.artifact.Artifact getLoggerApiArtifact() -
getBooterArtifact
private org.apache.maven.artifact.Artifact getBooterArtifact() -
getShadefireArtifact
private org.apache.maven.artifact.Artifact getShadefireArtifact() -
getStartupReportConfiguration
private StartupReportConfiguration getStartupReportConfiguration(String configChecksum, boolean isForkMode) -
isSpecificTestSpecified
private boolean isSpecificTestSpecified() -
readListFromFile
-
getExcludedScanList
@Nonnull private List<String> getExcludedScanList() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
getExcludeList
- Throws:
org.apache.maven.plugin.MojoFailureException
-
getExcludeList
@Nonnull private List<String> getExcludeList(boolean asScanList) throws org.apache.maven.plugin.MojoFailureException Computes a merge list of test exclusions. Used only ingetExcludeList()
andgetExcludedScanList()
.- Parameters:
asScanList
- true if dependency or directory scanner- Returns:
- list of patterns
- Throws:
org.apache.maven.plugin.MojoFailureException
- if the excludes breaks a pattern format
-
getIncludedScanList
@Nonnull private List<String> getIncludedScanList() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
getIncludeList
- Throws:
org.apache.maven.plugin.MojoFailureException
-
getIncludeList
@Nonnull private List<String> getIncludeList(boolean asScanList) throws org.apache.maven.plugin.MojoFailureException Computes a merge list of test inclusions. Used only ingetIncludeList()
andgetIncludedScanList()
.- Parameters:
asScanList
- true if dependency or directory scanner- Returns:
- list of patterns
- Throws:
org.apache.maven.plugin.MojoFailureException
- if the includes breaks a pattern format
-
checkMethodFilterInIncludesExcludes
private void checkMethodFilterInIncludesExcludes(Iterable<String> patterns) throws org.apache.maven.plugin.MojoFailureException - Throws:
org.apache.maven.plugin.MojoFailureException
-
getIncludedAndExcludedTests
private TestListResolver getIncludedAndExcludedTests() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
getSpecificTests
- Throws:
org.apache.maven.plugin.MojoFailureException
-
filterNulls
-
getTestNgArtifact
private org.apache.maven.artifact.Artifact getTestNgArtifact() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
createVersionRange
private org.apache.maven.artifact.versioning.VersionRange createVersionRange() -
getJunitArtifact
private org.apache.maven.artifact.Artifact getJunitArtifact() -
getJunitDepArtifact
private org.apache.maven.artifact.Artifact getJunitDepArtifact() -
getJUnitPlatformRunnerArtifact
private org.apache.maven.artifact.Artifact getJUnitPlatformRunnerArtifact() -
getJUnit5Artifact
private org.apache.maven.artifact.Artifact getJUnit5Artifact() -
createForkStarter
private ForkStarter createForkStarter(@Nonnull ProviderInfo provider, @Nonnull ForkConfiguration forkConfiguration, @Nonnull ClassLoaderConfiguration classLoaderConfiguration, @Nonnull RunOrderParameters runOrderParameters, @Nonnull ConsoleLogger log, @Nonnull DefaultScanResult scanResult, @Nonnull TestClassPath testClasspathWrapper, @Nonnull Platform platform, @Nonnull ResolvePathResultWrapper resolvedJavaModularityResult) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException - Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
createInprocessStarter
private InPluginVMSurefireStarter createInprocessStarter(@Nonnull ProviderInfo provider, @Nonnull ClassLoaderConfiguration classLoaderConfig, @Nonnull RunOrderParameters runOrderParameters, @Nonnull DefaultScanResult scanResult, @Nonnull Platform platform, @Nonnull TestClassPath testClasspathWrapper) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException - Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
getForkNodeFactory
-
createForkConfiguration
@Nonnull private ForkConfiguration createForkConfiguration(@Nonnull Platform platform, @Nonnull ResolvePathResultWrapper resolvedJavaModularityResult) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
ensureEnableProcessChecker
private void ensureEnableProcessChecker() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
convertDeprecatedForkMode
private void convertDeprecatedForkMode() -
getEffectiveForkCount
protected int getEffectiveForkCount() -
convertWithCoreCount
-
getEffectiveDebugForkedProcess
-
getEffectiveJvm
- Throws:
org.apache.maven.plugin.MojoFailureException
-
getSurefireTempDir
File getSurefireTempDir()Where surefire stores its own temp files- Returns:
- A file pointing to the location of surefire's own temp files
-
getConfigChecksum
Operates on raw plugin parameters, not the "effective" values.- Returns:
- The checksum
-
addPluginSpecificChecksumItems
-
hasExecutedBefore
protected boolean hasExecutedBefore() -
getClassLoaderConfiguration
-
generateTestClasspath
Generates the test classpath.- Returns:
- the classpath elements
-
filterArtifacts
private static Set<org.apache.maven.artifact.Artifact> filterArtifacts(Set<org.apache.maven.artifact.Artifact> artifacts, org.apache.maven.artifact.resolver.filter.ArtifactFilter filter) Return a new set containing only the artifacts accepted by the given filter.- Parameters:
artifacts
- The unfiltered artifactsfilter
- The filter to apply- Returns:
- The filtered result
-
showMap
-
showArray
-
getArtifactClasspath
private Classpath getArtifactClasspath(org.apache.maven.artifact.Artifact surefireArtifact) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
getUserProperties
-
ensureWorkingDirectoryExists
private void ensureWorkingDirectoryExists() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
ensureParallelRunningCompatibility
private void ensureParallelRunningCompatibility() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
ensureThreadCountWithPerThread
private void ensureThreadCountWithPerThread() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
warnIfUselessUseSystemClassLoaderParameter
private void warnIfUselessUseSystemClassLoaderParameter() -
isNotForking
private boolean isNotForking() -
commandLineOptions
-
warnIfDefunctGroupsCombinations
private void warnIfDefunctGroupsCombinations() throws org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
-
warnIfRerunClashes
private void warnIfRerunClashes() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
warnIfWrongShutdownValue
private void warnIfWrongShutdownValue() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
warnIfNotApplicableSkipAfterFailureCount
private void warnIfNotApplicableSkipAfterFailureCount() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
warnIfIllegalTempDir
private void warnIfIllegalTempDir() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
warnIfIllegalFailOnFlakeCount
protected void warnIfIllegalFailOnFlakeCount() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
printDefaultSeedIfNecessary
private void printDefaultSeedIfNecessary() -
createSurefireBootDirectoryInBuild
File createSurefireBootDirectoryInBuild() -
createSurefireBootDirectoryInTemp
File createSurefireBootDirectoryInTemp() -
getLocalRepository
public org.apache.maven.artifact.repository.ArtifactRepository getLocalRepository()- Specified by:
getLocalRepository
in interfaceSurefireExecutionParameters
-
setLocalRepository
public void setLocalRepository(org.apache.maven.artifact.repository.ArtifactRepository localRepository) - Specified by:
setLocalRepository
in interfaceSurefireExecutionParameters
-
getSystemProperties
-
setSystemProperties
-
getSystemPropertyVariables
-
setSystemPropertyVariables
-
getSystemPropertiesFile
List of System properties, loaded from a file, to pass to the JUnit tests.- Since:
- 2.8.2
-
setSystemPropertiesFile
-
getProperties
-
setProperties
-
getPluginArtifactMap
-
setPluginArtifactMap
-
getProjectArtifactMap
-
setProjectArtifactMap
-
getReportNameSuffix
-
setReportNameSuffix
-
isRedirectTestOutputToFile
public boolean isRedirectTestOutputToFile() -
setRedirectTestOutputToFile
public void setRedirectTestOutputToFile(boolean redirectTestOutputToFile) -
getFailIfNoTests
public boolean getFailIfNoTests() -
setFailIfNoTests
public void setFailIfNoTests(boolean failIfNoTests) -
getForkMode
-
setForkMode
-
getJvm
-
getArgLine
-
setArgLine
-
getEnvironmentVariables
-
setEnvironmentVariables
-
getWorkingDirectory
-
setWorkingDirectory
-
isChildDelegation
public boolean isChildDelegation() -
setChildDelegation
public void setChildDelegation(boolean childDelegation) -
getGroups
-
setGroups
-
getExcludedGroups
-
setExcludedGroups
-
getJunitArtifactName
-
setJunitArtifactName
-
getTestNGArtifactName
-
setTestNGArtifactName
-
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
-
setParallel
-
isParallelOptimized
public boolean isParallelOptimized() -
setParallelOptimized
public void setParallelOptimized(boolean parallelOptimized) -
getThreadCountSuites
public int getThreadCountSuites() -
setThreadCountSuites
public void setThreadCountSuites(int threadCountSuites) -
getThreadCountClasses
public int getThreadCountClasses() -
setThreadCountClasses
public void setThreadCountClasses(int threadCountClasses) -
getThreadCountMethods
public int getThreadCountMethods() -
setThreadCountMethods
public void setThreadCountMethods(int threadCountMethods) -
isTrimStackTrace
public boolean isTrimStackTrace() -
setTrimStackTrace
public void setTrimStackTrace(boolean trimStackTrace) -
getProjectRemoteRepositories
-
setProjectRemoteRepositories
public void setProjectRemoteRepositories(List<org.apache.maven.artifact.repository.ArtifactRepository> projectRemoteRepositories) -
getRemoteRepositories
-
setRemoteRepositories
public void setRemoteRepositories(List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories) -
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 org.apache.maven.execution.MavenSession getSession() -
setSession
public void setSession(org.apache.maven.execution.MavenSession session) -
getObjectFactory
-
setObjectFactory
-
getToolchainManager
public org.apache.maven.toolchain.ToolchainManager getToolchainManager() -
setToolchainManager
public void setToolchainManager(org.apache.maven.toolchain.ToolchainManager toolchainManager) -
isMavenParallel
public boolean isMavenParallel() -
getDependenciesToScan
-
setDependenciesToScan
-
setPluginDescriptor
void setPluginDescriptor(org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor) -
getPluginDescriptor
public org.apache.maven.plugin.descriptor.PluginDescriptor getPluginDescriptor() -
getProject
public org.apache.maven.project.MavenProject getProject() -
setProject
public void setProject(org.apache.maven.project.MavenProject project) -
getTestSourceDirectory
- Specified by:
getTestSourceDirectory
in interfaceSurefireExecutionParameters
-
setTestSourceDirectory
- Specified by:
setTestSourceDirectory
in interfaceSurefireExecutionParameters
-
getForkCount
-
isReuseForks
public boolean isReuseForks() -
getAdditionalClasspathElements
-
setAdditionalClasspathElements
-
getClasspathDependencyExcludes
-
setClasspathDependencyExcludes
-
getClasspathDependencyScopeExclude
-
setClasspathDependencyScopeExclude
-
getProjectBuildDirectory
-
setProjectBuildDirectory
-
logDebugOrCliShowErrors
-
getJdkToolchain
-
setJdkToolchain
-
getTempDir
-
setTempDir
-
setResolutionErrorHandler
public void setResolutionErrorHandler(org.apache.maven.artifact.resolver.ResolutionErrorHandler resolutionErrorHandler) -
getEffectiveForkMode
-