Is there a way to set variables in a scenario and use them in another scenario in karate framework?

∥☆過路亽.° 提交于 2019-12-13 18:09:42

问题


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.


回答1:


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

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



来源:https://stackoverflow.com/questions/54182312/is-there-a-way-to-set-variables-in-a-scenario-and-use-them-in-another-scenario-i

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