# 6/17 共筆 {%hackmd 1lpg7PuqRoaui6XyJcrylw %} ## 檔案 - 分類 - Test Suites - Resorce - 擺放 ## Test Suites (.robot) - Setting ``` *** Settings *** Documentation The Firewall function is used to filter traffics. Resource ./resource/routine.resource Resource ./resource/config.resource Library ./library/Firewall.py ${HOST} ${PORT} ${PROMPTS} Test Setup log in DUT admin moxa Test Teardown Make cellular connectted and close session ``` - import先後順序有影響 - 變數宣告 - 來源 - 檔案內 - 在Variable section - 在Test Case下 - 檔案外 - 以resource檔讀入 - 以python檔讀入 - Syntax - [Build-in keyword(function)](https://robotframework.org/robotframework/latest/libraries/BuiltIn.html) - variable file, resource…etc - 說明變數用法。 ![](https://i.imgur.com/k9Ad32q.png) ![](https://i.imgur.com/UrsStiB.png) List ![](https://i.imgur.com/kV5OHLk.png) - @ 後面接的型態一定要是一個list - 58行若使用@會有問題 Dictionary ![](https://i.imgur.com/loo4EDH.png) ![](https://i.imgur.com/2OrR1MY.png) Evaluate 非單層的宣告 ![](https://i.imgur.com/QB89IPS.png) - Resource file - 沒有包含test cases section的file - ![](https://i.imgur.com/qLoAtGO.png) - ![](https://i.imgur.com/gFSABvx.png) - import from resource 的變數是在外部宣告 - 建議副檔案命名為`.resource` ### Example4 ![](https://i.imgur.com/MU2KPAW.png) ![](https://i.imgur.com/9Zb0LK5.png) ![](https://i.imgur.com/AAZsRuL.png) ![](https://i.imgur.com/kSoGJkd.png) 至於變數要在哪裡定義需要考量...? - 譬如果是共用的config,可能適合用resource file等 --- [Robot Framework User Guide 2.5-2.8](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html) :::info :heart: **感謝共同編輯** Sabrina :::