Karate-config.js - is it possible to have methods of a java class made available for use elsewhere?

Viewed 26

To save me having to repeat a line of code (example a) in lots of different files - wherever I want to make use of a Java method, is it possible to move that line of code to the Karate-config.js so that I can make use of the methods attached to it? like in (example b)?

example a (line in feature file that I want to move to karate-config):

* def LdapUtils = Java.type('com.package.something.LdapUtils')

example b (in feature file):

* def newUser = LdapUtils.addNewUser()
* def userId = newUser.uid
1 Answers
Related