0
A Mockery of a Presentation<br />Gil Zilberfeld<br />Typemock<br />
Who am I?<br />Software developer for 15 years<br />Technical Evangelist at Typemock<br />@gil_zilberfeld<br />Let me tell...
What’s the plan?<br />The isolation problem<br />Hand rolling  <br />The tools you can use<br />Start now<br /><ul><li>It'...
 We can’t touch a live system</li></ul> When we call the database<br />Setup<br />Teardown<br />Repeat<br />
And then…<br /><ul><li> When tests run slowly</li></ul> You stop running tests<br /> You stop writing tests<br />
 Really…<br />
What do I need?<br />A mock?<br />A stub?<br />A fake?<br />A test double?<br />
Mocks aren&apos;t stubs!<br />
Modern Tests<br />AAA<br />Arrange<br />Act<br />Assert<br />
AAA Demo<br />
Mocks vs. stubs don&apos;t matter in AAA world, so let&apos;s use fake<br /> <br />
Fakes help me change behavior without changing the code<br /> <br />
Fakes help me verify calls<br /> <br />
Roll your own fakes<br /><ul><li>Derive from an interface
Override virtual methods
Inject it</li></li></ul><li>MVC Demo<br /> <br />
41%<br />
Isolation (not mocking) Frameworks   <br /><ul><li>Focus on the code under test, not the other way around
APIs for changing behavior and verification</li></li></ul><li>Isolation Frameworks Demo<br />
What are the differences?<br />
My name is Gil andI did not use a framework<br />I used hand rolled fakes<br />until it became complicated and I stopped u...
My name is Gil and I was an idiot<br />(I&apos;m better now)<br />
Unit tests are the antidote to stupid bugs<br />it&apos;s impossible to stick with unit testing without fakes<br />It&apos...
Start now<br />It&apos;s a productivity tool<br />Make it part of your tool belt<br />
Resources<br />Typemock Blog<br />http://www.typemock.blog<br />Mock Comparison Project<br />http://code.google.com/p/mock...
Upcoming SlideShare
Loading in...5
×

A Mockery of a persentation

825

Published on

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

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
825
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
10
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "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 />http://www.typemock.blog<br />Mock Comparison Project<br />http://code.google.com/p/mocking-frameworks-compare/<br />Twitter: @gil_zilberfeld<br />This week in testing:<br />http://www.typemock.com/this-week-in-test/<br />
  26. 26. Questions?<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×