JBehave在场景中跨给定/何时/然后的步骤维护数据

编程入门 行业动态 更新时间:2024-10-26 13:36:29
本文介绍了JBehave在场景中跨给定/何时/然后的步骤维护数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

一段时间以来,我一直在尝试JBehave,我需要弄清楚是否存在一种在特定情况下运行期间跨步骤维护数据的方法?我的意思是,无需使用即可在给定/何时/然后的场景中维护状态/数据 步骤类下的任何状态变量.

I have been trying JBehave for sometime and I need to figure out if there exists a way to maintain data across steps during the run of one particular scenario ? I mean is it possible to maintain the state/data during a scenario across the Given/When/Then with out using any state variable under the Step Class.

推荐答案

是的,您可以将保持共享状态的对象传递给不同的步骤.

Yes, you can pass an object that maintains the shared state to the different steps.

jbehave核心对此进行了演示.在 WindowControl .

The Noughts And Crosses example in jbehave core demonstrates this. There's some share state between stories that is maintained in the class WindowControl.

看到设置环境的NoughtsAndCrossesStory类将WindowControl实例注入所有步骤.

See that the class NoughtsAndCrossesStory that sets up the environment injects an instance of WindowControl to all the steps.

更多推荐

JBehave在场景中跨给定/何时/然后的步骤维护数据

本文发布于:2023-11-23 09:06:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1620876.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:步骤   景中   数据   JBehave

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!