How to integrate cucumber with Python language

二次信任 提交于 2019-12-11 04:27:57

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/53427036/how-to-integrate-cucumber-with-python-language

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!