robot framework 自定义Library
来源:互联网 发布:慧讯软件 编辑:程序博客网 时间:2024/06/05 16:55
1. 首先在..\Python27\Lib\site-packages 目录下创建MyLibrary 目录,用于放自定义的library库。
2.在MyLibrary 文件夹下新建mylibrary.py文件创建自己的关键字,如下所示:
class MyLibrary(object):
def test1(self):
"""test 1"""
print "test1"
def test2(self):
"""test 2"""
print "test1"
def test3(self):
"""test 3"""
print "test3"
这里我们定义了三个关键字test1,test2,test3
2.要想在robot framework 启动后加载这些关键字,还需要在MyLibrary 目录下创建__init__.py 文件,并且它不是空的。
# mylibrary 即建立的py文件名,MyLibrary即关键字Class名
from mylibrary import MyLibrary
__version__ = '0.1'
class MyLibrary(MyLibrary):
"""
this is comment about mylibrary
"""
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
这个文件中其实有用的信息就三行,但必不可少。robot framwork 在启动时会加载这个文件,因为
在这个文件里指明了有个mylibrary 文件下面有个MyLibrary类。从而加载类里的方法(test1(),test2等)。
这样在robot framework RIDE中就可以像添加普通库一样,添加自定义的MyLibrary这个库了
- robot framework 自定义Library
- Robot Framework 自定义library
- Robot Framework 教程 (4) - 自定义Library
- Robot Framework Get Library Instance
- Robot Framework自定义测试库
- Robot Framework + Selenium library + IEDriver环境搭建
- Robot Framework 之 Remote Library vs Normal Library
- robot framework封装自定义关键字方法
- Robot Framework: 自定义自己的python库
- Robot Framework自定义封装关键字方法【精华贴】
- Robot Framework: 自定义自己的python库
- Robot Framework: 自定义自己的python库
- Robot Framework 之 Remote Library 浅层次研究
- Robot Framework Remote Library 使用远程接口库
- Robot Framework
- Robot Framework
- Robot Framework
- Robot Framework
- 静态函数(static)
- 记一次cocos2d-x游戏项目内存优化
- Cocos2d-x坐标系介绍
- textAppearance的属性设置
- 设计模式-第1讲-单例
- robot framework 自定义Library
- Caused by: java.lang.UnsupportedClassVersionError
- kafka auto.offset.reset介绍
- 几种MQ消息队列对比与消息队列之间的通信问题
- Number of 1 Bits
- java Phaser
- 02 bootstrap.js 工作方式
- LeetCode2之AddTwoNumbers的java题解
- Qt5学习之路(vs2012下创建一个QT应用程序)2013-10-14