Lettuce BDD:如何引用场景?

发布于 2024-10-20 18:04:22 字数 130 浏览 1 评论 0原文

我正在使用Python的Lettuce BDD框架,我想知道如何从另一个场景中运行一个场景。

例如,假设有一个“注册”场景,它建立了一些将由后续场景使用的先决条件(说“行动”场景”) - 如何从“行动”场景引用和调用“注册”场景?

I am using Lettuce BDD framework for python, and I am wondering how to run one scenario from within another scenario..

For example, say there is a "registration" scenario that establishes some pre-conditions which will be used by a subsequent scenario (say "action" scenario") - how do I refer and call the "registration" scenario from "action" scenario?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冷夜 2024-10-27 18:04:22

Lettuce 有一个“behave_as”功能可以做到这一点。虽然上次我尝试使用它时遇到了一些错误。现在可能已修复。我和作者 Gabriel 一起打开了一个 bug。

There is a "behave_as" feature for Lettuce which should do this. Though there were some bugs with it last time I tried to use it. May be fixed now. I opened a bug on it with Gabriel, the author.

无悔心 2024-10-27 18:04:22

我一直在做一些生菜研究,并遇到了这个老问题。

看起来处理这个问题的首选方法是在声明方法时使用装饰器“@world.absorb”来更改可重用方法的范围
这将该方法归因于世界对象并允许调用它。然后,您可以通过其他方法调用 world.yourAction

Gabriel 撰写的 yipit 博客上有详细的解释:

http://tech.yipit.com/2011/12/23/lettuce-best-and-worst-practices-1/< /a>

就像我说的,我只是在学习生菜,所以如果有人找到更好/更新的方法来完成此任务,请告诉我!

I've been doing some lettuce research and came across this older question.

It looks like the preferred way to handle this is to change the scope of the reuseable method by using the decorator "@world.absorb" when declaring the method
this attributes the method to the world object and allows it to be called. You can then call the world.yourAction from your other method

there's a thorough explanation on the yipit blog written by Gabriel:

http://tech.yipit.com/2011/12/23/lettuce-best-and-worst-practices-1/

Like i said, I'm just learning lettuce, so if anybody has found an even better/newer way to accomplish this, please let me know!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文