How do I pass command line arguments to ScalaTest using its maven plugin? I was looking for something like TestNG's delegateCommandSystemProperties
configuration, but the closest I could find in ScalaTest documentation were:
argLine
: Option to specify additional JVM options to pass to the forked processenvironmentVariables
: Additional environment variables to pass to the forked processsystemProperties
: Additional system properties to pass to the forked processBut isn't this redundant? For example if I want to pass environment=development
, I need to specify the following in pom.xml
:
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<configuration>
<argLine>-Denvironment=${env}</argLine>
</configuration>
</plugin>
and then run mvn test -Denv=development
. Is there a simpler way to pass command line arguments to ScalaTest directly?
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.
There is no need for defining <argLine>
in the pom.
But it's surely not intuitive to figure, nor well documented, just need to add a simple example usage into the docs.
All you need for passing system properties to a maven test is: test -Dsuites=com.company.somepackage.SomeSpec "-DargLine=-Denv=env001 -Dgroup=default -DmaxTests=10"
.
For environmentVariables
and systemProperties
- there has got to be a simple syntax that works too. Should be possible to figure from either trial and error or reading the source code if anyone's interested. For my needs argLine
is enough.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With