One of the param for my API is security related and linked to the environment on which the test would run , essentially it will be dynamic. Since this is security related, I have an internal rest API that provides this data. I want to understand what is the effective way of getting this data in Karate feature?
I have tried two different ways: 1. Defined a java util and invoke the java type and def variable for holding the data
- Defined a Util method as part of karate-config.js
In karate-config.js
function getSomeData(someValue) {
return Java.type('xyz.abc.util.MyUtil');
}
In the feature file defined a JS
* def dataFromJS = read('classpath:com/xyz/util/js_that_invokes_rest.js')
I want to understand if there is a pattern of how this should be done or if there is an explicit support in Karate for doing this?
Aucun commentaire:
Enregistrer un commentaire