【发布时间】:2012-08-15 08:19:27
【问题描述】:
我正在用生菜在 Django 中学习 BDD,同时我想到了一种情况,即不同场景中的两个步骤恰好具有相同的名称,例如,
Feature: a feature A
Scenario: a scenario S1
Given this is the conflicted step
Then chect the result of scenario S1
Feature: a feature B
Scenario: a scenario S2
Given this is the conflicted step
Then chect the result of scenario S2
上面的步骤这是冲突的步骤,恰好是在多个不同含义的场景中定义的。然后将针对此步骤的所有出现执行此步骤的以下测试代码。
@step(r'this is the conflicted step')
def mytest(step):
# do test
我的问题是,是否有一种命名空间机制允许我们为同名但在不同场景中的步骤创建不同的测试代码?例如,我期望以下测试代码或类似的东西:
@step(r'a feature A', r'this is the conflicted step')
def aaaa(step):
# do test
@step(r'a feature B', r'this is the conflicted step')
def bbbb(step):
# do other test
【问题讨论】:
标签: namespaces bdd lettuce