所以可以说我在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需要一个参数。
答案 0 :(得分:2)
您的功能
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}
这将解决您的问题。
答案 1 :(得分:0)
您的方法
def get_data(notificaition):
print("Notification Recived: ", notificaition)
不返回任何内容,因此robot框架关键字也将不返回任何内容。