0
我的行为步骤或多或少都有变化。 我希望能够提出建议。未定义步骤时,如何获得有用的错误?
例如:
@given('a cookie with sprinkles')
def cookie_with_sprinkles():
"""Given a cookie with sprinkles"""
...
@given('a cookie with icing')
...
@given('a cookie in wrapping')
...
随着测试步骤
Given a cookie with icing
我想表现得说类似
Undefined step 'Given a cookie with icing'
Steps available with 'a cookie' are:
Given a cookie with sprinkles
Given a cookie with icing
Given a cookie in wrapping
我想到的地方硬编码的模式 “一个cookie '和映射到实现cookie步骤的函数。 我很想重用-steps-catalog的功能,但只是使用doc字符串就没关系。
谢谢!