by
Tom
11. August 2010 07:35
Introduction
This article will give you a brief introduction on how to get started with BDD (Behaviour driven development). It is my second attempt for such an article.
I will show you the complete workflow on how to write an app using BDD in .Net.
Background
Small note: if you want to know why you should use BDD, I would like to refer you to another one of my articles: The advantage of using BDD over TDD
Today I finally managed to upgrade my Aubergine BDD framework to v0.1.
This is now starting to get really usable (I've been dogfooding it for a while now).
This release contains the following changes:
- Very basic support for NUnit
- Build script using JeremySkinner's Phantom build engine
- Properly named namespaces/dll's (i.e. no more Be.Corebvba.*)
In this spirit I decided to write a small tutorial on how to do BDD development in .Net, so maybe some people might find some use for this !!
More...
by
Tom
26. January 2010 13:48
Introduction
After reading the latest post from @jeremydmiller I felt the urge to write a small article about the BDD part since there might be missing a vital part here about BDD...
More...
by
Tom
20. January 2010 19:28
Introduction
Today I finished v0.4 of my MVCExtensions library and I pushed the sourcecode to github.
I also included a very simple tasklist, in order to show you on how to get started using this library. You can also see (slightly outdated) example code in this blog post...
You can see a demo of the tasklist app running here. (Try entering a task without a name, or with a name that has more then 256 chars to see the custom strings in action).
You can download the full sourcecode here.
Update
I now made a screencast as well. it is available here.
More...
Tags:
.net, asp.net mvc, aubergine, bdd, c#, codeproject, commercial, git, jquery, linq, open source, mvcextensions
CodeProject | Development | News
by
Tom
2. January 2010 03:02

Introduction
In December 2008 I was doing my job as a freelance technical analyst for a big company. While it was a very interesting job in several ways, I felt that a burn-out was coming up. I had no idea whether this was due to the job, or due to my personal merits ( a newborn and a one-year old son, lots of tasks and chores on my to-do list for our house, a busy social life, ...) Instead of waiting for the man with the hammer, I decided to be proactive about it, so I decided to quit the job and reinvent myself during 2009.
It has been both an interesting, very challenging and enriching year for me, with both high peaks and low valleys.
I decided to write this blog post in order to evaluate myself, and I am hoping that other people might find some inspiration in this as well.
More...
Tags:
.net, asp.net mvc, aubergine, bdd, c#, codeproject, git, jquery, machine.specifications, mspec, open source, postsharp, project quotes, unit testing, uploadify, w00t
CodeProject | Development | News | Tom's blog
by
Tom
22. December 2009 13:57
Introduction
As you might or might not now, estimating the budget for a project can be very hard sometimes. In order to get started on a project we first need a real estimate of what the client will need, and the client should know what I am going to deliver to him/her.
What I personally learned from the past is that one can never be fine-grained enough, since there will always be mismatches somewhere.
We can however try to offer the client something that he/she can both understand and work with, next to a description of what everything should do (from a business point of view).
How can we do this, while investing as little work as possible ?
Unfortunately one can not correctly estimate projects without doing some work
As straightforward as this might seem, most people do not seem to be able to grasp this ( do not be ashamed; I have been guilty as well ).
In order to give a correct estimate, you have to INVEST a decent amount of TIME.
More...
by
Tom
20. November 2009 11:01
Hi there....
After a few weeks of working on Aubergine (BDD for .Net) I have decided to release the sourcecode for this tool out in the open.
Please do give me some time as I am quite new to this whole community thing. Hints are welcome !
You can find the source on github : http://github.com/ToJans/Aubergine
And the download here: http://github.com/ToJans/Aubergine/downloads
Enjoy !!!
by
Tom
13. November 2009 17:12
Hi there,
V0.07 is here :
Auberginev0.07.zip (28,61 kb)
Changes:
* Support for "Given I did" clause (more info in this essay )
* Complete refactoring of the Account example after extending the account story (my usual Model/Service layout, although the interfaces are missing here)
Here is the current example of the account story (copied from the essay):
More...
by
Tom
13. November 2009 06:04
Just a quick link to my new essay on BDD:
Essay : Extending BDD stories ; the "Given I did" clause - including flow in user stories
I hope this is a good contribution to the BDD community
by
Tom
12. November 2009 05:30
Ok, we keep on going; now we support parameter tables for given/when/then, which are parsed as array members.
I am now getting very close to full cucumber-like support !!! Oh, I forgot to mention that the "And" keyword is also supported now !!
An example of the new syntax:
Context Be.Corebvba.Aubergine.Examples.Website.Contexts.BrowserContext
ContextDLL Be.Corebvba.Aubergine.Examples.DLL
Story Make sure my website gets enough visibility
As a website owner
I want to make sure that I get enough visibility
So that I can get enough traffic
Scenario Search results
for 'keywords' on searchengine should contain
'www.corebvba.be' Given the current url
is 'search url' When searching
for 'keywords' Then the result should contain
'www.corebvba.be' Example
+--------------+--------------------------------+------------------+
| searchengine | search url | keywords |
+--------------+--------------------------------+------------------+
| google | http:
//www.google.be/search?q= | BDD .Net |
| bing | http://www.bing.com/search?q= | core bvba tom |
| bing | http://www.bing.com/search?q= | Quantum physics |
| faulty link | http://www.googleaaa | core bvba tom |
+--------------+--------------------------------+------------------+
Scenario Search results on google for keywords should contain 'www.corebvba.be'
Given the current url is 'http://www.google.be/search?q='
When searching for the following keywords
+-----------+
| keywords |
+-----------+
| Aubergine |
| BDD |
+-----------+
Then the result should contain 'www.corebvba.be' and the following markup elements
+------------------+
| type | inner |
+------------------+
| em | BDD |
| em | Aubergine |
+------------------+
And the context :
public class BrowserContext
{
public string Url { get; set; }
public string Result { get; set; }
private WebClient wc = new WebClient();
[DSL("the current url is '(?<url>.*)'")]
void SetUrl(string url)
{
Url = url;
}
[DSL("searching for '(?<keywords>.*)'")]
void SearchForKeyWords(string keywords)
{
Result = wc.DownloadString(Url + HttpUtility.UrlEncode(keywords));
}
[DSL("searching for the following keywords")]
void SearchForKeyWords(string[] keywords)
{
Result = wc.DownloadString(Url + HttpUtility.UrlEncode(string.Join(" ",keywords)));
}
[DSL("the result should contain '(?<myurl>.*)'")]
bool ResultShouldContain(string myurl)
{
return (Result??"").Contains(myurl);
}
[DSL("the result should contain '(?<avalue>.+)' and the following markup elements")]
bool ResultShouldContain(string avalue,string[] type,string[]inner)
{
if (string.IsNullOrEmpty(Result) ||type.Length==0)
return false;
if (!Result.Contains(avalue)) return false;
for (var i = 0;i < type.Length ; i++)
{
var searchstring = string.Format("<{0}>{1}</{0}>", type[i], inner[i]);
if (!Result.Contains(searchstring))
return false;
}
return true;
}
}
It looks a bit messy, but thats because it is a stupid example. A good example would be loading a repository with some products.
Download it here !!
Auberginev0.06.zip (41,70 kb)
Enjoy !!
by
Tom
11. November 2009 21:29
Again a new release !!
* The stories are now written in text-format; unrecognized beginning of lines are skipped/not processes; example data should begin with/be seperated by "|".
* Commandline parser implemented with help
Edit 3 : v0.06 arrived
More info here !!
C:\Projecten\Be.Corebvba.Aubergine\Be.Corebvba.Aubergine.Examples\Lib>ConsoleRunner.exe /h
Aubergine Console Runner - Core bvba - Tom Janssens 2009
Usage :
ConsoleRunner [wildcard or filename for story file][...] [parameters]
Where parameters can be one of the following :
-html
Output to html unordered lists
-fmthdr,-formatheader XXXX
Header to put before starting the children output; example "<ul>"
-fmt,-formatter XXXX
Named storyformatter; example "<li>{Type} {Description} <a href='#' title='{StatusInfo}'>{StatusText}</a
></li>"
-fmtftr,-formatfooter XXXX
Footer to put after ending the children output; example "</ul>"
-h,-?,-help
Show the syntax of the commandline parameters
An example story :
Context Be.Corebvba.Aubergine.Examples.Website.Contexts.BrowserContext
ContextDLL Be.Corebvba.Aubergine.Examples.DLL
Story Make sure my website gets enough visibility
As a website owner
I want to make sure that I get enough visibility
So that I can get enough traffic
Scenario Search results for keywords on searchengine should contain my url
Given the current url is search url
When searching for keywords
Then the result should contain my url
+--------------+--------------------------------+------------------+-----------------+
| searchengine | search url | keywords | my url |
+--------------+--------------------------------+------------------+-----------------+
| google | http://www.google.be/search?q= | BDD .Net | www.corebvba.be |
| bing | http://www.bing.com/search?q= | core bvba tom | www.corebvba.be |
| bing | http://www.bing.com/search?q= | Quantum physics | www.corebvba.be |
| faulty link | http://www.googleaaa | core bvba tom | www.corebvba.be |
+--------------+--------------------------------+------------------+-----------------+
The code is still the same :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Web;
using Be.Corebvba.Aubergine.Model;
namespace Be.Corebvba.Aubergine.Examples.Website.Contexts
{
public class BrowserContext
{
public string Url { get; set; }
public string Result { get; set; }
private WebClient wc = new WebClient();
[DSL("the current url is (?<url>.*)")]
void SetUrl(string url)
{
Url = url;
}
[DSL("searching for (?<keywords>.*)")]
void SearchForKeyWords(string keywords)
{
Result = wc.DownloadString(Url + HttpUtility.UrlEncode(keywords));
}
[DSL("the result should contain (?<myurl>.*)")]
bool ResultShouldContain(string myurl)
{
return (Result??"").Contains(myurl);
}
}
}
And this is the resulting output (please try to hover over the implementation error of the "When" step with your mouse !!
Edit : apparently my blog engine team messes up the list layout !!! It are nested list items (although you can not see it here).
Processing file(s) : Website\Stories\*.txt
-
-
- Story Make sure my website gets enough visibility IMPLEMENTATION ERROR
- Scenario Search results for BDD .Net on google should contain www.corebvba.be OK
- Given the current url is http://www.google.be/search?q= OK
- When searching for BDD .Net OK
- Then the result should contain www.corebvba.be OK
- Scenario Search results for core bvba tom on bing should contain www.corebvba.be OK
- Given the current url is http://www.bing.com/search?q= OK
- When searching for core bvba tom OK
- Then the result should contain www.corebvba.be OK
- Scenario Search results for Quantum physics on bing should contain www.corebvba.be NOK
- Given the current url is http://www.bing.com/search?q= OK
- When searching for Quantum physics OK
- Then the result should contain www.corebvba.be NOK
- Scenario Search results for core bvba tom on faulty link should contain www.corebvba.be IMPLEMENTATION ERROR
- Given the current url is http://www.googleaaa OK
- When searching for core bvba tom IMPLEMENTATION ERROR
- Then the result should contain www.corebvba.be NOK
Processing file : C:\Projecten\Be.Corebvba.Aubergine\Be.Corebvba.Aubergine.Examples\bin\Release\Website\Stories\Make_sure_my_Website_gets_enough_traffic.txt
This is the postbuildstep now :
"$(ProjectDir)\lib\ConsoleRunner.exe" Accounts\Stories\*.txt Website\Stories\*.txt -html > "$(TargetDir)output.html"
"$(TargetDir)output.html"
exit 0
Include all the stories/txt-file in your project with the option of "copy to output directory" = "always" on each file...
More details/a codeproject article update will follow later...
Auberginev0.05.zip (24,86 kb)
Edit 2 : Apparently the reference is wrong (rereference Be.corebvba.aubergine.dll under the lib folder)
Enjoy !!