如何将全局变量传递给可重用要素类路径? [英] how to pass a global variable to the reusable feature classpath?
本文介绍了如何将全局变量传递给可重用要素类路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我开始使用空手道来测试Web服务,并且希望将全局变量传递给可重用功能文件的类路径. 有人有主意吗? 预先感谢.
I am starting to use Karate to test webservices and I want to pass a global variable to the classpath of a reusable feature file. Does anyone have an idea? Thanks in advance.
推荐答案
这是karate-config.js
的用途.请参阅文档: https://github.com/intuit/karate#karate-configjs
This is what karate-config.js
is for. Refer the documentation: https://github.com/intuit/karate#karate-configjs
例如,如果您具有以下简单的karate-config.js
文件:
for example if you have the following simple karate-config.js
file:
function fn() {
return { foo: 'bar' }
}
您将能够在 any 功能文件中引用变量foo
:
You will be able to refer to the variable foo
in any feature file:
* print 'the value of foo is:', foo
这篇关于如何将全局变量传递给可重用要素类路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文