Your SlideShare is downloading. ×
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
Unit testing - The Star Wars version
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

Unit testing - The Star Wars version

311

Published on

Introduction to unit testing and mocking as seen in a galaxy far away...

Introduction to unit testing and mocking as seen in a galaxy far away...

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

  • Be the first to like this

No Downloads
Views
Total Views
311
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
6
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

Transcript

  • 1. The Star Wars VersionGil ZilberfeldUnit Testing
  • 2. BugsHow do we dealwith them?
  • 3. xUnit Frameworks• Test Identification• Test Runner• Asserts
  • 4. .NET xUnit Frameworks• NUnit• MSTest• xUnit• MbUnit
  • 5. Demo
  • 6. Why Unit Test?• Low TCO• Small setupoverhead• It’s not a bug ifit’s caught beforeQA• Go faster• Quick feedback• Knowing yourcode works• Confidence tochange your code• Quicker thandebugging
  • 7. The death spiral• Tests are slow• Stop running tests• Stop writing tests• Back to square one
  • 8. People write millions oflines of legacy codeevery day!
  • 9. Testing legacy code• Tests are slow• Require big setup• Maybe impossible to run• Slow to debug
  • 10. Isolation and Mocking• Let you test your code for differentscenarios, by faking thedependencies• As long as your code is ready for it
  • 11. Demo: Hand-Rolled Mocks
  • 12. .NET Mocking Frameworks• Open-source• Commercial
  • 13. Demo: Mocking Framework
  • 14. Coverage…… and otherJedi mindtricks
  • 15. Test Driven Development
  • 16. Demo
  • 17. Benefits• Same Tools• Better Coverage• Less debugging• Better DesignThink before your code!
  • 18. But…• Requires discipline• Works better for greenfieldprojects• Not for everyone
  • 19. Agile Adoption
  • 20. Working software• Automated builds• Automatic build• Run unit tests• Run integration tests• Unit tests and TDDOver comprehensive documentation
  • 21. Guidelines• Unit testing is a teamsport• Where to start?• Scaffolding
  • 22. Guidelines• Naming• Reviewing• AAA
  • 23. Guidelines• Refactoring• Readability• Coverage• Organization
  • 24. www.typemock.comtypemock.com/blog@typemockwww.gilzilberfeld.comgilz@typemock.com@gil_zilberfeldQuestions?
  • 25. Death star explosionprobability calculator• Only Luke can shoot correctly• Explode if core temperature > 500• 1000 X-Wings• Probability of Luke being hit depends on theother X-Wingsp(success) = 0.3(X-Wings)• Probability of X-Wing surviving degrades intimep(survival) = 1/t2• Calculate Lukes hitting probability every 100time units

×