1
votes

I'm calling JVM classes in karate feature file using Java Inte rop. It works well, but I have number of classes (about 25) in java package and would like to call/define all classes in the package. Is there any possibilities/approach?

Currently I'm defining 25 Java Inte rop variables in Background and using in Scenarios. Any idea to define package itself and use corresponding classes in scenarios?

1

1 Answers

0
votes

I have a better suggestion. Use a single Java class, and have multiple static helper methods on it.

Then you just need to init a single variable.

* def utils = Java.type('com.mycompany.MyUtils')
* def result = utils.doWork()
* utils.doSomeOtherWork('message', 500)