在空手道框架中,是否可以在一个方案中设置变量并在另一个方案中使用它们? [英] Is there a way to set variables in a scenario and use them in another scenario in karate framework?

查看:48
本文介绍了在空手道框架中,是否可以在一个方案中设置变量并在另一个方案中使用它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过运行其中一个方案在响应中获得一个值,我想在下一个方案中使用该值.有没有一种方法可以在具有空手道特征的上下文中设置变量?我知道我可以从功能中调用另一个功能,但是我不想将场景转移到另一个功能中去进行通话.

I get a value in the response by running one of the scenarios and I would like to use that value in the next scenario. Is there a way to set variables in the context of a feature with karate? I know I can call another feature from within the feaure, but I don't want to move that scenario in another feature and do the call.

推荐答案

请注意,使场景依赖于另一个场景是一种不好的做法,我不建议这样做:

Please note that having scenarios depend on another is considered a bad practice, and I don't recommend it: https://github.com/intuit/karate#script-structure

但是请参阅挂钩"这一节: https://github.com/intuit/karate #hooks

But please refer this section on "hooks": https://github.com/intuit/karate#hooks

这篇关于在空手道框架中,是否可以在一个方案中设置变量并在另一个方案中使用它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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