Your SlideShare is downloading. ×
Automated Unit Testing for Mere Mortals
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Automated Unit Testing for Mere Mortals

509
views

Published on

Published in: Technology, Education

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
509
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Roughly in order of implementation, from least (no) to full Good article in this month’s MSDN Magazine discussing the difference
  • Transcript

    • 1. Automated Unit Testing for Mere Mortals Jess Chadwick Architect / RIA Specialist Dow Jones, Inc blog.jesschadwick.com @jchadwick
    • 2. We thank the following companies for their gracious sponsorship Platinum Sponsor Gold Sponsors Silver Sponsors
    • 3.  
    • 4.  
    • 5.  
    • 6. What is an “automated unit test”? What is a “unit”?
    • 7. Automated Tests…
      • Ensure components work as designed
      • Guard against regressions
      • Exercise the system
      • Expose how the system works
        • Documentation
    • 8. Automated Unit Tests are…
      • Fast
      • Deterministic
      • Independent
      • Repeatable
      • Focused
    • 9. Unit tests…
      • Do not cross application / process boundaries
    • 10. INTEGRATION TESTS
    • 11. Integration Tests…
      • Ensure two or more system components work together
      • Cross application / process boundaries
      • Are unreliable (non-deterministic)
        • Encourage ignoring failing tests
        • This is very bad !
    • 12. DEMO: A SAMPLE UNIT TEST
    • 13. TEST DOUBLES
      • Mocks and Stubs and Fakes… oh my!
    • 14. Test Doubles
      • Stand in for production components
      • Provide deterministic behavior
      • Provide control over testing environment
    • 15. Source: Unit Testing: Exploring The Continuum Of Test Doubles MSDN Magazine, September, 2007
    • 16. CODE COVERAGE
    • 17. Code Coverage is…
      • The degree to which source code is tested
    • 18. RETROFITTING EXISTING CODE WITH TESTS
    • 19.  
    • 20. UNIT TEST ANTI-PATTERNS
    • 21. !! Warning !!
    • 22. Unit Test Anti-Patterns and Smells
      • Test multiple components at once
      • Slow
        • Cross application / process boundaries
      • Depend on other tests or external interaction (non-deterministic)
    • 23. Unit Test Anti-Patterns and Smells
      • Multiple assertions
      • No assertions
      • Unclear / vague assertions
      • Logging / Console.WriteLine()
    • 24. TEST-DRIVEN DEVELOPMENT
    • 25. A different way of thinking
      • Part of Agile / Extreme Programming beliefs
      • Tests drive system design
        • TDD = “Test-Driven Design”
        • “ How am I going to test this?”
      • Helps create loosely-coupled components
    • 26. Test-First Development
      • No code can be written unless driven by a failing test
      • Red – Green - Refactor
    • 27. TDD Pair Programming Game
      • Player 1: Write failing test
      • Player 2: Make failing test pass
      • Player 1: Refactor
      • … repeat!
    • 28. IDEAS TO TAKE HOME
    • 29.  
    • 30.  
    • 31. FOLLOW-UP SESSION: LEVERAGING CONTINUOUS INTEGRATION FOR FUN AND PROFIT PALACE, 2:30 – 3:45 (RIGHT NOW!)
    • 32. Resources
      • My Blog: http://blog.jesschadwick.com
      • Unit Testing Frameworks
        • Team System / MS Test
        • NUnit: http://www.nunit.org
      • Visual Studio Add-ins
        • Test-Driven.Net: http://www.testdriven.net
        • ReSharper: http://www.jetbrains.com
      • Mock Frameworks
        • Moq, Rhino Mocks, NMock, TypeMock, NUnit Mocks, DotNetMock, EasyMock.NET
    • 33.  

    ×