*** Variables ***
${DBModuleName} pymssql
${DBName} which database
${DBUser} login account
${DBPassword} login password
${DBHost} 10.10.10.10
${DBPort} 443
${Charset} utf8
*** Keywords ***
Connect Database
Connect To Database Using Custom Params ${DBModuleName} database='${DBName}', user='${DBUser}', password='${DBPassword}', host='${DBHost}', port=${DBPort}, charset='${Charset}'
-----------------------------------------------------------------------------------------------------------------------
所以在Suite『Main Query Page』中的TestCase便可直接引用Resource「DataBase.robot」的Keywords "Connect Database"
-----------------------------------------------------------------------------------------------------------------------
在Suite『Main Query Page』中也有一個Resource「DML.robot」,主要定義需要使用到的SQL語法
TestCase便可直接引用「DML.robot」的Variable "${select_Basic_Hospital}"
-----------------------------------------------------------------------------------------------------------------------
Connect Database
${DB_List} Create List
${queryResults}= Query ${select_Basic_Hospital}
${Verify_List} Convert To String ${queryResults[0][0]}
#會得到↓
#_hlthealthy_1
${Verify_List} Convert To String ${queryResults}
#會得到↓
#(u'_hlthealthy_1',)
沒有留言:
張貼留言