1

I downloaded the karate-demo project and made this small changes:

in karate-config.js the first line of the function:

karate.log("Environment from command line: ",karate.env);

then I execute from terminal

mvn test -Dtest=InfoRunner -DargLine="-Dkarate.env=web"

in the output I should get:

Environment from command line: web

but it shown :

Environment from command line: null

for some reason is not passing the karate.env variable

uzigula
  • 33
  • 5
  • 1
    i found out that work if execute the following command mvn test -Dtest=InfoRunner -Dkarate.env=web – uzigula Sep 05 '18 at 20:58

2 Answers2

2

When you remove -dargline then it works.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
kraul25
  • 127
  • 1
  • 2
  • 8
1

Thanks for mentioning this:

i found out that work if execute the following command mvn test -Dtest=InfoRunner -Dkarate.env=web

This is actually news to me. Can you provide your maven / java version ? Also maybe your local maven installation has been modified ?

For example:

$ mvn -version

Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T13:28:13+05:30)
Maven home: /Users/<>/dev/apache-maven-3.0.5
Java version: 1.8.0_112, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.6", arch: "x86_64", family: "mac"
Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • this is what i have: `codesnippets git:(master) mvn -version Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T13:33:14-05:00) Maven home: /usr/local/Cellar/maven/3.5.4/libexec Java version: 1.8.0_172, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.13.6", arch: "x86_64", family: "mac"` – uzigula Sep 06 '18 at 01:56