## 維護 Ruby code 架構

### 網頁架構：Page Object Pattern

Page Object Pattern:

Within your web app’s UI there are areas that your tests interact with. A Page Object simply models these as objects within the test code. This reduces the amount of duplicated code and means that if the UI changes, the fix need only be applied in one place.

• item_group

• bottom

### 自動化測試：Selenium Grid

Selenium Grid 是一個 Hub-Node 的架構，我們對 Hub 下指令，Hub 會基於我們的指令對要求的 Node 進行測試，運用 Selenium Grid 可以讓我們對遠端 Browser 下指令執行、平行化測試、集中化管理、跨平台等優點。（這邊不多作介紹，預知更詳細可以到Selenium Grid wiki上查看）

Jenkins 上各種瀏覽器的自動測試 jobs 狀態：

## 建置 Webdriver.io 架構

### 特性

Extendable:

Compatible:

Feature-Rich:

（指的是可以不用自己購買硬體的設備，直接透過網路來操作運用雲端服務提供的測試設備）

### 建置 webdriver.io + cucumber 架構

Webdriver.io 在這邊告一個段落，以下是我建置的 webdriver.io + cucumber 架構：

## Feature Introduction

Every .feature file conventionally consists of a single feature. A line starting with the keyword Feature followed by free indented text starts a feature. A feature usually contains a list of scenarios. You can write whatever you want up until the first scenario, which starts with the word Scenario (or localized equivalent; Gherkin is localized for dozens of languages) on a new line. You can use tagging to group features and scenarios together independent of your file and directory structure.
Every scenario consists of a list of steps, which must start with one of the keywords Given, When, Then, But or And. Cucumber treats them all the same, but you shouldn’t. Here is an example:

## Step definitions

For each step Cucumber will look for a matching step definition. Each step definition consists of a keyword, a string or regular expression, and a block.
This step definition uses a regular expression with one match group — (\d+). (It matches any sequence of digits). Therefore, it matches the first line of the scenario. The value of each matched group gets yielded to the block as a string. You must take care to have the same number of regular expression groups and block arguments. Since block arguments are always strings, you have to do any type conversions inside the block, or use Step Argument Transforms.
When Cucumber prints the results of the running features it will underline all step arguments so that it’s easier to see what part of a step was actually recognised as an argument. It will also print the path and line of the matching step definition. This makes it easy to go from a feature file to any step definition.