3

I have an existing suite of karate tests which can run on different environments (dev / qa) using the approach below:

mvn test -DargLine="-DauthUser=*** -DauthPassword=*** -Dkarate.env=qa"

Now i have added some gatling tests and when try to run the tests on 'qa' with the following command, the tests still run on my default environment which is 'dev' instead of 'qa'.

mvn gatling:test -DargLine="-DauthUser=*** -DauthPassword=*** -Dkarate.env=qa"

Seems like the argLine approach will not work with maven gatling plugin. If not, is there any other way of passing these arguments for gatling tests?

Ravi Saroch
  • 934
  • 2
  • 13
  • 28
rochitsen
  • 402
  • 6
  • 18
  • am not clear, maybe to help others, follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue - also try using os env: `java.lang.System.getenv('PATH')` – Peter Thomas Oct 15 '19 at 04:25
  • @PeterThomas eg., when i run the karate tests, i can see that the env is set as 'qa' and tests run fine: `15:11:33.703 [main] INFO com.intuit.karate - karate.env system property was: qa`. But when the same command is run with `mvn gatling:test` the env is not set - `15:17:02.980 [GatlingSystem-akka.actor.default-dispatcher-7] INFO com.intuit.karate - karate.env system property was: null` – rochitsen Oct 15 '19 at 04:45
  • all that is fine. I need a surefire way to replicate and advise, thanks. – Peter Thomas Oct 15 '19 at 05:26

1 Answers1

3

I came across previous post where its suggested to not use -DargLine when specifying arguments - I want to pass multiple arguments in karate-config.js through mvn command

Just pass the command line arguments like:

mvn gatling:test -DauthUser=*** -DauthPassword=*** -Dkarate.env=qa

rochitsen
  • 402
  • 6
  • 18