Hey Bill,
Looks like system properties cannot be reached within ScalaTest unless they're passed to scalatest-maven-plugin in some way.
Yes, using ConfigMap solves this but with some additional steps in pom.xml:
1. I've defined property in pom.xml like
<properties><environment>QA</environment><properties>
2. I've told plugin to use that in ConfigMap:
<config>env=${environment}</config>
3. In the test code I'm using BeforeAndAfterAllConfigMap:
override def beforeAll(conf:ConfigMap) {
val en = conf.get("env").get
}
Now if I run the tests with
mvn clean test-compile scalatest:test -Dsuites=com.gr.MySuite -Denvironment=DEV
The flag is passed to config map and can be used in code. Thus, I'm able to dynamically tell which env to run tests against ( particularly in Jenkins job) - by default we're targeting QA.
Thanks for hint!
Best regards,
GerraldG