本文介绍了如何在空手道自动化的特征文件中调用python文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要调用一个 .py 文件并将参数传递给其中的一个函数,并且必须匹配返回的结果.

I need to call a .py file and pass an argument to one of the functions in it and have to match the result returned.

例如:xyz.py

KarateXyz.feature

KarateXyz.feature

  • match result == call('xyz.py')#如何指定方法名并传入参数?

推荐答案

是的,您可以使用 karate.exec() 来调用任何操作系统进程.是否安装python由您决定.参考 https://github.com/intuit/karate#karate-exec>

Yes, you can use karate.exec() to call any OS process. Whether python is installed is up to you. Refer https://github.com/intuit/karate#karate-exec

* def result = karate.exec('python foo.py bar')

更多详情,请参考:https://stackoverflow.com/a/64352676/143475

这篇关于如何在空手道自动化的特征文件中调用python文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 18:36