Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.plugin.surefire;
import javax.annotation.Nonnull;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Properties;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.zip.ZipFile;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugin.surefire.booterclient.ChecksumCalculator;
import org.apache.maven.plugin.surefire.booterclient.ClasspathForkConfiguration;
import org.apache.maven.plugin.surefire.booterclient.ForkConfiguration;
import org.apache.maven.plugin.surefire.booterclient.ForkStarter;
import org.apache.maven.plugin.surefire.booterclient.JarManifestForkConfiguration;
import org.apache.maven.plugin.surefire.booterclient.ModularClasspathForkConfiguration;
import org.apache.maven.plugin.surefire.booterclient.Platform;
import org.apache.maven.plugin.surefire.extensions.LegacyForkNodeFactory;
import org.apache.maven.plugin.surefire.extensions.SurefireConsoleOutputReporter;
import org.apache.maven.plugin.surefire.extensions.SurefireStatelessReporter;
import org.apache.maven.plugin.surefire.extensions.SurefireStatelessTestsetInfoReporter;
import org.apache.maven.plugin.surefire.log.PluginConsoleLogger;
import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
import org.apache.maven.plugin.surefire.util.DependencyScanner;
import org.apache.maven.plugin.surefire.util.DirectoryScanner;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter;
import org.apache.maven.surefire.api.booter.ProviderParameterNames;
import org.apache.maven.surefire.api.booter.Shutdown;
import org.apache.maven.surefire.api.cli.CommandLineOption;
import org.apache.maven.surefire.api.report.ReporterConfiguration;
import org.apache.maven.surefire.api.suite.RunResult;
import org.apache.maven.surefire.api.testset.DirectoryScannerParameters;
import org.apache.maven.surefire.api.testset.RunOrderParameters;
import org.apache.maven.surefire.api.testset.TestArtifactInfo;
import org.apache.maven.surefire.api.testset.TestListResolver;
import org.apache.maven.surefire.api.testset.TestRequest;
import org.apache.maven.surefire.api.testset.TestSetFailedException;
import org.apache.maven.surefire.api.util.DefaultScanResult;
import org.apache.maven.surefire.api.util.RunOrder;
import org.apache.maven.surefire.booter.ClassLoaderConfiguration;
import org.apache.maven.surefire.booter.Classpath;
import org.apache.maven.surefire.booter.ClasspathConfiguration;
import org.apache.maven.surefire.booter.KeyValueSource;
import org.apache.maven.surefire.booter.ModularClasspath;
import org.apache.maven.surefire.booter.ModularClasspathConfiguration;
import org.apache.maven.surefire.booter.ProcessCheckerType;
import org.apache.maven.surefire.booter.ProviderConfiguration;
import org.apache.maven.surefire.booter.StartupConfiguration;
import org.apache.maven.surefire.booter.SurefireBooterForkException;
import org.apache.maven.surefire.booter.SurefireExecutionException;
import org.apache.maven.surefire.extensions.ForkNodeFactory;
import org.apache.maven.surefire.providerapi.ConfigurableProviderInfo;
import org.apache.maven.surefire.providerapi.ProviderDetector;
import org.apache.maven.surefire.providerapi.ProviderInfo;
import org.apache.maven.surefire.providerapi.ProviderRequirements;
import org.apache.maven.surefire.shared.utils.io.FileUtils;
import org.apache.maven.toolchain.DefaultToolchain;
import org.apache.maven.toolchain.Toolchain;
import org.apache.maven.toolchain.ToolchainManager;
import org.apache.maven.toolchain.java.DefaultJavaToolChain;
import org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor;
import org.codehaus.plexus.languages.java.jpms.LocationManager;
import org.codehaus.plexus.languages.java.jpms.ResolvePathRequest;
import org.codehaus.plexus.languages.java.jpms.ResolvePathResult;
import org.codehaus.plexus.languages.java.jpms.ResolvePathsRequest;
import org.codehaus.plexus.languages.java.jpms.ResolvePathsResult;
import org.codehaus.plexus.logging.Logger;
import static java.lang.Integer.parseInt;
import static java.util.Arrays.asList;
import static java.util.Collections.addAll;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static java.util.Collections.singletonMap;
import static org.apache.maven.plugin.surefire.AbstractSurefireMojo.PluginFailureReason.COULD_NOT_RUN_DEFAULT_TESTS;
import static org.apache.maven.plugin.surefire.AbstractSurefireMojo.PluginFailureReason.COULD_NOT_RUN_SPECIFIED_TESTS;
import static org.apache.maven.plugin.surefire.AbstractSurefireMojo.PluginFailureReason.NONE;
import static org.apache.maven.plugin.surefire.SurefireDependencyResolver.isWithinVersionSpec;
import static org.apache.maven.plugin.surefire.SurefireHelper.replaceThreadNumberPlaceholders;
import static org.apache.maven.plugin.surefire.util.DependencyScanner.filter;
import static org.apache.maven.surefire.api.booter.ProviderParameterNames.EXCLUDE_JUNIT5_ENGINES_PROP;
import static org.apache.maven.surefire.api.booter.ProviderParameterNames.INCLUDE_JUNIT5_ENGINES_PROP;
import static org.apache.maven.surefire.api.suite.RunResult.failure;
import static org.apache.maven.surefire.api.suite.RunResult.noTestsRun;
import static org.apache.maven.surefire.api.util.ReflectionUtils.invokeMethodWithArray;
import static org.apache.maven.surefire.api.util.ReflectionUtils.tryGetMethod;
import static org.apache.maven.surefire.booter.Classpath.emptyClasspath;
import static org.apache.maven.surefire.booter.SystemUtils.endsWithJavaPath;
import static org.apache.maven.surefire.booter.SystemUtils.isBuiltInJava9AtLeast;
import static org.apache.maven.surefire.booter.SystemUtils.isJava9AtLeast;
import static org.apache.maven.surefire.booter.SystemUtils.toJdkHomeFromJvmExec;
import static org.apache.maven.surefire.booter.SystemUtils.toJdkVersionFromReleaseFile;
import static org.apache.maven.surefire.shared.lang3.JavaVersion.JAVA_RECENT;
import static org.apache.maven.surefire.shared.lang3.StringUtils.substringBeforeLast;
import static org.apache.maven.surefire.shared.lang3.SystemUtils.IS_OS_WINDOWS;
import static org.apache.maven.surefire.shared.utils.StringUtils.capitalizeFirstLetter;
import static org.apache.maven.surefire.shared.utils.StringUtils.isEmpty;
import static org.apache.maven.surefire.shared.utils.StringUtils.isNotBlank;
import static org.apache.maven.surefire.shared.utils.StringUtils.isNotEmpty;
import static org.apache.maven.surefire.shared.utils.StringUtils.split;
import static org.apache.maven.surefire.shared.utils.cli.ShutdownHookUtils.addShutDownHook;
import static org.apache.maven.surefire.shared.utils.cli.ShutdownHookUtils.removeShutdownHook;
/**
* Abstract base class for running tests using Surefire.
*
* @author Stephen Connolly
* @version $Id: SurefirePlugin.java 945065 2010-05-17 10:26:22Z stephenc $
*/
public abstract class AbstractSurefireMojo extends AbstractMojo implements SurefireExecutionParameters {
private static final Map JAVA_9_MATCHER_OLD_NOTATION = singletonMap("version", "[1.9,)");
private static final Map JAVA_9_MATCHER = singletonMap("version", "[9,)");
private static final Platform PLATFORM = new Platform();
private final ClasspathCache classpathCache = new ClasspathCache();
/**
* Note: use the legacy system property disableXmlReport set to {@code true} to disable the report.
*/
@Parameter
private SurefireStatelessReporter statelessTestsetReporter;
@Parameter
private SurefireConsoleOutputReporter consoleOutputReporter;
@Parameter
private SurefireStatelessTestsetInfoReporter statelessTestsetInfoReporter;
/**
* Information about this plugin, mainly used to lookup this plugin's configuration from the currently executing
* project.
*
* @since 2.12
*/
@Parameter(defaultValue = "${plugin}", readonly = true, required = true)
private PluginDescriptor pluginDescriptor;
/**
* Set 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 parameter {@code skipTests} 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
*/
@Parameter(property = "skipTests", defaultValue = "false")
protected boolean skipTests;
/**
* This old parameter is just like {@code skipTests}, but bound to the old property "maven.test.skip.exec".
*
* @since 2.3
* @deprecated Use skipTests instead.
*/
@Deprecated
@Parameter(property = "maven.test.skip.exec")
protected boolean skipExec;
/**
* 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 {@code skipTests} parameter instead.
*/
@Parameter(property = "maven.test.skip", defaultValue = "false")
protected boolean skip;
/**
* The Maven Project Object.
*/
@Parameter(defaultValue = "${project}", required = true, readonly = true)
private MavenProject project;
/**
* The base directory of the project being tested. This can be obtained in your integration test via
* System.getProperty("basedir").
*/
@Parameter(defaultValue = "${basedir}", readonly = true, required = true)
protected File basedir;
/**
* The directory containing generated test classes of the project being tested. This will be included at the
* beginning of the test classpath.
*/
@Parameter(defaultValue = "${project.build.testOutputDirectory}")
protected File testClassesDirectory;
/**
* List of dependencies to exclude from the test classpath at runtime.
* Each item is passed as pattern to {@link PatternIncludesArtifactFilter}.
* The pattern is matched against the following artifact ids:
*
* The matching algorithm is described in detail in Advanced Artifact-Matching for the maven-assembly-plugin. This parameter behaves the same as the {@code excludes} pattern described there.
* The dependency matching is applied to the project dependency IDs (including transitive ones) after resolving, i.e. excluding
* one dependency will not exclude its transitive dependencies!
* @since 2.6
*/
@Parameter(property = "maven.test.dependency.excludes")
private String[] classpathDependencyExcludes;
/**
* A dependency scope to exclude from the test classpath at runtime. The scope should be one of the scopes defined by
* org.apache.maven.artifact.Artifact. This includes the following:
*
*
*
* @since 2.6
*/
@Parameter(defaultValue = "")
private String classpathDependencyScopeExclude;
/**
* Additional elements to be appended to the test classpath at runtime.
* Each element must be a file system path to a JAR file or a directory containing classes.
* No wildcards are allowed here.
*
* @since 2.4
*/
@Parameter(property = "maven.test.additionalClasspath")
private String[] additionalClasspathElements;
/**
* Additional Maven dependencies to be added to the test classpath at runtime.
* Each element supports the parametrization like documented in POM Reference: Dependencies.
*
* Those dependencies are automatically collected (i.e. have their full dependency tree calculated) and then all underlying artifacts are resolved from the repository (including their transitive dependencies).
* Afterwards the resolved artifacts are filtered to only contain {@code compile} and {@code runtime} scoped ones and appended to the test classpath at runtime
* (after the ones from {@link #additionalClasspathElements}).
*
* The following differences to regular project dependency resolving apply:
*
*
The dependency management from the project is not taken into account.
*
Conflicts between the different items and the project dependencies are not resolved.
*
Only external dependencies (outside the current Maven reactor) are supported.
*
*
* @since 3.2
*/
@Parameter(property = "maven.test.additionalClasspathDependencies")
private List additionalClasspathDependencies;
/**
* The test source directory containing test class sources.
* Important only for TestNG HTML reports.
*
* @since 2.2
*/
@Parameter(defaultValue = "${project.build.testSourceDirectory}")
private File testSourceDirectory;
/**
* List of System properties to pass to a provider.
*
* @deprecated Use systemPropertyVariables instead.
*/
@Deprecated
@Parameter
private Properties systemProperties;
/**
* List of System properties to pass to a provider.
*
* @since 2.5
*/
@Parameter
private Map systemPropertyVariables;
/**
* List of properties for configuring all TestNG related configurations. This is the new preferred method of
* configuring TestNG.
*
* @since 2.4
*/
@Parameter
private Properties properties;
/**
* Map of plugin artifacts.
*/
@Parameter(property = "plugin.artifactMap", required = true, readonly = true)
private Map pluginArtifactMap;
/**
* Map of project artifacts.
*/
@Parameter(property = "project.artifactMap", readonly = true, required = true)
private Map projectArtifactMap;
/**
* 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.
*/
@Parameter(property = "surefire.reportNameSuffix", defaultValue = "")
private String reportNameSuffix;
/**
* Set this to "true" to redirect the unit test standard output to a file (found in
* reportsDirectory/testName-output.txt).
*
* @since 2.3
*/
@Parameter(property = "maven.test.redirectTestOutputToFile", defaultValue = "false")
private boolean redirectTestOutputToFile;
/**
* Set this to "true" to cause a failure if there are no tests to run. Defaults to "false".
*
* @since 2.4
*/
@Parameter(property = "failIfNoTests", defaultValue = "false")
private boolean failIfNoTests;
/**
* 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 property {@code java.io.tmpdir}
* on Windows (see SUREFIRE-1400).
*
* It is deleted after the test set has completed.
*
* @since 2.20
*/
@Parameter(property = "tempDir", defaultValue = "surefire")
private String tempDir;
/**
* 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
*/
@Parameter(property = "jvm")
private String jvm;
/**
* Arbitrary JVM options to set on the command line.
*
*
* Since the Version 2.17 using an alternate syntax for {@code argLine}, @{...} 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
*/
@Parameter(property = "argLine")
private String argLine;
/**
* Additional environment variables to set on the command line.
*
* @since 2.1.3
*/
@Parameter
private Map environmentVariables = new HashMap<>();
/**
* Command line working directory.
*
* @since 2.1.3
*/
@Parameter(property = "basedir")
private File workingDirectory;
/**
* When false it makes tests run using the standard classloader delegation instead of the default Maven isolated
* classloader. Only used when forking ({@code forkCount} is greater than zero).
* 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
*/
@Parameter(property = "childDelegation", defaultValue = "false")
private boolean childDelegation;
/**
* (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 the {@code suiteXmlFiles} parameter is specified.
* Since version 2.18.1 and JUnit 4.12, the {@code @Category} annotation type is automatically inherited from
* superclasses, see {@code @java.lang.annotation.Inherited}. Make sure that test class inheritance still makes
* sense together with {@code @Category} annotation of the JUnit 4.12 or higher appeared in superclass.
*
* @since 2.2
*/
@Parameter(property = "groups")
private String groups;
/**
* (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 the {@code suiteXmlFiles} parameter is specified.
* Since version 2.18.1 and JUnit 4.12, the {@code @Category} annotation type is automatically inherited from
* superclasses, see {@code @java.lang.annotation.Inherited}. Make sure that test class inheritance still makes
* sense together with {@code @Category} annotation of the JUnit 4.12 or higher appeared in superclass.
*
* @since 2.2
*/
@Parameter(property = "excludedGroups")
private String excludedGroups;
/**
* Allows you to specify the name of the JUnit artifact. If not set, {@code junit:junit} will be used.
*
* @since 2.3.1
*/
@Parameter(property = "junitArtifactName", defaultValue = "junit:junit")
private String junitArtifactName;
/**
* Allows you to specify the name of the TestNG artifact. If not set, {@code org.testng:testng} will be used.
*
* @since 2.3.1
*/
@Parameter(property = "testNGArtifactName", defaultValue = "org.testng:testng")
private String testNGArtifactName;
/**
* (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 {@code parallel} parameter.
*
* @since 2.2
*/
@Parameter(property = "threadCount")
private int threadCount;
/**
* 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 the {@code argLine} 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 of {@code forkCount} 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
*/
@Parameter(property = "forkCount", defaultValue = "1")
private String forkCount;
/**
* Indicates 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 to {@code forkCount} VMs will be forked and then reused to execute all tests.
*
* @since 2.13
*/
@Parameter(property = "reuseForks", defaultValue = "true")
private boolean reuseForks;
/**
* (JUnit 4.7 provider) Indicates that threadCount, threadCountSuites, threadCountClasses, threadCountMethods
* are per cpu core.
*
* @since 2.5
*/
@Parameter(property = "perCoreThreadCount", defaultValue = "true")
private boolean perCoreThreadCount;
/**
* (JUnit 4.7 provider) Indicates that the thread pool will be unlimited. The {@code parallel} parameter and
* the actual number of classes/methods will decide. Setting this to "true" effectively disables
* {@code perCoreThreadCount} and {@code threadCount}. Defaults to "false".
*
* @since 2.5
*/
@Parameter(property = "useUnlimitedThreads", defaultValue = "false")
private boolean useUnlimitedThreads;
/**
* (TestNG provider) When you use the parameter {@code parallel}, 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: {@code classes} or {@code methods}.
*
* (JUnit 4.7 provider) Supports values {@code classes}, {@code methods}, {@code both} to run
* in separate threads been controlled by {@code threadCount}.
*
*
* Since version 2.16 (JUnit 4.7 provider), the value {@code both} is DEPRECATED.
* Use {@code classesAndMethods} instead.
*
*
* Since version 2.16 (JUnit 4.7 provider), additional vales are available:
*
* {@code suites}, {@code suitesAndClasses}, {@code suitesAndMethods}, {@code classesAndMethods}, {@code all}.
*
* By default, Surefire does not execute tests in parallel. You can set the parameter {@code parallel} to
* {@code none} to explicitly disable parallel execution (e.g. when disabling parallel execution in special Maven
* profiles when executing coverage analysis).
*
* @since 2.2
*/
@Parameter(property = "parallel")
private String parallel;
/**
* (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
*/
@Parameter(property = "parallelOptimized", defaultValue = "true")
private boolean parallelOptimized;
/**
* (JUnit 4.7 provider) This attribute allows you to specify the concurrency in test suites, i.e.:
*
*
number of concurrent suites if {@code threadCount} is 0 or unspecified
*
limited suites concurrency if {@code useUnlimitedThreads} is set to true
*
if {@code threadCount} and certain thread-count parameters are > 0 for {@code parallel}, the
* concurrency is computed from ratio. For instance {@code parallel=all} and the ratio between
* {@code threadCountSuites}:{@code threadCountClasses}:{@code threadCountMethods} is
* 2:3:5, there is 20% of {@code threadCount} which appeared in concurrent suites.
*
*
* Only makes sense to use in conjunction with the {@code parallel} parameter.
* The default value 0 behaves same as unspecified one.
*
* @since 2.16
*/
@Parameter(property = "threadCountSuites", defaultValue = "0")
private int threadCountSuites;
/**
* (JUnit 4.7 provider) This attribute allows you to specify the concurrency in test classes, i.e.:
*
*
number of concurrent classes if {@code threadCount} is 0 or unspecified
*
limited classes concurrency if {@code useUnlimitedThreads} is set to true
*
if {@code threadCount} and certain thread-count parameters are > 0 for {@code parallel}, the
* concurrency is computed from ratio. For instance {@code parallel=all} and the ratio between
* {@code threadCountSuites}:{@code threadCountClasses}:{@code threadCountMethods} is
* 2:3:5, there is 30% of {@code threadCount} in concurrent classes.
*
as in the previous case but without this leaf thread-count. Example: {@code parallel=suitesAndClasses},
* {@code threadCount=16}, {@code threadCountSuites=5}, {@code threadCountClasses} is unspecified leaf, the number
* of concurrent classes is varying from >= 11 to 14 or 15. The {@code threadCountSuites} become
* given number of threads.
*
*
* Only makes sense to use in conjunction with the {@code parallel} parameter.
* The default value 0 behaves same as unspecified one.
*
* @since 2.16
*/
@Parameter(property = "threadCountClasses", defaultValue = "0")
private int threadCountClasses;
/**
* (JUnit 4.7 provider) This attribute allows you to specify the concurrency in test methods, i.e.:
*
*
number of concurrent methods if {@code threadCount} is 0 or unspecified
*
limited concurrency of methods if {@code useUnlimitedThreads} is set to true
*
if {@code threadCount} and certain thread-count parameters are > 0 for {@code parallel}, the
* concurrency is computed from ratio. For instance parallel=all and the ratio between
* {@code threadCountSuites}:{@code threadCountClasses}:{@code threadCountMethods} is 2:3:5,
* there is 50% of {@code threadCount} which appears in concurrent methods.
*
as in the previous case but without this leaf thread-count. Example: {@code parallel=all},
* {@code threadCount=16}, {@code threadCountSuites=2}, {@code threadCountClasses=3}, but {@code threadCountMethods}
* is unspecified leaf, the number of concurrent methods is varying from >= 11 to 14 or 15.
* The {@code threadCountSuites} and {@code threadCountClasses} become given number of threads.
*
* Only makes sense to use in conjunction with the {@code parallel} parameter. The default value 0
* behaves same as unspecified one.
*
* @since 2.16
*/
@Parameter(property = "threadCountMethods", defaultValue = "0")
private int threadCountMethods;
/**
* Whether to trim the stack trace in the reports to just the lines within the test, or show the full trace.
*
* @since 2.2
*/
@Parameter(property = "trimStackTrace", defaultValue = "false")
private boolean trimStackTrace;
/**
* Flag to disable the generation of report files in xml format.
* Deprecated since 3.0.0-M4.
* Instead use disable within {@code statelessTestsetReporter} since of 3.0.0-M6.
* @since 2.2
*/
@Deprecated // todo make readonly to handle system property
@Parameter(property = "disableXmlReport", defaultValue = "false")
private boolean disableXmlReport;
/**
* 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
*/
@Parameter(property = "enableAssertions", defaultValue = "true")
private boolean enableAssertions;
/**
* The current build session instance.
*/
@Parameter(defaultValue = "${session}", required = true, readonly = true)
private MavenSession session;
@Component
private Logger logger;
/**
* (TestNG only) Define the factory class used to create all test instances.
*
* @since 2.5
*/
@Parameter(property = "objectFactory")
private String objectFactory;
/**
* Parallel Maven Execution.
*/
@Parameter(defaultValue = "${session.parallel}", readonly = true)
private Boolean parallelMavenExecution;
/**
* Read-only parameter with value of Maven property project.build.directory.
* @since 2.20
*/
@Parameter(defaultValue = "${project.build.directory}", readonly = true, required = true)
private File projectBuildDirectory;
/**
* 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:
*
*
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:
*
*
*
{@code group} or, equivalently, {@code group:*}
*
{@code g*p:*rtifac*}
*
{@code group:*:jar}
*
{@code group:artifact:*:1.0.0} (no classifier)
*
{@code group:*:test-jar:tests}
*
{@code *: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.
* 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 {@link #jvm}, but avoids hardcoding paths.
* The two parameters are mutually exclusive (jvm wins)
*