Presentation is loading. Please wait.

Presentation is loading. Please wait.

Test-Driving ASP.NET Development Tampa Code Camp – July 15 th, 2006 Cory Foy

Similar presentations


Presentation on theme: "Test-Driving ASP.NET Development Tampa Code Camp – July 15 th, 2006 Cory Foy"— Presentation transcript:

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

2 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 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

3 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 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)

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

5 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 Extreme Programming

6 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 Extreme Programming

7 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 Extreme Programming

8 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 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

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

10 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 Test-Driven Development Write a test Watch it fail

11 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 Test-Driven Development Make the test pass Refactor Duplication

12 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 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

13 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 Applying TDD to ASP.NET NUnitAsp –http://nunitasp.sourceforge.nethttp://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

14 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 Applying TDD to ASP.NET

15 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 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

16 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 Applying TDD to ASP.NET Model-View-Presenter –http://www.martinfowler.com/eaaDev/ModelViewPresenter.htmlhttp://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

17 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 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

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

19 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 Applying TDD to ASP.NET ASP.NET MVP demo

20 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 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

21 Cory Foy http://www.cornetdesign.com Test-Driving ASP.NET Development Tampa Code Camp, 7/15/06 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

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


Download ppt "Test-Driving ASP.NET Development Tampa Code Camp – July 15 th, 2006 Cory Foy"

Similar presentations


Ads by Google