Test Driven Development Introduction - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

Test Driven Development Introduction

Description:

'Roy... who?' Agile Development Specialist Magen ... Contact me: Roy_at_Magen.com (or get my card) Agile Workshops at Magen. Check out your flyers ... – PowerPoint PPT presentation

Number of Views:1187
Avg rating:3.0/5.0
Slides: 26
Provided by: downloadM
Category:

less

Transcript and Presenter's Notes

Title: Test Driven Development Introduction


1
Test Driven DevelopmentIntroduction
  • Roy Osherove
  • Microsoft MVP
  • Senior Consultant, Magen
  • Agile Development Specialist

2
Roy who?
  • Agile Development Specialist Magen
  • Consultant, Speaker, Writer, Blogger
    ISerializable.com
  • Articles, resources ideas and questions
  • Contact me Roy_at_Magen.com (or get my card)
  • Agile Workshops at Magen
  • Check out your flyers
  • Starting a new project? Want to go Agile? Not
    sure how? Magen can help.
  • And

3
Public Announcements
  • Agile Israel user group opens!
  • All things agile
  • Roundtable discussions about problems and
    solutions
  • Learning from each other
  • Interested? Agile_at_Osherove.com
  • Community TDD workshops at Magen
  • Get at taste for TDD - Hands on!
  • Community as in free!
  • 10-12 people at a time
  • TDD_at_Osherove.com

4
Agenda
  • Introduction to TDD
  • A simple TDD demo
  • The NUnit Framework
  • Testing Attributes
  • NUnit Addin

5
Putting TDD in Context
  • Engineering methodologies (waterfall for
    example..)
  • Agile (flexible lightwheight) Methodologies
  • eXtreme Programming
  • Test Driven Development

6
The Methodologies
  • XP (extreme programming)
  • The Crystal family
  • MSF(Agile)
  • Highsmith's ASD (Adaptive Software Development)
  • Scrum
  • Feature Driven Development
  • DSDM (Dynamic Systems Development Method)
  • Rational Unified Process? (dX)

7
Test Driven Development
  • What is unit testing?
  • Why do I want it?
  • Whats NUnit?
  • Why test first?

8
A Unit Test is a testof a small functional piece
of code
Public bool IsLoginOK(string user, string
password) //
9
Unit Testing makes your developer lives easier
  • Easier to find bugs
  • Easier to maintain
  • Easier to understand
  • Easier to Develop

10
You have already done Unit testing
  • Not structured
  • Not Repeatable
  • Not on all your code
  • Not easy to do as it should be
  • A framework is missing

11
The xUnit Frameworks
  • Original was for SmallTalk
  • Kent Beck and Erich Gamma
  • Ported to Various languages and platforms
  • JUnit, CppUnit, DUnit, VBUnit, RUnit, PyUnit,
    Sunit, HtmlUnit,
  • Good list at www.xprogramming.com
  • Standard test architeture
  • Introducing NUnit

12
How we use NUnit
  • Write Tests
  • Make it easy to create and organize tests
  • Reference an assembly, spread some attributes,
    youre done
  • Run Tests
  • Allow running all of our tests, a group or just
    one.
  • From command line or GUI
  • Review Results
  • Immediate Pass/Fail feedback
  • Details on each failure
  • Able to generate XML reports

13
The 3A Pattern
  • Arrange
  • Act
  • Assert

14
Demo
  • Test Structure Example

15
NUnit Framework components
  • Test Fixtures
  • Tests
  • Assertions
  • Setup
  • TearDown
  • TestFixtureSetUp
  • TestFixtureTearDown
  • Ignore
  • ExpectedException
  • Suites(namespaces)
  • Extensibility (new)

16
Demo
  • Test Attributes

17
Test-Driven Development
  • Make it Fail
  • No code without a failing test
  • Make it Work
  • As simply as possible
  • Make it Better
  • Refactor

18
Demo
  • A simple TDD project
  • Add(x,y)
  • Zero throws exception
  • Can read files with numbers

19
Nunit -Addin
  • Demo

20
Much more to learn
  • Database testing
  • Mock objects
  • Creating customized test cases and suites
    (Extensibility)
  • Agile management
  • Continuous Integration( managing the build
    process)
  • The future VS.NET 2005
  • Roy_at_Magen.com

21
Embracing TDD in your organization
  • You dont have to start big
  • Start new tasks with TDD
  • Add Tests to code that you need to change or
    maintain but only to small parts.
  • Proof of concept Spike Solution
  • Growing an architecture
  • UML as a communication aid
  • Project Handover
  • The Architect role (The will to design)

22
1/3 Web Siteshttp//www.testdriven.comhttp//www
.xprogramming.comAgileAlliance.com ExtremeProgram
ming.org Blogshttp//dotnetjunkies.com/WebLog/da
rrell_nortonhttp//www.peterprovost.orghttp//we
blogs.asp.net/nunitaddinhttp//weblogs.asp.net/ja
mesnewkirk http//www,iserializable.com
Roy_at_Magen.com
23
Refactoring Resources
  • 2/3
  • Refactoring.com
  • http//www.refactoring.com/
  • The Father of Refactoring
  • http//www.martinfowler.com
  • Microsoft Refactoring Developer
  • http//weblogs.asp.net/jaybaz_ms/
  • C Refactoring Tutorial
  • http//geocities.com/bryantrsmith/refactoring/
  • Refactoring to Patterns
  • http//www.industriallogic.com/xp/refactoring/

24
Additional Resources
  • 3/3
  • Mailing Lists
  • Yahoo Group testdrivendevelopment
  • Yahoo Group agiledotnet
  • Books
  • Test-Driven Development in Microsoft .NET James
    Newkirk and Alexei Vorontsov
  • Test-Driven Development, by Example Kent Beck
  • Test-Driven Development, A Practical Guide
    David Astels
  • Unit Testing in Java, Johannes Link

25
Questions?
  • Roy_at_Magen.com
  • www.iserializable.com
Write a Comment
User Comments (0)
About PowerShow.com