[英]Importing custom testing library in Robot Framework
我正在为Python
中的Robot Framework
编写一个自定义测试库,我想像这样导入它:
Library CustomLibrary
我将包含源代码的文件夹放在PYTHONPATH
上,但仍然出现错误: Importing test library 'CustomLibrary' failed: ImportError: No module named CustomLibrary
CustomLibrary
class 在__init__.py
文件中定义,就像在AppiumLibrary
中这样:
from CustomLibrary.keywords import *
class CustomLibrary(_CustomKeywords):
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
我该如何解决这个问题,以便将其导入 Robot Framework? 我想将 class 定义保留在 init 文件中。
您需要确保包含CustomLibrary
的文件夹位于 PYTHONPATH 上。
例如,以下对我来说按预期工作:
Library CustomLibrary
在测试中导入库robot --pythonpath /tmp example.robot
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.