Reputation: 141
I found in the karate docs that the java method can be run like this:
* def JavaDemo = Java.type('com.app.DBUtils').prepareData(arg1, arg2)
I created karate-config.js file where I stored environment variables. Now I need to run some java methods after every scenario, but just for some environments. So I have there some conditions.
But I didn't find a way to run a java method from karate-config.js after every scenario. Is it possible?
Upvotes: 1
Views: 1818
Reputation: 58128
Yes if you wrap it in JS or a Feature
: https://github.com/intuit/karate#hooks
var fun = function(){ var MyClass = Java.type('com.myco.MyClass'); MyClass.doWork() }
karate.configure('afterScenario', fun);
Upvotes: 1