环境:Windows 8上的lettuce-0.2.23-py2.7
对于简单的场景(来自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()StackTrace:
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:看起来我需要在实现behave_as方法来识别轮廓的lettuce-0.2.23-py2.7.egg!\lettuce\core.py中搞乱了。
另一种解决方案是使用examples作为集合来实现step的for loop。有什么建议吗?
发布于 2014-12-09 17:24:22
当然,这里有一段代码:
@step("Given cat with name (\w+)")
def set_cat_name(step, name):
step.behave_as("""
Given another step that requires a name of a cat {0}
""".format(name))https://stackoverflow.com/questions/25843210
复制相似问题