I am using callSingle() in karate- config.js file, but in the actual feature that is being called, I am unable to read "env" and "baseURL" which works fine in regular features. How can I make it work? This is my karate-config.js and feature.
var env = karate.env;
if (!env) {
env = 'DEV';
}
if(env === 'DEV') {
baseURL = 'http://dev.companyname.com';
cleardata = karate.callSingle('classpath:com/cleardata.feature');
}
else if(env === 'QA') {
baseURL = 'http://qa.companyname.com';
cleardata = karate.callSingle('classpath:com/cleardata.feature');
}
Scenario Outline:
Given url baseURL
When path "/some/path/"+id
Then method Get
Then status 200
And def id = response.id
Examples:
|read('classpath:com/'+ env + '_testdata.csv')|
I am getting this error: ERROR com.intuit.karate - evaluation of 'karate-config.js' failed: javascript function call failed: com.intuit.karate.exception.KarateException: [1.1:12] cleardata.feature:16 - url not set, please refer to the keyword documentation for 'url'
but if I update my feature like that it works fine:
Scenario Outline:
Given url 'http://dev.companyname.com'
When path "/some/path/"+id
Then method Get
Then status 200
And def id = response.id
Examples:
|read('classpath:com/dev_testdata.csv')|
Thank You