We have two projects with the structure test -> project1 -> karate-config.js and test ->project2 ->karate-config.js. Ideally i would like to combine the configs into a single config file at the test folder level like test ->karate-config.js ( project1 + project2). Both projects use a similar structure in the config file except for the the API endpoint URL's. Thanks in Advance !
Asked
Active
Viewed 652 times
1 Answers
1
You can read any JS function at any time and evaluate it. If it returns a JSON, you can use karate.merge()
to add it to the config. So that gives you many possibilities.
var fun = read('classpath:some.js');
config = karate.merge(config, fun());
That said please be aware that there is a concept of karate-base.js
- so please read the docs: https://github.com/intuit/karate#karate-basejs

Peter Thomas
- 54,465
- 21
- 84
- 248