關(guān)鍵詞
- 創(chuàng)建resource類型的userkey.robot文件
*** Keyword ***
mykeyworkd
[Arguments] ${input}
Log ${input}
*** Settings ***
Resource userkey.robot
*** Test Cases ***
test
mykeyworkd hello world
python子函數(shù)引入
#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庫(kù)
- 在python庫(kù)目錄編寫(xiě)庫(kù)文件
? 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
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者