我有Scenario outline,其中有多个示例,如下所示:
Examples:
| country | type | number |
| Poland | An individual | - |
| Poland | Company | 8971660890 |
| Germany | An individual | - |
| France | Company | 92511490856 |
我想使用这些示例并将其传递给步骤定义之一以创建条件表达式,例如:
@step(check_sth)
def step_imp(country, type, number):
if county == Poland:
do sth
elif type == individual:
do other thing
有可能在bahave?
答案 0 :(得分:1)
请参阅行为教程,了解如何执行此操作:https://pythonhosted.org/behave/tutorial.html
特别要看一下如何设置场景大纲,例如:
Given I enter the following data <country> <type> and <number>,
Then check that <country> is correct
会给你以下步骤定义:
@given('I enter the following data "{country}" "{type}" and "{number}",')
def step_impl(context, country, type, number):
@then('check that "{country}" is correct')
def step_impl(context, country):