The Code Gorilla
Showing posts with label TDD. Show all posts
Showing posts with label TDD. Show all posts

Friday, 22 March 2013

Getting started with SpecFlow (Part 2)

This is part 2, if you've not read part 1 please do. Download source code

Quick recap


We have our solution, Dentist with one project Dentist.Specs with a single feature file called BookAnAppointment.feature.
Its now time to generate some code, if you have previously generated the steps then select the step file you created and delete it.

Part 2 - Time for code


Wednesday, 20 March 2013

Getting started with SpecFlow (Part 1)

This blog post will, hopefully, provide a good starting point for those interested in using SpecFlow and BDD. This example is developed using SpecFlow 1.9, MsTest and Visual Studio 2012.

I won't go into what BDD is, or try to explain the Gherkin language as used in Specflow. This will be a basic project run through to get you started with your first Specflow & BDD based projects.

This project will be based on developing a simple system for the purpose of booking appointments at a dentist, there a multiple layers to this n-tier system.

Data Layer (DataModel)
 |
Domain Layer (DomainModel)
|
Presentation Layer (UI)

Part 1 - Defining the Scenarios

In this example, we shall be using BDD to explain the behaviour of the business domain layer and not worry about the presentation layer for now (I wish to keep the example simple).

Saturday, 9 March 2013

Unit testing

If you're here, then your thinking about testing. Please visit my articles on SpecFlow for BDD to bring something new to testing.

There is lot to be said about unit testing (or testing via code), and a lot of opinions on the right and wrong way to do this. The first thing I say about code testing is that it doesn't matter how you do it or how much or how effective it is, we all need to start somewhere - just as long as you are doing some form of code testing it means your can build on it and address those areas where improvements can be made.

I follow three levels of code testing:
  1. Unit testing (strict AAA)
  2. Interaction testing (or integration testing)
  3. System testing (as much as can be done)