1

So lets say i have this method in python

def get_data(notificaition):
    print("Notification Recived: ", notificaition)

And then i Have another method that recives a event and gets the value of that event.

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)

Once the Keyword Verify_Signal runs I get the values I need and i print them onto the console

How can I use the value of the get_data in robot framework?

I tried to simply use

*** Test Cases ***

Get Event Back
     verify_singal_r
     get_data

But that does not work as get_data expects an argument.

2 Answers 2

2

your function

def get_data(notificaition):
    print("Notification Recived: ", notificaition)

Expects an argument

However when you are calling this in robot framework

*** Test Cases ***

Get Event Back
     verify_singal_r
     get_data

You are not providing any argument to it.

You can try something like this

*** Variables ***
${notification}    Test
*** Test Cases ***

Get Event Back
     verify_singal_r
     get_data    ${notification}

This will solve your problem.

Sign up to request clarification or add additional context in comments.

3 Comments

I treid your example but I ma just getting Notification Recived: how can i get the value that was generate in the python script?
Then in your python function you need to return something.
After a bit of debugging i found out that the get data is being called after the signal is verified which makes it ''empty'' , How can i get return value from the verify signal r keyword?
0

Your method

def get_data(notificaition):
    print("Notification Recived: ", notificaition)

does not return anything, so robot framework keyword will not return anything too.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.