环境:lettuce-0.2.23-py2.7
对于Windows 8
简单的场景(来自 Lettuce 文档的示例)一切正常:
@step('I am logged in')
def is_logged_in(step):
step.behave_as("""
Given I go to the home page
And I click the login button
And I fill in username:{user} password:{pass}
And I click "Login"
""".format(user='floppy', pass='banana'))
但我不知道如何通过Scenario Outline
像这样的乘法示例
Given cat with name "<cat_name>"
Examples:
|cat_name|
|filemon |
|tomcat |
将其粘贴到父场景中:
@step('I have bunch of cats')
def bunch_of_cats(step):
step.behave_as("""
Given cat with name "<cat_name>"
Examples:
|cat_name|
|filemon |
|tomcat |
""".format()
堆栈跟踪:
Traceback (most recent call last):
File "build\bdist.win-amd64\egg\lettuce\core.py", line 144, in __call__
ret = self.function(self.step, *args, **kw)
File "\\features\steps\manager_steps.py", line 590, in magic
""".format())
File "build\bdist.win-amd64\egg\lettuce\core.py", line 408, in behave_as
assert not steps_undefined, "Undefined step: %s" % steps_undefined[0].sentence
AssertionError: Undefined step: Examples:
看起来我需要搞乱在lettuce-0.2.23-py2.7.egg!\lettuce\core.py
哪里behave_as
实现方法来识别轮廓。
其他解决方案是将for loop
步骤与examples
作为集合来实现。有什么建议吗?