[英]Robot Framework Custom Library Imports using WITH NAME
I have recently started using Robot Framework for my Automation Framework, using my existing python Libraries 我最近开始使用现有的Python库将Robot Framework用于自动化框架
*** Settings ***
Library ../../lib/ServerAPI.py WITH NAME ServerAPI
*** Test Cases ***
[TC-001]-Registering a device with INVALID SUBSCRIBER name to the server
ServerAPI.subscriber None
${resp} register device ${token} ${devid}
LOG ${resp}
Should Be Equal ${resp} ${True}`
Its not recognising the ServerAPI keyword name for the library, can anybody help me, what i'm missing here? 它无法识别该库的ServerAPI关键字名称,有人可以帮助我,我在这里缺少什么?
Based on the code in the question, it appears that you do not have the proper number of spaces before "WITH" and after "NAME" -- "WITH NAME" needs at least two spaces before and after (though, if you are using tabs, that may not be the problem). 根据问题中的代码,似乎您在“ WITH”之前和之后的“ NAME”之后没有正确的空格数量-“ WITH NAME”在前后至少需要两个空格(不过,如果您使用的是标签,这可能不是问题)。
For example: 例如:
*** Settings ***
Library ../../lib/ServerAPI.py WITH NAME ServerAPI
This issue resolved, it seems i was importing the .py file in my robot testcase, so WITH NAME it was not taking. 此问题已解决,似乎我正在将.py文件导入我的机器人测试用例中,因此它没有使用WITH NAME。 I tried using the classname mentioned in the py file and added the path in PYTHONPATH, now its working.
我尝试使用py文件中提到的类名,并在PYTHONPATH中添加了路径,现在可以使用了。 Thanks for all the suggestion
谢谢所有的建议
Library ServerAPI WITH NAME serverApi
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.