https://github.com/cucumber/cucumber/wiki/Step-Definitions的文档很棒,有大量的细节。对于一个新手来说,他们有点难以接受。
我只想了解我的英语规范将如何与它将要执行的代码相关联,以及将哪些文件放在哪里。什么是高层次的总结?
发布于 2017-06-15 15:40:26
对于这个规范:
Feature: Buy car
Scenario: Jeff buys a car
Given Jeff sees a car he want
And he has the cash
When he pays cash
Then Jeff should own the car上面的规范文件名为buy_car.feature,放在/spec/features/中。
Scenario: Jeff buys a car内部的步骤(给定,何时)将引用ruby文件spec/features/step_definitions/buy_car_steps.rb,该文件的内容如下:
Given("Jeff sees a car he wants") do |car|
perform capybara action to display car, e.g. visit, click, etc.
end
When("he pays cash") do |pay|
perform payment actions (front or back end as desired)
end
And("he has the cash") do |cash_check|
perform code to check bank balance is sufficient
end
...我认为这是正确的东西的去向和如何命名,但欢迎审查和任何纠正。我一直觉得黄瓜文档有点难开始,所以想要帮助人们开始另一个简单的例子。
https://sqa.stackexchange.com/questions/27825
复制相似问题