【发布时间】:2013-10-07 10:48:18
【问题描述】:
我正在lettuce 中寻找一种方法来指定要从我的Gherkin 功能文件运行的代码,这样当我到达@before.each_scenario 挂钩时它已经运行了——这实际上是为了做一个动态集场景大纲的示例,因此给定一个包含事物目录的应用程序,我想测试每个事物,我希望能够执行以下操作:
Feature: Automated Catalogue Test
In order to have use the system
As a user
I want to be able to use each feature in the catalogue
Background:
Given I start the system
And I have a list of features
@foreach
Scenario Outline: I use each feature in the system
Given feature <feature_num>
When I load the feature
And I use the feature in the way they are all used
Then I can clear up the feature
所以我已经为预先设定的示例列表工作,并且我已经能够通过使用挂钩来扩展场景来测试逻辑,并且它可以工作,但这意味着如果一个功能失败了那些将是 after 不会运行。
如果后台步骤仅在 @before.each_scenario 之前运行一次,那么我可以设置在 lettuce/core.py:722 枚举的 outlines 列表,但据我所知,这不是 Gherkin 的一部分语言;我不想将I have a list of features 添加到地形中,因为还有许多其他测试不需要了解此目录...
我想没有人有任何建议吗?
【问题讨论】: