简体   繁体   English

使用WITH NAME导入Robot Framework自定义库

[英]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.

相关问题 使用自定义库运行机器人框架测试用例时,如何解决“NameError: global name 'x' is not defined”错误? - How can I resolve “NameError: global name 'x' is not defined” error while running a Robot Framework testcase using a custom library? 在 Robot Framework 中导入自定义测试库 - Importing custom testing library in Robot Framework Robot Framework无法识别自定义库的类(类名和文件名相同) - Robot Framework does not recognize custom library's class (class name and filename are the same) 无法使用扩展 AppiumLibrary 的自定义机器人框架库单击元素 - Cannot click element using custom Robot Framework library which extends AppiumLibrary 无法使用使用Python编写的Robot Framework自定义库 - Unable to use Robot Framework custom library which has written using Python 使用动态库的robot框架自定义关键字中run_keyword方法的实现问题 - implementation issue in the run_keyword method in robot framework custom keyword using dynamic library 如何将Java自定义库添加到Robot Framework RIDE - How to add a Java custom library to Robot Framework RIDE 将现有的Webdriver对象传递给Robot Framework的自定义Python库 - Pass existing Webdriver object to custom Python library for Robot Framework 如何强制Robot Framework仅初始化一次我的自定义库 - How to force Robot Framework to initialize my custom library only once Robot Framework,将自定义关键字与Selenium2Library集成 - Robot Framework, integrating custom keywords with Selenium2Library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM