Automated Testing                         With SpecFlow and WaTiN                                              Dennis Doom...
About Me   • Principal Consultant   • 15 years IT experience   • C++ origins but C# since 2001   • Specialties      • .NET...
Challenges of User                              Interface                            Automation© 2012 Aviva Solutions     ...
Levels of UI Automation                                                   Stability                                 Functi...
Smoke         Specification                   Tests                 Performance         by Example                        ...
ATDD combined with TDD                             Image from Growing Object-Oriented Software, Guided by Tests© 2012 Aviv...
Deep Dive                          Demo© 2012 Aviva Solutions               30 augustus 2012
Stability                         Gherkin Scenarios    Functional                   Step Definitions          User Workflo...
Required Skills                            Scenarios                                            Coding Skills             ...
Features     •     Represent functional slices     •     Use Ubiquitous Language     •     Name liked a book or chapter   ...
Scenarios     •     Key Examples of the Feature     •     Stakeholder perspective     •     UI agnostic     •     != test ...
Steps     •     Global over all features     •     Don’t combine     •     Given = state     •     When = actions     •   ...
Step Definition     • Grouped by entities, entity       groups or domain concepts     • Always use Page/Control       patt...
Tables                    Scoped                      Scenario                    Bindings                    Outlines    ...
Reading Material     • Demo Code           https://github.com/dennisdoomen/specflowdemo     • The Cucumber Book           ...
Email                         dennis.doomen@avivasolutions.nl                                                Twitter      ...
Upcoming SlideShare
Loading in …5
×

Automated ui testing with Specflow and WaTiN

4,254 views

Published on

Test Driven Development is a phenonemon every developer should be aware of by now. I can't believe I've been developing professionally without it, and have been using it in every project since I discovered it 5 years ago. But, applying TDD on UI logic can be challenging, even if you apply patterns like MVC, MVP or Presentation Model. Creating readable and maintainable unit tests that drive a Presentation, ViewModel or Controller is a big maintenance burden.

That's why our ASP.NET WebForms/MVC project jumped on the SpecFlow and WaTiN bandwagon. Using this beautiful combination we can now smoke test the overall behavior of the system, in addition to the large coverage of automated unit tests. Granted, this isn't the same as Acceptance Test Driven Development, but those smoke tests have been really worth their money. The functional abstraction that SpecFlow offers has proven to be a valuable aspect that allows us to keep our UI tests maintainable. In fact, the Gherkin matra Given-When-Then has even found its way to our test professionals.

During this talk, I'd like to share some of the basic principles behind SpecFlow and the most important aspects of WaTiN. Just like with TDD, there's a whole lot you can do wrong. That's why I want to focus on some of the best practices that worked for us. Anyway, if you're serious about building high quality products and system, check out what I have to share.

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,254
On SlideShare
0
From Embeds
0
Number of Embeds
880
Actions
Shares
0
Downloads
42
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Automated ui testing with Specflow and WaTiN

  1. 1. Automated Testing With SpecFlow and WaTiN Dennis Doomen© 2012 Aviva Solutions dennis.doomen@avivasolutions.nl 30 augustus 2012
  2. 2. About Me • Principal Consultant • 15 years IT experience • C++ origins but C# since 2001 • Specialties • .NET Architecture • Scrum/XP • ALM • Speaker • Public initiatives • Silverlight Cookbook • C# Coding Guidelines • Fluent Assertions • Internet • www.dennisdoomen.net • DZone MVB • @ddoomen© 2012 Aviva Solutions Dennis Doomen 30 augustus 2012
  3. 3. Challenges of User Interface Automation© 2012 Aviva Solutions 30 augustus 2012
  4. 4. Levels of UI Automation Stability Functional User Workflow Technical Activity© 2012 Aviva Solutions 30 augustus 2012
  5. 5. Smoke Specification Tests Performance by Example Tests Given a ninja has a third level black-belt When attacked by Chuck Norris Then the ninja should run for his life Living Behavior Driven Documentation Development Characteristics Tests© 2012 Aviva Solutions 30 augustus 2012
  6. 6. ATDD combined with TDD Image from Growing Object-Oriented Software, Guided by Tests© 2012 Aviva Solutions 30 augustus 2012
  7. 7. Deep Dive Demo© 2012 Aviva Solutions 30 augustus 2012
  8. 8. Stability Gherkin Scenarios Functional Step Definitions User Workflow WaTiN Technical Activity© 2012 Aviva Solutions 30 augustus 2012
  9. 9. Required Skills Scenarios Coding Skills Testing Skills Step Definitions Support Code WaTiN© 2012 Aviva Solutions 30 augustus 2012
  10. 10. Features • Represent functional slices • Use Ubiquitous Language • Name liked a book or chapter • Organized by Epic User Stories Feature: Hosting Dinners In order to increase my business network As a entrepeneur I want to host dinners with interesting people from the community© 2012 Aviva Solutions 30 augustus 2012
  11. 11. Scenarios • Key Examples of the Feature • Stakeholder perspective • UI agnostic • != test scripts • Manually executable • Grammatically correct Scenario: Attempting to host a dinner as a registered user Given a registered user When you want to host a dinner Then you should be able to schedule a dinner© 2012 Aviva Solutions 30 augustus 2012
  12. 12. Steps • Global over all features • Don’t combine • Given = state • When = actions • Then = visible change Scenario: Attempting to host a dinner as a registered user Given a registered user When you want to host a dinner Then you should be able to schedule a dinner© 2012 Aviva Solutions 30 augustus 2012
  13. 13. Step Definition • Grouped by entities, entity groups or domain concepts • Always use Page/Control pattern • No private helper methods© 2012 Aviva Solutions 30 augustus 2012
  14. 14. Tables Scoped Scenario Bindings Outlines Hooks Advanced Topics Tags Step-Argument Conversion Step Definitions Data Sharing Assist Helpers© 2012 Aviva Solutions 30 augustus 2012
  15. 15. Reading Material • Demo Code https://github.com/dennisdoomen/specflowdemo • The Cucumber Book http://pragprog.com/book/hwcuc/the-cucumber-book • The Secret Ninja Cucumber Scrolls http://cuke4ninja.com/toc.html • Death by UI Test Automation http://gojko.net/2010/07/29/the-sine-of-death-by-ui-test-automation/ • Code-to-Test Ratios, TDD and BDD http://www.infoq.com/articles/virtual-panel-tdd-bdd • Growing Object-Oriented Software, Guided by Tests http://www.amazon.com/Growing-Object-Oriented-Software-Guided- Tests/dp/0321503627© 2012 Aviva Solutions 30 augustus 2012
  16. 16. Email dennis.doomen@avivasolutions.nl Twitter @ddoomen Blog www.dennisdoomen.net© 2012 Aviva Solutions 30 augustus 2012

×