本文采用Eclipse及其對應的插件來編輯、管理、運行Robot Framework.
https://www.eclipse.org/downloads/ 本文安裝 Eclipse IDE 2020‑03 64bit
下載得到文件: eclipse-inst-win64.exe 在windows上雙擊運行。 具體的安裝過程略。
安裝Eclipse的插件
可參考文檔:https://github.com/NitorCreations/RobotFramework-EclipseIDE/wiki/Installation
Installing using update site
- Start Eclipse, then select Help > Install New Software.
- Click Add, in the top-right corner. In the Add Repository dialog that appears, enter "RobotFramework-EclipseIDE" for the Name and the following URL for the Location: http://sourceforge.net/projects/robotide/files/stable/
- Click OK.
- In the Available Software dialog, select the checkbox next to Robot Framework Eclipse IDE and click Next.
- In the next window, you'll see a list of the tools to be downloaded. Click Next.
- Read and accept the license agreements, then click Finish.
- When the installation completes, restart Eclipse.
- See usage for more information about configuring and using the plugin.
接受協議,安裝之後,需要重新啓動。
安裝 RED - Robot Editor
Install from Marketplace/Update Site
Marketplace: Click Help -> Eclipse Marketplace -> and type into Find field "RED" Update Site: Click Help -> Install New Software -> Add and set address in Location to:
http://master.dl.sourceforge.net/project/red-robot-editor/repository
由於Robot使用UTF-8編碼格式,因此需要設置Eclipse默認使用UTF-8格式。
重啓Eclipse之後,設置Robot視圖。
設置代碼內容自動輔助,代碼自動補齊
Window -> Preferences -> Robot Framework -> Editor -> Content Assist.
.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$@&*:
下面就可以創建Robot的工程了。
建立第一個Robot工程
工程文件結構如下:
新建第一個測試套件,在工程test01鼠標右鍵彈出如下菜單
在測試套件裏寫一個測試用例: 測試用例1
運行測試用例
運行結果如下:
上面顯示全部測試通過。
還可以點擊上面的鏈接查看 report.html