Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

A Mockery of a persentation


Published on

A presentation on mocking and isolation frameworks in the .net space.

Published in: Technology, Education
  • Be the first to comment

A Mockery of a persentation

  1. 1. A Mockery of a Presentation<br />Gil Zilberfeld<br />Typemock<br />
  2. 2. Who am I?<br />Software developer for 15 years<br />Technical Evangelist at Typemock<br />@gil_zilberfeld<br />Let me tell you about my first REAL job...<br />
  3. 3. What’s the plan?<br />The isolation problem<br />Hand rolling  <br />The tools you can use<br />Start now<br /><ul><li>It's not that hard</li></li></ul><li>Why do we need isolation?<br /><ul><li> Applications are complex
  4. 4. We can’t touch a live system</li></ul> When we call the database<br />Setup<br />Teardown<br />Repeat<br />
  5. 5. And then…<br /><ul><li> When tests run slowly</li></ul> You stop running tests<br /> You stop writing tests<br />
  6. 6.  Really…<br />
  7. 7. What do I need?<br />A mock?<br />A stub?<br />A fake?<br />A test double?<br />
  8. 8. Mocks aren&apos;t stubs!<br />
  9. 9. Modern Tests<br />AAA<br />Arrange<br />Act<br />Assert<br />
  10. 10. AAA Demo<br />
  11. 11. Mocks vs. stubs don&apos;t matter in AAA world, so let&apos;s use fake<br /> <br />
  12. 12. Fakes help me change behavior without changing the code<br /> <br />
  13. 13. Fakes help me verify calls<br /> <br />
  14. 14. Roll your own fakes<br /><ul><li>Derive from an interface
  15. 15. Override virtual methods
  16. 16. Inject it</li></li></ul><li>MVC Demo<br /> <br />
  17. 17. 41%<br />
  18. 18. Isolation (not mocking) Frameworks   <br /><ul><li>Focus on the code under test, not the other way around
  19. 19. APIs for changing behavior and verification</li></li></ul><li>Isolation Frameworks Demo<br />
  20. 20. What are the differences?<br />
  21. 21. My name is Gil andI did not use a framework<br />I used hand rolled fakes<br />until it became complicated and I stopped unit testing<br />I knew about isolation frameworks, read about them, but thought they were too complicated<br />
  22. 22. My name is Gil and I was an idiot<br />(I&apos;m better now)<br />
  23. 23. Unit tests are the antidote to stupid bugs<br />it&apos;s impossible to stick with unit testing without fakes<br />It&apos;s a waste of time using hand rolled mocks<br />
  24. 24. Start now<br />It&apos;s a productivity tool<br />Make it part of your tool belt<br />
  25. 25. Resources<br />Typemock Blog<br /><br />Mock Comparison Project<br /><br />Twitter: @gil_zilberfeld<br />This week in testing:<br /><br />
  26. 26. Questions?<br />