Your SlideShare is downloading. ×
0
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
Automated Unit Testing for Mere Mortals
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

553

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
553
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
10
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… <ul><li>Ensure components work as designed </li></ul><ul><li>Guard against regressions </li></ul><ul><li>Exercise the system </li></ul><ul><li>Expose how the system works </li></ul><ul><ul><li>Documentation </li></ul></ul>
    • 8. Automated Unit Tests are… <ul><li>Fast </li></ul><ul><li>Deterministic </li></ul><ul><li>Independent </li></ul><ul><li>Repeatable </li></ul><ul><li>Focused </li></ul>
    • 9. Unit tests… <ul><li>Do not cross application / process boundaries </li></ul>
    • 10. INTEGRATION TESTS
    • 11. Integration Tests… <ul><li>Ensure two or more system components work together </li></ul><ul><li>Cross application / process boundaries </li></ul><ul><li>Are unreliable (non-deterministic) </li></ul><ul><ul><li>Encourage ignoring failing tests </li></ul></ul><ul><ul><li>This is very bad ! </li></ul></ul>
    • 12. DEMO: A SAMPLE UNIT TEST
    • 13. TEST DOUBLES <ul><li>Mocks and Stubs and Fakes… oh my! </li></ul>
    • 14. Test Doubles <ul><li>Stand in for production components </li></ul><ul><li>Provide deterministic behavior </li></ul><ul><li>Provide control over testing environment </li></ul>
    • 15. Source: Unit Testing: Exploring The Continuum Of Test Doubles MSDN Magazine, September, 2007
    • 16. CODE COVERAGE
    • 17. Code Coverage is… <ul><li>The degree to which source code is tested </li></ul>
    • 18. RETROFITTING EXISTING CODE WITH TESTS
    • 19.  
    • 20. UNIT TEST ANTI-PATTERNS
    • 21. !! Warning !!
    • 22. Unit Test Anti-Patterns and Smells <ul><li>Test multiple components at once </li></ul><ul><li>Slow </li></ul><ul><ul><li>Cross application / process boundaries </li></ul></ul><ul><li>Depend on other tests or external interaction (non-deterministic) </li></ul>
    • 23. Unit Test Anti-Patterns and Smells <ul><li>Multiple assertions </li></ul><ul><li>No assertions </li></ul><ul><li>Unclear / vague assertions </li></ul><ul><li>Logging / Console.WriteLine() </li></ul>
    • 24. TEST-DRIVEN DEVELOPMENT
    • 25. A different way of thinking <ul><li>Part of Agile / Extreme Programming beliefs </li></ul><ul><li>Tests drive system design </li></ul><ul><ul><li>TDD = “Test-Driven Design” </li></ul></ul><ul><ul><li>“ How am I going to test this?” </li></ul></ul><ul><li>Helps create loosely-coupled components </li></ul>
    • 26. Test-First Development <ul><li>No code can be written unless driven by a failing test </li></ul><ul><li>Red – Green - Refactor </li></ul>
    • 27. TDD Pair Programming Game <ul><li>Player 1: Write failing test </li></ul><ul><li>Player 2: Make failing test pass </li></ul><ul><li>Player 1: Refactor </li></ul><ul><li>… repeat! </li></ul>
    • 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 <ul><li>My Blog: http://blog.jesschadwick.com </li></ul><ul><li>Unit Testing Frameworks </li></ul><ul><ul><li>Team System / MS Test </li></ul></ul><ul><ul><li>NUnit: http://www.nunit.org </li></ul></ul><ul><li>Visual Studio Add-ins </li></ul><ul><ul><li>Test-Driven.Net: http://www.testdriven.net </li></ul></ul><ul><ul><li>ReSharper: http://www.jetbrains.com </li></ul></ul><ul><li>Mock Frameworks </li></ul><ul><ul><li>Moq, Rhino Mocks, NMock, TypeMock, NUnit Mocks, DotNetMock, EasyMock.NET </li></ul></ul>
    • 33.  

    ×