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. Get the requirement/feature, from your Business Analyst, as a User Story.
  2. For each user story, create behaviours/scenarios in Gherkin language as explained below.
  3. For each Gherkin/behaviour, create a unit test (you can use SpecFlow tool).
  4. 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:


0 comments: