Aubergine (BDD for .net) v0.05 : text stories/html & custom output/cmdline parser

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 !!

Bookmark and Share

About Tom

Tom Janssens op LinkedIn

Tom Janssens op twitter

Core bvba RSS

 

Tom Janssens is an independent freelance ICT consultant that has been "into computers" ever since the age of 7.

Typing source code from a book evolved into exploring the limits of coding in procedural, assembly and object-oriented languages.
As he matured in software coding, he started focussing on the problems surrounding software development, and learned that software development is usually about people and interactions first, and about technology second.

Due to his diverse track record he gained insights in a lot of aspects of the software development process. Currently his main focus is on strategic ICT advice, lean product/project development and improving the software development process and architecture.

He avoids ivory-tower-approaches by applying and verifying the applicability of the latest tech buzz in software experiments.

He is also the founder of the following LinkedIn groups:

CQRS Professional
BDD Professional
Asp.Net MVC professional

More info about Tom and his company...


Advertisement

Forget all your SCRUM -, Kanban - and other Agile and Lean certificates

Here is the only true AGILE and LEAN certificate you will ever need:

The Creative Recursive Analysis Process Certificate
(CRAP Certificate for short)

More info can be found at the official CRAP certificate website:
http://bit.ly/CRAPCertificate