TestDriving ASP'NET Development - PowerPoint PPT Presentation

About This Presentation
Title:

TestDriving ASP'NET Development

Description:

Test-Driving ASP.NET Development. Tampa Code Camp July ... Testing GUIs is hard but can be mitigated. Try to make GUI tests (and GUIs) as thin as possible ... – PowerPoint PPT presentation

Number of Views:68
Avg rating:3.0/5.0
Slides: 23
Provided by: mobile
Category:

less

Transcript and Presenter's Notes

Title: TestDriving ASP'NET Development


1
Test-Driving ASP.NET Development
  • Tampa Code Camp July 15th, 2006

Cory Foy foyc_at_cornetdesign.com
http//www.cornetdesign.com
2
Test-Driving ASP.NET Development
  • Session Overview
  • Whats this Agile/XP thing?
  • Whats this Test-Driven Development thing?
  • TDD/NUnit Bowling demo
  • Applying TDD to ASP.NET
  • Wrap-Up

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)

4
Extreme Programming
http//www.xprogramming.com/xpmag/whatisxp.htm
5
Extreme Programming
6
Extreme Programming
7
Extreme Programming
8
Test-Driven Development
  • Its about coding
  • Its 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
Test-Driven Development
  • NUnit (http//www.nunit.org)

10
Test-Driven Development
  • Write a test

Watch it fail
11
Test-Driven Development
  • Make the test pass
  • Refactor Duplication

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

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

14
Applying TDD to ASP.NET
15
Applying TDD to ASP.NET
  • NUnitAsp Drawbacks
  • Tests are slow because we are making actual
    requests to IIS
  • Information that isnt sent to the client cant
    be tested
  • Session and Cache values cant be tested directly

16
Applying TDD to ASP.NET
  • Model-View-Presenter
  • http//www.martinfowler.com/eaaDev/ModelViewPresen
    ter.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
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
Applying TDD to ASP.NET
http//www.martinfowler.com/eaaDev/ModelViewPresen
ter.html
19
Applying TDD to ASP.NET
  • ASP.NET MVP demo

20
Applying TDD to ASP.NET
  • Advantages of Model-View-Presenter in TDD
  • Separates your logic from your presentation
  • Lets 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
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
Wrap-Up
  • Links
  • http//msdn.microsoft.com/library/en-us/dnvs05/htm
    l/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)
Write a Comment
User Comments (0)
About PowerShow.com