• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Testing with Mock Objects
 

Testing with Mock Objects

on

  • 2,963 views

A presentation on the value of mock objects when using TDD.

A presentation on the value of mock objects when using TDD.

Statistics

Views

Total Views
2,963
Views on SlideShare
2,956
Embed Views
7

Actions

Likes
2
Downloads
82
Comments
0

2 Embeds 7

http://www.slideshare.net 6
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Testing with Mock Objects Testing with Mock Objects Presentation Transcript

    • testing with mock objects
    • when i say testing…
      • == developer / unit tests
      • == integration tests (sometimes)
      • != functional / acceptance tests
    • when i say mock…
      • test stub
      • mock object
      • dummy object
      • fake object
    • mock vs. stub interaction vs. state
      • the difference between mocks and stubs
      • usually the same library provides both
      • interaction = mock
      • state = stub
    • why?
    • testing is easy in isolation
    • testing is harder with dependencies …
    • … so remove the dependencies (for developer testing)
    • for me…
      • lots of time in the airport
      • lots of time in the airplane
      • lots of time on the train
      • not enough family time
      • not enough snowboarding
    • scenarios to think about
      • fee per transaction
      • distributed development
      • parallel development
      • plug-ins / providers
      • automated test duration
    • scenarios to think about
      • third-party tools or services
      • non-deterministic outcomes
      • external systems
      • the mainframe crew
      • defer infrastructure choices
    • demo
    • thoughts
    • … on architecture and design
      • similar to the benefits of tdd
      • writing to interfaces = code empathy
      • easier to test = good design
      • highly cohesive / loosely coupled
    • … on implementation
      • good libraries exist
      • roll your own only for extreme cases
      • for .Net…
      • NMock, NMock2, Rhino Mocks, DotNetMock
    • … on automated builds
      • developer tests: use mocks (if necessary)
      • acceptance tests: don’t use mocks
    • … on a few useful patterns
      • code to interfaces
      • thin proxies
      • self-shunt
      • dependency injection
      • providers
    • learn more
    • http:// www.martinfowler.com/articles/mocksArentStubs.html
    • http:// xunitpatterns.com /
    • http:// www.nmock.org
    • http:// www.mockobjects.com
    • http:// www.codeproject.com/dotnet/tdd_in_dotnet.asp