1 / 22

Test-Driving ASP.NET Development

Test-Driving ASP.NET Development. Tampa Code Camp – July 15 th , 2006. Cory Foy foyc@cornetdesign.com http://www.cornetdesign.com. Test-Driving ASP.NET Development. Session Overview What’s this Agile/XP thing? What’s this Test-Driven Development thing? TDD/NUnit Bowling demo

ondrea
Download Presentation

Test-Driving ASP.NET Development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Test-Driving ASP.NET Development Tampa Code Camp – July 15th, 2006 Cory Foy foyc@cornetdesign.com http://www.cornetdesign.com

  2. Test-Driving ASP.NET Development • Session Overview • What’s this Agile/XP thing? • What’s this Test-Driven Development thing? • TDD/NUnit Bowling demo • Applying TDD to ASP.NET • Wrap-Up Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  3. Extreme Programming • Base everything off four principles (the Agile manifesto): • Individuals and Interactions (over processes and tools) • Working Software (over comprehensive documentation) • Customer Collaboration (over contract negotiation) • Responding to change (over following a plan) Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  4. Extreme Programming http://www.xprogramming.com/xpmag/whatisxp.htm Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  5. Extreme Programming Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  6. Extreme Programming Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  7. Extreme Programming Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  8. Test-Driven Development • It’s about coding • It’s about design • Way of developing applications by writing tests • Red-Green-Refactor • Write a failing test • Make the test pass by doing the simplest thing • Refactor duplication Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  9. Test-Driven Development • NUnit (http://www.nunit.org) Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  10. Write a test Test-Driven Development Watch it fail Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  11. Make the test pass Test-Driven Development • Refactor Duplication Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  12. TDD Bowling Demo • Create an app to track the score of a bowling game • Consists of 10 frames which can be open frames, strikes, spares or bonus rolls • Scoring is different based on what the type of frame is Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  13. Applying TDD to ASP.NET • NUnitAsp • http://nunitasp.sourceforge.net • Extension to NUnit • Originally created by Brian Knowles, now maintained by Jim Shore • Provides NUnit with the ability to download, parse and manipulate ASP.NET pages • Meant for programmers, not QA teams Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  14. Applying TDD to ASP.NET Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  15. Applying TDD to ASP.NET • NUnitAsp Drawbacks • Tests are slow because we are making actual requests to IIS • Information that isn’t sent to the client can’t be tested • Session and Cache values can’t be tested directly Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  16. Applying TDD to ASP.NET • Model-View-Presenter • http://www.martinfowler.com/eaaDev/ModelViewPresenter.html • Separates the behavior of a presentation from the view while allowing the view to receive user events. • Make the page as “thin” as possible and extract the logic out to testable classes Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  17. Applying TDD to ASP.NET • Extract the services you want to provide to an interface • Have your views implement the interface • Have all interactions between the view and controller be through interface exposed methods Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  18. Applying TDD to ASP.NET Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 http://www.martinfowler.com/eaaDev/ModelViewPresenter.html

  19. Applying TDD to ASP.NET • ASP.NET MVP demo Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  20. Applying TDD to ASP.NET • Advantages of Model-View-Presenter in TDD • Separates your logic from your presentation • Let’s your business logic be tested – fast • Allows mocks of the pages to be built to test user behavior • Easily allows additional views to be plugged in Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  21. Wrap-Up • Do nothing without frequent feedback • Testing GUIs is hard – but can be mitigated • Try to make GUI tests (and GUIs) as thin as possible Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

  22. Wrap-Up • Links • http://msdn.microsoft.com/library/en-us/dnvs05/html/guidelinesfortdd.asp • http://www.testdriven.com • http://www.nunit.org • http://www.testdriven.net(VS plugin) • http://nunitasp.sourceforge.net • http://www.cornetdesign.com(presentation) Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06

More Related