how to pass a global variable to the reusable feature classpath?

你离开我真会死。 提交于 2019-12-11 04:32:43

问题


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.


回答1:


This is what karate-config.js is for. Refer the documentation: https://github.com/intuit/karate#karate-configjs

for example if you have the following simple karate-config.js file:

function fn() {   
  return { foo: 'bar' }
}

You will be able to refer to the variable foo in any feature file:

* print 'the value of foo is:', foo


来源:https://stackoverflow.com/questions/56529995/how-to-pass-a-global-variable-to-the-reusable-feature-classpath

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