The ScalaTest Maven plugin allows you to run ScalaTest tests through Maven without requiring @RunWith(classOf[JUnitRunner])
annotations
and access all functionality of the ScalaTest Runner
, including parallel execution and multiple reporters.
To use the ScalaTest Maven plugin, you need to disable SureFire and enable ScalaTest.
Here's an example of how to do this in your pom.xml:
The ScalaTest Maven plugin contains two "mojos". The test mojo is for "mvn test" commands, and the reporter mojo is for "mvn site" commands.
Here are the configuration parameters.
Configuration options |
runpath |
Comma separated list of additional elements to be added
to the ScalaTest runpath. project.build.outputDirectory and
project.build.testOutputDirectory are included by default
|
suites |
Comma separated list of suites to be executed |
tagsToInclude |
Comma separated list of tags to include |
tagsToExclude |
Comma separated list of tags to exclude |
config |
Comma separated list of configuration parameters to pass to ScalaTest.
The parameters must be of the format <key>=<value>: e.g., foo=bar,monkey=donkey |
parallel |
Set to true to run suites in parallel |
suiteSorting |
Set to true to enable suite sorting, this only takes effect if parallel is set to true. |
threadCount |
Set the thread count for parallel tests execution, this only takes effect if parallel is set to true. |
membersOnlySuites |
Comma separated list of packages containing suites to execute |
wildcardSuites |
Comma separated list of wildcard suite names to execute |
testNGConfigFiles |
Comma separated list of testNG xml files to execute |
jUnitClasses |
Comma separated list of JUnit test class names to execute |
forkMode |
Option to specify the forking mode. Can be "never" or "once". Surefire's "always" option, which would
fork for each test-class, may be supported later. |
argLine |
Option to specify additional JVM options to pass to the forked process. |
environmentVariables |
Additional environment variables to pass to the forked process. |
systemProperties |
Additional system properties to pass to the forked process. |
debugForkedProcess |
Option to specify whether the forked process should wait at startup for a remote debugger to attach.
If set to true , the forked process will suspend at startup and wait for a remote
debugger to attach to the configured port.
|
debugArgLine |
JVM options to pass to the forked process when debugForkedProcess is true.
If set to a non-empty value, the standard debug arguments are replaced by the specified arguments.
This allows customization of how remote debugging is done, without having to reconfigure the JVM
options in argLine . |
debuggerPort |
Port to listen on when debugging the forked process. The default value is 5005. |
forkedProcessTimeoutInSeconds |
Timeout in seconds to allow the forked process to run before killing it and failing the test run.
If set to 0, process never times out. The default value is 0. |
logForkedProcessCommand |
Whether or not to log the command used to launch the forked process. The default value is false. |
reportsDirectory |
(TestMojo only) Output directory in which ScalaTest file reports should be written to. Passed to ScalaTest via the -f argument. |
skipTests |
(TestMojo only) Set to true to skip execution of tests. |
testFailureIgnore |
(TestMojo only) Set to true to avoid failing the build when tests fail |
noScalaTestIgnore |
(TestMojo only) Set to true to avoid failing the build when ScalaTest not found on classpath |
filereports |
(TestMojo only) Comma separated list of filereporters. A filereporter consists of an optional
configuration and a mandatory filename, separated by whitespace: e.g., all.txt,XE ignored_and_pending.txt
For more info on configuring reporters, see the scalatest documentation. |
reporters |
(TestMojo only) Comma separated list of reporters. A reporter consist of an optional configuration
and a mandatory reporter classname, separated by whitespace. The reporter classname
must be the fully qualified name of a class extending org.scalatest.Reporter :
e.g., C my.SuccessReporter,my.EverythingReporter
For more info on configuring reporters, see the ScalaTest documentation. |
junitxml |
(TestMojo only) Comma separated list of junitxml. A junitxml consists of
a mandatory directory for the xml files.
For more info on configuring reporters, see the scalatest documentation. |
stdout |
(TestMojo only) Configuration for logging to stdout. (This logger is always enabled)
For more info on configuring reporters, see the scalatest documentation. |
stderr |
(TestMojo only) Configuration for logging to stderr. It is disabled by default, but will be enabled
when configured. Empty configuration just means enable.
For more info on configuring reporters, see the scalatest documentation. |
reportingOutputDirectory |
(ReporterMojo only) Directory where reports will go. |
fileReporterOptions |
(ReporterMojo only) Consists of an optional configuration parameters for the file reporter.
For more info on configuring reporters, see the ScalaTest documentation. |
spanScaleFactor |
Optional span scale factor, if not specified it will be 1.0. |