# Hands-on/Example1 {%hackmd 48QQ4miqSxmUyp2CZ-kBSw %} ## Clone Repository :::info :bulb: 有問題請先服用[開發環境問題/Git](/H1voIxJwSA2f5gSs_xfDMQ) ::: 1. 從GitLab將repository複製下來 ```bash=1 git clone http://mhqnetgitlab.moxa.com:10080/SimonWX_Zhao/auto-test-practice.git ``` 2. 移動到repo中,**接下來都在這個資料夾下操作!** ```bash=+ cd auto-test-practice ``` ![](https://i.imgur.com/nKHyXoB.png) 3. 檢查`tag`出現`example1-r`和`example1-c`標示正確 ```bash=+ git tag ``` ![](https://i.imgur.com/GJLBkBT.png) ## 執行Rrobot framework example 1. 移動標有`example1-r`的commit ```bash=1 #要執行這行才會到robot這個commit上 git checkout example1-r ``` 2. 檢查在git tree上的位置,`HEAD`指到`example1-r`就對了 ```bash=+ #看看有沒有到這個commit上 git log --graph --oneline --all ``` ![](https://i.imgur.com/wYK61E8.jpg) :::info :bulb: 切換到另一個branch時,記得refresh一下 ![](https://i.imgur.com/oBMKGHd.png) :question: 嘗試重新整理VSCode的Explorer或在Terminal中下`ls`,資料夾下檔案的變化有什麼變化? ::: 3. 執行robot framework的自動測試功能 ```bash=+ robot -d result cellular.robot ``` 4. 檢查測試結果 - 在Terminal中長這樣 ![](https://i.imgur.com/hPf0mda.png) - 到Windows相對應的資料夾中開啟log.html,察看有排版的格式 ![](https://i.imgur.com/vaCX6qh.png) ![](https://i.imgur.com/QkeBB7i.jpg) ## 執行Cucumber example 1. 移動標有`example1-c`的commit ```bash=1 #要執行這行才會到robot這個commit上 git checkout example1-c ``` 2. 檢查在git tree上的位置,`HEAD`指到`example1-c`就對了 ```bash=+ #看看有沒有到這個commit上 git log --graph --oneline --all ``` ![](https://i.imgur.com/8028QMb.png) 3. 檢查測試結果 ```bash=+ behave -f html -o log.html -f pretty cellular.feature ``` - 在Terminal中長這樣 ![](https://i.imgur.com/uJ32RZr.png) - 到Windows相對應的資料夾中開啟log.html,察看有排版的格式 ![](https://i.imgur.com/QIT7Jyo.jpg) :::info :heart_decoration: 感謝共編 Sabrina :::