如何編寫場景大綱以根據輸出10個不同變量的一個變量測試計算?黃瓜場景概要與數據表 - 未找到水豚元素
我已經試過各種選項和獲取各種錯誤包括:
Unable to find option "<frequency>" (Capybara::ElementNotFound)
和
(Cucumber::ArityMismatchError)
下面的代碼給出了水豚:: ElementNotFound錯誤
Scenario Outline:
When I select "<frequency>" frequency
And I press recalculate
Then I should see total amount and percentages recalculated by <frequency> frequency on the results page
Examples:
| frequency |
| weekly |
| daily |
Examples:
| tax | sub-total | total |
| 38.25 | 114.74 | 191.24 |
| 3.19 | 9.56 | 15.94 |
步驟定義
When(/^I select "([^"]*)" frequency$/) do |frequency|
select "<frequency>", from: "frequency"
end
Then(/^I should see total amount and percentages recalculated by <frequency> frequency on the results page$/) do |table|
expect(results_page).to have_content("<tax>")
expect(results_page).to have_content("<sub_total>")
expect(results_page).to have_content("<total>")
end
形式標記
<form action="change_result_frequency" method="post">
<label for="frequency">Frequency</label>
<select name="frequency" id="frequency">
<option value="yearly">yearly</option>
<option value="monthly">monthly</option>
<option selected="selected" value="weekly">weekly</option>
<option value="daily">daily</option>
</select>
<input type="submit" name="commit" value="Recalculate">
</form>
我是新來的黃瓜和水豚,所以我不知道該如何寫方案概述了數據表。我究竟做錯了什麼?