如何在行为/ python中传递参数

问题描述 投票:0回答:1

[嗨,我想知道如何传递True或False这样的参数。 (config_type = True)使用以python语言表现。

Scenario Outline:
Given 
upload xls with parameters "shop" xlsx (path: "./upload12.xlsx") definition named "config_short" and  "<config_type>"

Examples:
      | config_type|
      | False    |

@given('upload xls with parameters "sh" xlsx (path: "./upload12.xlsx") definition named "config_short" and  "{config_type}"')
def step_impl(context, config_type)
definition = someMethod(xlsx_path, config_short, config_type=True)

这是在BDD中传递此类参数的正确方法吗?在下一个测试中,我想重用someMethod,但是使用config_type = False

python bdd python-behave
1个回答
0
投票

我认为您很亲密,但需要将config_type参数传递给someMethod:

Scenario Outline:
Given upload xls with parameters "shop" xlsx (path: "./upload12.xlsx") definition named "config_short" and  "<config_type>"

Examples:
      | config_type|
      | False    |

@given('upload xls with parameters "sh" xlsx (path: "./upload12.xlsx") definition named "config_short" and  "{config_type}"')
def step_impl(context, config_type)
    definition = someMethod(xlsx_path, config_short, config_type=config_type)
© www.soinside.com 2019 - 2024. All rights reserved.