4

I want to want pass multiple arguments in mvn command and and that should be read in karate-config.js file.

e.g: mvn test -DargLine="-Dkarate.env='gdcStaging', -Dkarate.source='false', -Dkarate.natco='gdc'"

I didn't want to declare any .prop files, want to get these values at run time. Below prop. are defined to read these arguments but unable to achieve from this:

var environment = karate.env;
var natco = karate.properties['karate.natco'];
var isLocal = java.lang.System.getenv('karate.source');

I need help to achieve this

karate-version=0.9.0

I had also referred to this link :Pass additional parameters to karate-config.js via command line via Maven but not worked

shivam
  • 61
  • 8

1 Answers1

3

Instead of using argLine try passing it directly,

mvn test -Dkarate.env=gdcStaging -Dkarate.source=false -Dkarate.natco=gdc

I suggest not to use karate. as a prefix to your arguments other than karate.env, instead try using your application name. eg,

-Dmyapp.source=false

coming to the karate-config.js

var natco = karate.properties['myapp.source']

This should work.

Babu Sekaran
  • 4,129
  • 1
  • 9
  • 20