Tuesday 24 May 2011

Behaviour Driven Design and Domain Driven Design

1) DDD:
The purpose of Domain Specific Language (DSL) is to create a bridge between the technical and non-technical people. DSL is important in Domain Driven Design (DDD).

2) BDD:

BDD is pretty simple to understand:
  1. Business Analyst should communicate with the Business and gather requirements as User Stories.
  2. The Business Analyst should go through each user story with 1 or 2 developers and testers to create Main Scenarios and Edge Case Scenarios by Example using Gherkin Language and these can be saved in TFS or a similar tool.
  3. Business Analyst should prepare all user stories with their details then ask all developers and testers to read all of them before the Sprint Planning session.
  4. In Sprint Planning session, everyone should have already read the stories and its purpose is purely to estimate the work required for each User Story. If people are asking so many questions, it shows pre-sprint planning has failed.
  5. Now Sprint Starts
  6. For each Gherkin/behaviour, create a unit test and end to end test (you can use SpecFlow tool).
  7. Implement your code until your test passes.
Gherkin Language
Gherkin Language is a language used to represent specifications or scenarios in the following format: "Given -When - Then"

It is a language to define behaviour of the modules and basically test cases (scenarios) are created from these behaviours easily.

Example:
Given user opens a browser and navigates to the Google.com site
When user enters "BDD" or user enters "DDD"
Then result of the search are listed on the page.

or
Given I have gone to an interview well-prepared
When I answer all the challenging questions of the interviewers properly
Then I'll get a job offer!

  • A free tool which can be used to convert Gherkin to unit tests
  • It can be integrated into Visual Studio
Resources:


No comments: