NDC 2011 - Building .NET Applications with BDD

2,433 views

Published on

Slides from the session at the Norwegian Developers Conference 2011 by Gaspar Nagy and Jonas Bandi.

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

No Downloads
Views
Total views
2,433
On SlideShare
0
From Embeds
0
Number of Embeds
485
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

NDC 2011 - Building .NET Applications with BDD

  1. 1. Building .NETApplications with BDDNDC 2011 GASPAR NAGY gn@techtalk.at Twitter: @gasparnagy JONAS BANDI jonas.bandi@techtalk.ch Twitter: @jbandiOslo, 8. June 2011 COPYRIGHT 2011, TECHTALK - WWW.TECHTALK.CH
  2. 2. TechTalk at a glance• Established: 1993• Branches: Austria, Hungary, Switzerland• 3 Managing partners: no external owners• Employees: ~ 60 employees• Turnover 2010: ~ 7 Mio CHF• Risk rating: very low risk• Self-financing, healthy growth TechTalk office, Vienna/Austria COPYRIGHT 2011, TECHTALK - WWW.TECHTALK.CH
  3. 3. Background• At TechTalk we are trying to live a BDD process for several years• We started SpecFlow in 2009 out of a need to implement BDD• We have implemented and improved our BDD process and knowledge in many projects• … we are still learning The research is partially supported by the project of Eötvös Loránd University: TÁMOP-4.2.1.B-09/1/KMR-2010-00033
  4. 4. BDD – A definition from Dan North BDD is a second-generation, outside-in, pull-based, multiple- stakeholder, multiple-scale, high- automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters. Dan North, Agile Testing, Specifications and BDD Exchange 20094
  5. 5. The BDD Development Process … how we live it Requirements Analysis Executable & Automated Specifications Improving Feedback with aTransparent Development Process Living Documentation5
  6. 6. Requirements Analysis & Colaboration We want to encourage new users to place an order. Therefore we are going to offer 10% discount on every initial order. Register as “bart_bookworm” Go to “/catalog/search” Enter “ISBN-0955683610” Click “Search” Click “Add to Cart” Click “View Cart” Verify “Subtotal” is “$33.75” public void CalculateDiscount(Order order) { if (order.Customer.IsNew) order.FinalAmount = Math.Round(order.Total * 9/10); }6
  7. 7. Capturing and OrganizingRequirements DEMO Your Product Backlog is more than just a list! www.speclog.org7
  8. 8. Outcome of Requirements Analysis• Sprint Planning •User Stories •Acceptance Criterias •… illustrated by Examples8
  9. 9. Executable & Automated Specifications Requirements Analysis Executable & Automated Specifications Improving Feedback with aTransparent Development Process Living Documentation9
  10. 10. Automation• Why? • iterative & incremental development demand a continuous feedback• Challenges • Abstraction vs. Reliability • Trust • Shared Understanding • Effort10
  11. 11. Scenarios: Automating Examples• Some Formality is needed •But: Keep it „business readable“• Gherkin11
  12. 12. 40 Spoken Languages12
  13. 13. Writing Maintainable Scenarios Specification by Example by Gojko Adzic13
  14. 14. Scripts vs. Declarative ScenariosGiven a clear databaseAnd the database is loaded from "sample-data.sql"And the webserver is runningWhen I go to URL: http://localhost:8080/myappAnd I click the "Login" linkAnd I enter username: johnAnd I enter password: john99And I click the "Login" buttonThen the page contains text: Hello John! Background: Given the following users: | First Name | Last Name | | John | Smith | When John logs in Then a greeting "Hello John!" is displayed.14
  15. 15. Decouple, Reduce Noise, Focus onValue Given a clear database When I create a user "John Smith" with login "jsmith" When I login as "jsmith" Then a greeting "Hello John!" is displayed. Background: Given the following users: | First Name | Last Name | | John | Smith | When John logs in Then a greeting "Hello John!" is displayed.15
  16. 16. Automation on Different Levels16
  17. 17. Challenges of UI Automation• Technical •Infrastructure Dependency (Speed, Stability …) •Tests run in another Process• Development Process •80% of all changes are in the UI• Tools can help: •Mara, MVCContrib (“Capybara like”)17
  18. 18. Organization of FeaturesFeatures are TODO: Screenshotproject artifacts: •versioned in VCS •Hierarchies •Change over time TODO: Screenshot18
  19. 19. Organizing Steps• Steps are code• Organize steps along domain concepts. Avoid feature- coupled steps• Scoped steps19
  20. 20. Organizing Steps• Application Driver Layer •Abstraction •Functional composition •Reuse20
  21. 21. Outside-In Development• Starting from the UI Layer is difficult •Start with a scribble / sketch •Good conventions help (aka. semantic markup) 1 •Progress step by step. Building 2 3 the UI incrementally 4 5• Progressing to TDD •Not always needed?21
  22. 22. Improving Feedback with a Transparent Development Process Requirements Analysis Executable & Automated Specifications Improving Feedback with aTransparent Development Process Living Documentation22
  23. 23. Transparency• Why? •Trust, Feedback, Learning, Embracing Change• Scrum Tools •Standup, Taskboard, Burndown, Demo, Retrospective• How can BDD help to improve it? •Technical Feedback •Different Perspective •Shared understanding23
  24. 24. The ProjectDashboard DEMO24
  25. 25. Build Server Integration• Generating Reports• Using Tags• Demo: Build Config25
  26. 26. Using Tags31
  27. 27. Living Documentation Requirements Analysis Executable & Automated Specifications Improving Feedback with aTransparent Development Process Living Documentation32
  28. 28. Evolving the living documentation Product Backlog Living Documentation AccCrit 1 AccCrit 1 User Story 1 AccCrit 2 „Done“ AccCrit 2 Feature 1 AccCrit 3 AccCrit 3 User Story 2 AccCrit 4 AccCrit 5 AccCrit 5 AccCrit 4 User Story n Feature n AccCrit m AccCrit m • Units of work • Documentation • Organized according to • Organized according to priority/value/effort functionality/overview • Versioned/maintained with source code33
  29. 29. Living documentation Current sprint Features “done” merge when F Sprint US accepted US Backlog AC F F Acceptance Criteria AC US Acceptance refine AC Criteria AC AC Acceptance the F F F Criteria US specification AC Acceptance Criteria Acceptance Criteria F F Acceptance US Criteria Acceptance AC AC Criteria Given … {…} validate Automation AC AC When … {…} continuously AC living documentation Then … {…} specification with examples validate executable continuously specification34
  30. 30. Living Documentation: Feature Tree35
  31. 31. Pushing Living Documentation further DEMO36
  32. 32. Other BDD Sessions at the NDCThursday Morning:• Gojko Adzic• Scott Bellware 37
  33. 33. Questions &Discussion GASPAR NAGY JONAS BANDI gaspar.nagy@techtalk.at jonas.bandi@techtalk.ch Twitter: @gasparnagy Twitter: @jbandi COPYRIGHT 2011, TECHTALK - WWW.TECHTALK.CH

×