110 likes | 357 Views
Making BDD fun with Ruby and Cucumber. Andrei Marfievici. Content. What is BDD? Why Ruby and Cucumber Live Demo Conclusions. What is BDD?. Inspired from TDD and complements DDD It’s NOT unit testing where: Unit test tools are written mainly for developers Tests are methods names
E N D
Making BDD fun with Ruby and Cucumber Andrei Marfievici
Content • What is BDD? • Why Ruby and Cucumber • Live Demo • Conclusions
What is BDD? • Inspired from TDD and complements DDD • It’s NOT unit testing where: • Unit test tools are written mainly for developers • Tests are methods names • It does a great job for object/module testing • It takes a technical person to understand the assertions and failures • It takes a lot of time to gain domain knowledge
What is BDD? • Story testing approach • Complex interactions between ALL the people involved in a project • Functionalities trigger the development process • Specs Features Behavior Scenarios • DDD defines the vocabulary (the words) whilst BDD defines the sentences to put the words in
What is BDD? • A functionality describes a feature • As a Role • I request a Feature • To gain a Benefit • Example: • Feature: Search for music data • As a Last.fm user • I want to be able to search data • So that I can listen to my favorite music
Why Ruby and Cucumber? • Describe features in plain text through scenarios • Cucumber understands Gherkin language • GWT approach for writing scenarios: • Scenario: Basic Search • Given I navigate to http://www.last.fm • When I search for “ac/dc” • Then I get results back
Why Ruby and Cucumber? • Wrap code inside steps
Why Ruby and Cucumber? • Can be used as a scripting language • Powerful Lightweight OOP language • Size of the project • Multi-platform • Easy to integrate with CI servers • Great support on ruby gems • IRB debugging and on-the-fly development • A minus for serialization
Conclusions • Unified SDLC through feature files • Outside-in approach • Feature coverage • Brings people together (“help me to help you”) • The power of concrete examples creativity • Great documentation for the project • Validation comes first