0%

创建robotframework自定义词库

创建robotframework自定义词库

在你的项目的python环境下创建自定义的库的文件夹。

例如:

1
python_path\Lib\site-packages\CustomLibrary

创建 init.py

1
2
3
4
from .customClass import CustomClass

class CustomLibrary(CustomClass):
ROBOT_LIBRARY_SCOPE = 'GLOBAL'

创建 customClass.py

1
2
3
4
5
6
class CustomClass(object):
def __init__(self):
pass

def customLog(self,msg):
print('custom log:'+msg)

再用例中导入库

1
2
*** Settings ***
Library CustomLibrary