From MbUnit to NUnit

Here at TDPG we do TDD, so we have a huge amount of tests for our products.

When the project I’m working on started, about 1 and a half years ago, we were using MbUnit and Rhino Mock. After few months with Rhino, we decided to migrate to Moq, because of the nicer syntax, easy of use and better error messages.

As .NET developers, one of the tools we use all the time is ReSharper, it’s a wonderful product that help with TDD, makes refactoring super easy, and overall increment our productivity a lot.

To support our Agile Development process and TDD development, we set up a CI (http://bit.ly/KEgGa) platform

Unveil the Power of BDD with SpecFlow and Selenium Part 1

I am working at a business intelligent product for estate agents, and being it a quite unique and new product, the specs are always changing to meet the agents requirements, that are often very different depending on their market.

First: Selenium is clearly the product I want to use to do UI testing. It’s the most widely adopted product to do Test Automation for Web Applications, and it’s used an supported by Google.
For a certain period I considered to use WebAii, I love their APIs, much more .NET friendly, but It couldn’t run tests with chrome at that time, so I dropped it for Selenium.

Second: I needed a way to keep business requirements in sync with my behaviour testing suite. BDD is a widely accepted  agile software development technique, that allows to write test in the Given/When/Then form, a concept similar to the AAA(Arrange, Act, Assert) used in TDD. There are many different frameworks (http://en.wikipedia.org/wiki/Behavior_Driven_Development#Tools) that helps with BDD in .NET, many makes you write code to define tests, but the one I like the most is SpecFlow.
The reason why I like SpecFlow, is that it allows me to write the tests in plan English.
It uses gherkin as language(http://github.com/aslakhellesoy/cucumber/wiki/gherkin). It was first used by Cucumber for Ruby another BDD framework for Ruby.

This allows me to write the tests together with the business team, there’s nothing technical about it, and it really make the requirements clear for the business and development team, and help to manage the end user expectations.

Untitled

“SpecFlow aims at bridging the communication gap between domain experts and developers by binding business readable behaviour specifications to the underlying implementation.”

http://specflow.org/

“Selenium is a robust set of tools that supports rapid development of test automation for web-based applications. Selenium provides a rich set of testing functions specifically geared to the needs of testing of a web application. These operations are highly flexible, allowing many options for locating UI elements and comparing expected test results against actual application behaviour.”

http://seleniumhq.org/

Here you can download the example of how I’m using the 2 together.

Prerequisites:
Install    Web Deployment Tool
http://www.iis.net/download/webdeploy

Install Java JDK               
http://www.oracle.com/technetwork/java/javase/downloads/index.html

Install SpecFlow                References/SpecFlowSetup_v1.4.0.msi

Have a look at                    References/SpecFlow Guide.pdf
    *if you want to change the testing framework

DownloadDownload the example

OPEN the solution
RUN smnbss.Selenium.Web
RUN the tests in smnbss.Selenium

 

In part 2 I’ll explain my implementation.