1

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

1 Answer 1

1

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')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.