I have few scenarios which needs some data manipulation for Assertion. I know, it can be done by Java Script. But I wish to create a Utility file for custom reusable functions. Is there any possibility to integrate with Python through which Utility function can be called.
Asked
Active
Viewed 696 times
1 Answers
0
I strongly advise against it.
If you really want, you might be able to call a command-line python program like this:
* def FileUtils = Java.type('com.intuit.karate.FileUtils')
* def runtime = java.lang.Runtime.getRuntime()
* def exec = function(cmd){ return FileUtils.toString(runtime.exec(cmd).getInputStream()) }
* def result = exec('my-python-command')
Of course if you are able to expose your Python utils as a REST-API, that's another option :)
But please don't do this.

Peter Thomas
- 54,465
- 21
- 84
- 248