Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Behavior driven development


Published on

For more information:

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Behavior driven development

  1. 1. Behavior Driven Development (BDD)
  2. 2. BDD• Behavior driven development, commonly known as BDD, defines a set of rules driving software development by writing the intended behavior as test cases before actually developing any real software.• It adds confidence to the tests by making sure they fail as no code has been developed.• This practice is referred to as outside-in development and when done right leads to a minimum of code being written for passing the given test cases.• The test cases should be written as simply as possible at first and be revisited as the development progresses.• Working project skeleton is built at first and more and more complex functionality is added as the product matures.
  3. 3. Cucumber• Cucumber is a BDD framework originally developed for Ruby. – Now it covers a multitude of different programming languages.• It provides common ground between different project stakeholders.• It allows developers to write acceptance tests and software behavior in a natural language through a set of common keywords that are mapped to executable code blocks using regular expressions.
  4. 4. Feature• A feature in cucumber wraps inside of it a set of scenarios in some larger context, each feature should contain a name and some description of what the feature does.• Features should be written clearly and provide enough details to prevent miscommunication between different stakeholders or team members.
  5. 5. Scenario• A scenario is a more concrete example of behavior inside a cucumber feature.• It describes the way the software should behave under a specific set of steps or user actions in a particular situation.• Each scenario should be built in a way where they can be executed independent of each other.• Similar scenarios can be grouped under a Background-step, running them inside some common context.
  6. 6. Steps• A step, Given, When, Then, And, But or a short syntax that can be used to replace any of these, the asterisk (*), are used to construct a scenario, to define the actions executed inside that context.• Given should be to denote the actions required to set up the scenario, When is used to denote events and Then for the expected outcome.• All of these can be accompanied by And and But if they require multiple actions, the But keyword being used for some invalid action an user might take.
  7. 7. Steps• Eventually each step is mapped into executable code blocks through regular expressions.• Regular expressions are what cucumber looks for, they are the technical part of testing with cucumber and contain the actual code being used to test the software.