0

I tried calling the Python function using Get Library Instance Builtin Method of Robot Framework, but getting the error as "Keyword name cannot be empty". My Testcase code is

 *** Settings ***
Documentation  This is the register API testsuite
Library    ../../lib/ServerAPI.py  ${FEIP}  ${DBIP}   ${schemaid}   ${appid}   ${subscriber}

*** Test Cases ***
[TC-001]-Registering a device with INVALID SUBSCRIBER name to the server

     ${serverlib}=  Get Library Instance   ServerAPI
     log  ${serverlib}
     log  ${serverlib.subscriber}
     ${serverlib.register device}    ${token}   ${devid}

For the line ${serverlib.register device} ${token} ${devid}, i'm getting the error "Keyword name cannot be empty".register_device is one of the function in the file ServerAPI.py The log lines above log ${serverlib} is giving me ServerAPI object. I'm not sure if its the correct way to call the functions from a python Library.

1
  • 1
    It is not necessary to explicitly create instance (like ${serverlib}) for you purpose. Statement Library creates instance of your library and then you just call your keyword Register Device. Commented Mar 9, 2017 at 12:13

1 Answer 1

1

If register_device is a function in the library, you just call it directly:

Register device    ${token}    ${devid}
Sign up to request clarification or add additional context in comments.

2 Comments

I can use my Library like this, but the problem is, i want to change some of the class variable of ServerAPI, to further use in my testcase. Like we do in Python. Please let me know, if there is any way of doing this
Can anybody help me in this? I want to do something like this : class a: def __init__(self,a): self.a = a in a file called x.py. The testcase will be like Library x 'new' *** Test Cases *** [TC-001]-Changing the Variable ${ab}= Get Library Instance x, ${ab.a} set value new2

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.