1. 程式人生 > 其它 >robot用例執行常用命令(轉)

robot用例執行常用命令(轉)

執行命令
  • 執行一個用例
robot -t “testcase_name“ data_test.robot
  • 按用例檔案執行
robot data_test.robot 或者 robot --suite “prjxx.robot.data test" test_directory
  • 執行目錄下所有用例
robot test_directory 或者 python -m robot test_directory
  • 按執行tag執行用例
robot --include smoke test_directory robot --include smoke path/test_file.robot
  • 剔除用例執行
robot --exclude smoke test_directory 或者 robot --exclude smoke path/test_file.robot
  • 亂序跑
可以有效避免testcase之間的依賴,保持獨立性是testcase持續有效的關鍵 robot --randomize tests path/test_file.robot
  • 變數引數
可以更新多個變數,達到每次跑不一樣內容的目的,例如可以通過命令切換環境,切換資料等 robot --variable ENV:uat --variable TEST_DATA:uat regression.robot 結果報告
  • 生成執行報告
預設生成到當前目錄,會包含output.xml、log.html、report.html 可以對其分別修改,引數如下: --outputdir (-d) --output output.xml --report report.html --log log.html 不想要某個報告可以設定None,例如: --output NONE --report NONE --log NONE
  • 結果定位
不同的執行結果會有不同的結果程式碼(RC),用於快速定位問題 RC Explanation 0 全部通過 1-249 出現250個內的錯誤用例 250 出現250個內的錯誤用例 251 幫助資訊列印 252 異常測試資料 253 使用者中斷了執行 255 無法識別的異常
  • 合併結果檔案
rebot -N new_report.html -o new_output.xml 1st_output.xml 2nd_output.xml
  • 合併目錄下所有的結果
python -m robot.rebot --name Combined outputs/*.xml
  • 抽取整合測試結果
rebot --log smoke_log.html --report smoke_report.html --include smoke --ReportTitle Smoke_Tests --ReportBackground green:yellow:red --TagStatCombine tag1ANDtag2 path/to/myoutput.xml 資料生成
  • 輸出當前框架的lib庫說明文件
python -m robot.libdoc OperatingSystem OperatingSystem.html
  • 生成用例文件
python -m robot.testdoc xxx_prj1.robot/*.robot testcasedoc.html robot用例執行常用命令(轉) 執行命令 執行一個用例 robot -t “testcase_name“ data_test.robot 按用例檔案執行 robot data_test.robot 或者 robot --suite “prjxx.robot.data test" test_directory 執行目錄下所有用例 robot test_directory 或者 python -m robot test_directory 按執行tag執行用例 robot --include smoke test_directory robot --include smoke path/test_file.robot 剔除用例執行 robot --exclude smoke test_directory 或者 robot --exclude smoke path/test_file.robot 亂序跑 可以有效避免testcase之間的依賴,保持獨立性是testcase持續有效的關鍵 robot --randomize tests path/test_file.robot 變數引數 可以更新多個變數,達到每次跑不一樣內容的目的,例如可以通過命令切換環境,切換資料等 robot --variable ENV:uat --variable TEST_DATA:uat regression.robot