# Demo Example1
{%hackmd 1lpg7PuqRoaui6XyJcrylw %}
:::info
1. 了解 test case(用spoken language寫)跟 implement code(用programming code寫)
間的對應關係
2. 熟悉 Gherkin 的 keywords: Given, When, Then, And, But, ...
:::
### Robot framework Demo test case
:::info
Test case: `cellular.robot`
Implement code: `Router.py`
:::
`[Test Setup & Test Teardown]`
Robot內建的做法,表示每個test case一開始/結束後都會做動此部分的運作


`[Tags]`
- Robot 用來給 case 或是變數等的標籤,可以在 report 呈現,以這舉例report裡面就會有 BVT 跟 major 這兩個 tag
- 可以用 tag 來選擇要執行特定的 test case
- Tag可以用在 case或是用在suite都可以

---
### Test case 內文部分
- Test case 中的 Given And When Then 是 Gherkin語法定義的 keywords
- 這些 keyowrd 後面接的句子,舉例來說 `cellular.robot`中 `Given SIM PIN is set to`
的 **SIM PIN is set to** 會在 `Router.py`定義這個step叫`@keyword('SIM PIN is set to')`
**cellular.robot與Router.py對應的example**

---
### Cucumber Demo test case
:::info
Test case: `cellular.feature`
Implement code: `router.py`
:::
- `@` 類似在robot 中 tag 的效果
- `Background` 類似於 robot 的 test setup,會在執行case之前,先去做動這塊precondition

---
:::info
:heart_decoration: 感謝共編
Mike
:::