2011/12/23

Dynamic binding for data-driven tests in MbUnit v3

MbUnit v3.3 has been now released for a while and I realize that I have completely forgotten to write about the new nifty features added by our fellow contributor Aleksandr Jones. Aleks had added a couple of very powerful attributes for writing data-driven tests. He had even written some useful documentation in the Gallio wiki. Those attributes provide a seamless way to bind automatically your external data sources (CSV or XML data files) to the test parameters.

Basically you can declare your test parameters as "dynamic" variables and let MbUnit to bind automagically the parameters behind the scene. Of course it also means that the feature is only available for test projects targeting the .NET 4 framework.

Let's consider the following simple comma-separated example data file:

Let's now write a test method which loads the file and gets data from it. We could have used the classic [CsvData] attribute to bind explicitly the parameters. But with the new [FlatFileDataObject] attribute, it's far easier:
Look at how the different properties of the test parameter were bound and printed in the test log.
That's just awesome! Good work Aleks!

2011/12/19

Web Testing with MbUnit and WatiN

A serie of articles of mine have been published recently on developerFusion.com. The articles explain how to use efficiently Gallio/MbUnit and WatiN to test your web applications. You can find already many interesting articles about web testing here and there. What I tried to do is to focus on a few less treated problems like testing on the local host, web pages with AJAX requests, controlling the Visual Studio web application server, etc. Good reading!
A big thank you to Dan Maharry and all the editorial team of developerFusion.com for having reviewed my articles.