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.

Advertisements

5 thoughts on “Unveil the Power of BDD with SpecFlow and Selenium Part 1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s