Reputation: 299
I want to set a Global variable for Base Test Data location which can be used in all of my feature files. In karate-config.js i have made below changes -
var config = { env: env, INPUT_JSON_PATH: 'com/company/project/module/TestData' }
And in my feature file I am trying to use it as -
Given path '/myService' And request read('classname:INPUT_JSON_PATH/Exception_Handling/Mandatory_Fields_missing.json') When method POST Then status 400
But somehow its not getting resolved and I am getting error - could not find or read file: classname:INPUT_JSON_PATH/Exception_Handling/Mandatory_Fields_missing.json
Any idea, what am i missing here?
Thanks, Abhi
Upvotes: 1
Views: 733
Reputation: 58153
Just keep in mind that read()
and other parts of the right-hand-side are treated as ordinary JavaScript. Maybe you were intending to do this:
And request read('classpath:' + INPUT_JSON_PATH + '/Exception_Handling/Mandatory_Fields_missing.json')
Upvotes: 1