As most of you probably know I'm a huge fan of automated tests.
Of course unit tests help you to find bugs easily in code and api's.
But when we are releasing a product to our customer for acceptance testing of some (or all) features, I also want to know if the product works as expected.
These tests are about behaviour of the application and that's why I prefer BDD (behaviour driven design) over TDD (test driven design). Because it's closer to what our customer understands.
In the end, customer tests are mostly done by testing the UI, because that is what they'll use. Not the code and unit tests.
So we need a way to have automated (integration) tests to test the UI of our application.
This is where SpecFlow comes in. SpecFlow is an open source, .NET based, testing framework which allows you to write BDD and ATDD (acceptance test driven design) style tests. These are much better to understand for the customers than our technical (coded) tests.
SpecFlow is quite similar to Cucumber (which is in Ruby) and uses the same syntax to write your tests.
By adding some extra frameworks you can control the UI from the tests SpecFlow generates for you. This allows you to test the UI for the test scenarios, just like the customer would do. Only faster and much more reliable :-).
Because there is already a lot of material on the internet, I'll just share some links with you without writing a complete demo myself.
Web based applications:
Windows Forms, Wpf, Silverlight applications
Combining specflow with White to test WPF:
Useful tools while working with the White framework:
UISpy - to lookup the structure of the WPF UI elements
or XamlSpy http://xamlspy.com/
More on UIautomation and WPF quality:
Windows 8 / WinRT
http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.automation.aspx http://code.msdn.microsoft.com/UI-Automation-Document-24a37c82 http://blogs.msdn.com/b/winuiautomation/archive/2011/05/18/building-ui-automation-client-applications-in-c-and-c.aspx