关键词
- 创建resource类型的userkey.robot文件
*** Keyword ***
mykeyworkd
[Arguments] ${input}
Log ${input}
*** Settings ***
Resource userkey.robot
*** Test Cases ***
test
mykeyworkd hello world
python子函数引入
#conding=utf-8
def addNum(num1,num2):
return int(num1)+int(num2)
*** Settings ***
*** Test Cases ***
test
Import Library /Users/peter/Desktop/hlpx/03test/good/myrobot/mygod/apitestsuite/userpython.py
${ret} addNum 19 4
自定义python库
➜ myCustomLibrary pwd
/Library/Python/2.7/site-packages/myCustomLibrary
➜ myCustomLibrary cat myclass.py
class MyClass(object):
def __init__(self):
pass
def printMsg(self,msg):
print "hello "+msg
➜ myCustomLibrary cat __init__.py
from myclass import MyClass
class myCustomLibrary(MyClass):
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
*** Settings ***
Library myCustomLibrary
*** Test Cases ***
test
printMsg god
网友评论