在黄瓜特征文件中定义一个变量以传递给步骤

时间:2020-08-11 04:42:40

标签: python variables cucumber

对于行为,我想在功能文件中定义一个变量并将其传递到步骤文件。由于我一次只测试1个特定的“版本”,因此方案大纲不会像合适的。

将其隐藏在environment.py中也可以,但是我希望版本号对用户尽可能可见。

我确实看到了使用正则表达式解决方案(*。)的一些答案,但没有看到如何在步骤定义中使用结果。

// device.feature
Background: device setup
...
Given the device is running "{version}"


// device.py (steps)
@given("the device is running 'version'")
def step_impl(context):
    context.device.check_version(firmware_version)

0 个答案:

没有答案