Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
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,577 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
  • Best dissertation help you can get, thank god a friend suggested me ⇒⇒⇒WRITE-MY-PAPER.net ⇐⇐⇐ otherwise I could have never completed my dissertation on time.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Yes you are right. There are many research paper writing services available now. But almost services are fake and illegal. Only a genuine service will treat their customer with quality research papers. ⇒ www.HelpWriting.net ⇐
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • D0WNL0AD FULL ▶ ▶ ▶ ▶ http://1url.pw/XhO2F ◀ ◀ ◀ ◀
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • D0WNL0AD FULL ▶ ▶ ▶ ▶ http://1url.pw/XhO2F ◀ ◀ ◀ ◀
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • If you’re looking for a great essay service then you should check out ⇒ www.WritePaper.info ⇐. A friend of mine asked them to write a whole dissertation for him and he said it turned out great! Afterwards I also ordered an essay from them and I was very happy with the work I got too.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

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

×