为了账号安全,请及时绑定邮箱和手机立即绑定

使用 Robot Framework 从 Python 中的方法返回值

使用 Robot Framework 从 Python 中的方法返回值

慕码人8056858 2021-06-30 17:42:46
所以可以说我在python中有这个方法def get_data(notificaition):    print("Notification Recived: ", notificaition)然后我有另一种方法可以接收事件并获取该事件的值。def verify_singal_r():    with Session() as session:        connection = Connection("http://example/signalr", session)        print(connection)        logging.info("got the connection")        presenceservice = connection.register_hub('MyHub')        connection.start()        def print_error(error):            print('error: ', error)        connection.error += print_error        # TODO: NEED TO ADD POST REQUEST HERE        presenceservice.client.on('Notified', get_data)        connection.wait(10)一旦关键字Verify_Signal运行,我就会得到我需要的值并将它们打印到控制台上如何使用get_data机器人框架中的值?我试着简单地使用*** Test Cases ***Get Event Back     verify_singal_r     get_data但这不起作用,因为 get_data 需要参数。
查看完整描述

2 回答

?
料青山看我应如是

TA贡献1772条经验 获得超8个赞

你的职能


def get_data(notificaition):

    print("Notification Recived: ", notificaition)

期待争论


但是,当您在机器人框架中调用它时


*** Test Cases ***


Get Event Back

     verify_singal_r

     get_data

你没有提供任何论据。


你可以试试这样的


*** Variables ***

${notification}    Test

*** Test Cases ***


Get Event Back

     verify_singal_r

     get_data    ${notification}

这将解决您的问题。


查看完整回答
反对 回复 2021-07-06
?
缥缈止盈

TA贡献2041条经验 获得超4个赞

你的方法


def get_data(notificaition):

    print("Notification Recived: ", notificaition)

不返回任何内容,因此机器人框架关键字也不会返回任何内容。


查看完整回答
反对 回复 2021-07-06
  • 2 回答
  • 0 关注
  • 209 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号