1
votes

What i am trying is that to set the global karate.config values from a feature file.

I have something very similar to this https://github.com/intuit/karate/blob/master/karate-demo/src/test/java/demo/oauth/oauth2.feature

but i want to set the global config from the feature file or use the feature file in karate-config.js, then how do i access a variable from the feature file when calling using karate.call. And what is the recommended pathing for it.

1

1 Answers

1
votes

To set a global variable, use karate-config.js as explained here: https://github.com/intuit/karate#karate-configjs

When using the call keyword, all global variables are inherited.

There is no recommended pathing. If you want you can create complex JSON for e.g. if you return { foo: { a: 1 } } from karate-config.js you can use the value of foo.a anywhere in a feature file, for e.g:

* path 'blah', foo.a