开发者

Lettuce BDD : How to refer scenarios?

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-con开发者_开发技巧ditions which will be used by a subsequent scenario (say "action" scenario") - how do I refer and call the "registration" scenario from "action" scenario?


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.


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜