Mocking 101

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Mocking 101 - Presentation Transcript

    1. A brief introduction to test doubles and mocking frameworks
    2. Unit testing goals
      • Verification
      • Feedback Speed
      • Focus
      • Isolation
    3. Test Doubles
      • 4 types of test double
        • Dummy – We just pass it round and don’t do anything with it
        • Fake – Working implementations but take shortcuts
        • Stubs – Canned answers to expected calls
        • Mocks – Pre programmed with responses and expectations that certain calls should be made
    4. Why?
      • Feedback cycle needs to be as small as possible to be useful
      • We need to remove pain points from being necessary
        • Database calls
        • UI
        • Third party libraries
      • We can remove reliance on the rest of the code being complete before knowing the current unit works
    5. Mocking frameworks
      • Provide a repeatable way to set up mocks/stubs/fakes with little code cost.
      • Test logic can stay within test
      • We can develop as we test and get immediate results (TDD)
    6. Rhino.Mocks
      • One of the most mature and feature complete mocking frameworks
      • Uses castle remoting to mock calls
        • Not able to mock static or sealed calls
      • Fast
      • Record/Replay Syntax
      • Lots of help and code examples available
      • Open Source
    7. Typemock Isolator
      • Mature and fully featured
      • Uses IL Generation
        • Can mock static classes and calls
        • Can chain events
      • Commercial licence available for full feature set and support
      • Main commercial mocking framework so features ++
    8. Moq
      • New Kid on the block
      • .net 3.5 only
      • No record/replay semantics, just expectations
      • Less code clutter to tests
      • Not feature complete
      • In active development
      • Open source
    9. How?
      • It’s time to code
    10. Links
      • Rhino Mocks: http://www.ayende.com/projects/rhino-mocks.aspx
      • Typemock: http://www.typemock.com/
      • Moq: http://code.google.com/p/moq
      • Me: http://www.bgeek.net [email_address] http://www.twitter.com/buildmaster

    + buildmasterbuildmaster, 2 years ago

    custom

    803 views, 0 favs, 1 embeds more stats

    Slides from the wellington Dot net user group mocki more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 803
      • 758 on SlideShare
      • 45 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 9
    Most viewed embeds
    • 45 views on http://bgeek.net

    more

    All embeds
    • 45 views on http://bgeek.net

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories