Demo Example1

  1. 了解 test case(用spoken language寫)跟 implement code(用programming code寫)
    間的對應關係
  2. 熟悉 Gherkin 的 keywords: Given, When, Then, And, But,

Robot framework Demo test case

Test case: cellular.robot
Implement code: Router.py

[Test Setup & Test Teardown]
Robot內建的做法,表示每個test case一開始/結束後都會做動此部分的運作

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

[Tags]

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

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


Test case 內文部分

  • Test case 中的 Given And When Then 是 Gherkin語法定義的 keywords
  • 這些 keyowrd 後面接的句子,舉例來說 cellular.robotGiven SIM PIN is set to
    SIM PIN is set to 會在 Router.py定義這個step叫@keyword('SIM PIN is set to')

cellular.robot與Router.py對應的example

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


Cucumber Demo test case

Test case: cellular.feature
Implement code: router.py

  • @ 類似在robot 中 tag 的效果
  • Background 類似於 robot 的 test setup,會在執行case之前,先去做動這塊precondition

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
感謝共編
Mike