BDD(ROR) Using Cucumber/Rspec

BDD(ROR) Using Cucumber/Rspec

05 Aug 2016
3 Comments
BDD(ROR) Using Cucumber/Rspec

A cucumber is a tool that executes plain-text functional descriptions as automated tests. While Cucumber can be thought of as a “testing” tool, the intent of the tool is to support BDD This means that the “tests” (plain text feature descriptions with scenarios) are typically written before anything else and verified by business analysts, domain experts, etc. nontechnical stakeholders.

 

Gherkin

Gherkin is the language used to write features, scenarios, and steps. The purpose of the language is to help us write concrete requirements.

 

4 Steps in Defining a Feature

  • Cucumber begins by defining a “Feature” that we are trying to implement.
  • After that, we specify what we want to do using “In Order”.
  • We specify a user who will be interacting with that feature using “As a”
  • And then we finally specify what do we expect using “I want”

 

#Example:user.feature

Feature: User login In order to log in As a User I want to specify a valid credential and login

 

Cucumber steps

  • Cucumber internally uses capybara
  • You can use any other acceptance test framework e.g. Webrat

 

Scoping

  • Capybara makes it possible to restrict certain actions, such as interacting with forms or clicking links and buttons, to within a specific area of the page
  • You can use within DSL to specify a scope e.g. within(“#form-group”)
  • You can also further restrict it to a table e.g. within_table(“customer-table”)



Comments

Name:

rental car coupon codes avis

Message:

It’s hard to find experienced people in this particular subject, however, you seem like you know what you’re talking about! Thanks

Reply:

Name:

Marel

Message:

/ In GOD I trust and In GOD my family trusts, it is through HIM, with HIM and becasue of HIM that we are truely Graced. So tired of the liberal veiw, worship your mighty dollar, I will worship my Lord, because at the end of the day, when all you have are pennies to count, I am counting my abundant blegsinss.

Reply:

Name:

rhhxjifa

Message:

20

Reply:


Leave a comment: