1.create session:創(chuàng)建session.作用:跨請(qǐng)求保持一些cookie
2.get request 态辛,發(fā)出get請(qǐng)求梁沧。若使用參數(shù)組構(gòu)建的url訪問碧库,需要用params=${params}
3.post request ,發(fā)出post請(qǐng)求涡贱。需要帶params,且params=None愕把,位于data之前凯力。data是傳參。比如:
${resp} post_request bx /oz/login params=None data=${bx_login_req} headers=${online_cookie}
4.set_suite_variable:使變量在當(dāng)前套件的范圍內(nèi)隨處可用礼华。
set_suite_variable ${mock_url} http://${test_site_domain}.baidu.cn
類似還有:set_test_variable
5.run_keyword_if: 條件判斷
run_keyword_if addition keyword 。拗秘。圣絮。。
run_keyword_if '${env}'=='test' set_suite_variable ${mock_url} http://${test_site_domain}.baidu.cn
6.connect_to_database_using_custom_params: 使用自訂參數(shù)連接到數(shù)據(jù)庫(kù)中
connect_to_database_using_custom_params pymysql ${test_db_connect}
test_db_connect: host='192.168.x.xx',port=3306,user='xxxx',passwd='xxxx',charset='utf8'
7.斷開數(shù)據(jù)庫(kù)鏈接disconnect_from_database
8.get_current_date
${start} get_current_date result_format='%Y-%m-%d'
${end} add_time_to_date ${start} ${renewVersions_req['time']} days result_format='%Y-%m-%d'
4.斷言方式
響應(yīng)碼:Should Be Equal As Strings ${resp.status_code} 200
狀態(tài)碼:Should Be Equal As Strings {resp.json()['status']}{0}
返回信息:Should Be Equal As Strings ${resp.json()['msg']} success
返回空:Should Be Equal As Strings {resp.json()['desc']}{EMPTY}
檢查返回的文字:Should Contain Any ${resp.text} 今日統(tǒng)計(jì)
Dictionary Should Contain Value ${resp.json()} xxxx
Should Be Equal