異なるシナリオの2つのステップがたまたま同じ名前を持っている状況を考えながら、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