Ruby on Rails testing

Ruby on Rails / Testing – Behavior Driven Development

Ruby on Rails / Testing – Behavior Driven Development February 17, 2018Leave a comment

In a contrast to Test Driven Development in a Behavior Driven Development you create software by describing it from the end user perspective. In BDD you didn’t test given method but a given scenario.

If you have a sign in form in your application you can create following scenarios:

  • Given I am a guest when I enter sign in form and I input valid email address and password, then application redirects me to my account
  • Given I am a guest when I enter sign in form and I input invalid email address and valid password, I will see an error notification

In Ruby on Rails you can implement acceptance tests using RSpec or Capybara. In order to get the best results it’s good to have both unit and acceptance tests. From the business perspective implementation details are less important than application behavior but from performance perspective is inversely.

It’s a success to satisfy both business and performance goals and proper tests are one of the best tools available to achieve this.

Download free RSpec & TDD ebook

Do you want to earn more or jump to the next level in your company? Do you know that testing skills are one of the most desired skills? There is only first step: start testing and do it right. My ebook can help you. Subscribe to the newsletter to get a free copy of the book.

Leave a Reply

Your email address will not be published. Required fields are marked *