python中的Infix arguments关键字

时间:2018-07-06 09:28:42

标签: python robotframework

我想在python中编写带有infix参数的关键字,这可能吗?

*** Keywords ***
Set ${var} on device
    set samething on device  samething=${var}

我可以在python的设备上写Set $ {var}吗?

1 个答案:

答案 0 :(得分:1)

from robot.api.deco import keyword

@keyword('Add ${quantity:\d+} Copies Of ${item} To Cart')
def add_copies_to_cart(quantity, item):
    # ...
*** Test Cases ***
My Test
    Add 7 Copies Of Coffee To Cart

http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#embedding-arguments-into-keyword-names