如何使用空手道框架在功能文件的config .js文件中调用参数化函数? [英] how to call parameterized function in config .js file at feature file using karate framework?

查看:78
本文介绍了如何使用空手道框架在功能文件的config .js文件中调用参数化函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将响应值从功能文件传递给javascript函数,该函数在config.js文件中定义,用于某些计算. 请帮助如何调用config.js文件中存在的函数?

I need to pass response value from feature file to javascript function which is defined at config.js file for some computation purposes . Please help on how to call function which is present at config.js file?

推荐答案

首先请参阅: https://github.com/intuit/karate#javascript-functions

只需将JS保留为*.js文件,然后从任何功能或karate-config.js重新使用它即可.请注意,karate.call()可以在JS中使用,包括karate-config.js,甚至可以调用功能文件,而不仅仅是JS.

Just keep the JS as a *.js file and re-use it from any feature or the karate-config.js. Note that karate.call() is possible from JS, including karate-config.js and you can even call a feature file, not just JS.

也许您还应该查看 karate.callSingle() 的示例是0.7.0中的新功能.截止本文发布时,版本0.7.0.RC5可以进行测试.

Maybe you should also look at the example for karate.callSingle() which is new in 0.7.0. As of the time of this post, version 0.7.0.RC5 is available to test.

这篇关于如何使用空手道框架在功能文件的config .js文件中调用参数化函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆