Tuesday, March 1, 2011

Test Driven Development In C Sharp

Test Driven Development in C#.
This is a Short Introduction for Test Driven Development in Visual Studio 2010.

This tutorial will contain short and basic explanation of Test Driven Development followed by a quick walk through in Visual Studio 2010 written in C Sharp.

For those of you who don't know, Test Driven Development is a different way of coding.  Some say a different way of life.  Instead of first developing your software and then test it, What Test Driven Development Methodology offers is to first test, then code.

Basically it allows us to cover a variety of User Stories and Test Cases, build the tests for them and only after all is covered - start coding while testing our code every step of the way. 

Some principles of Test Driven Development:
  1. Tests serve as examples of how to use a class or method.
  2. Naming. be explicit as possible so that everyone will be able to understand, rewrite and maintain your tests.
  3. There's a simple "3 A's" pattern for test driven development:
    1. Arrange - Variable Deceleration.
    2. Act - invoking the code under test.
    3. Assert - using the Assert Method to verify that expectations were met.

This short video walk-through will try to give you a basic understanding of the Test Driven Development.

This  walk-through will include a CalcTest project and a Calc project which will have one basic method:
  • Add.
video


Good luck,
Elad Shalom,
CTO at ITweetLive.com