Your SlideShare is downloading. ×
0
Unit testing   the prequel
Unit testing   the prequel
Unit testing   the prequel
Unit testing   the prequel
Unit testing   the prequel
Unit testing   the prequel
Unit testing   the prequel
Unit testing   the prequel
Unit testing   the prequel
Unit testing   the prequel
Unit testing   the prequel
Unit testing   the prequel
Unit testing   the prequel
Unit testing   the prequel
Unit testing   the prequel
Unit testing   the prequel
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 prequel

128

Published on

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

No Downloads
Views
Total Views
128
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
1
Comments
0
Likes
1
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. Unit Testing – The Prequel Gil Zilberfeld, Product Manager Jan 29th, 2013 @gil_zilberfeld
  • 2. Prepare • Know your tools • Evaluate the risk • Choose your partner @gil_zilberfeld
  • 3. Step 1: What to test • What to test: • What you’re working on • Bug or feature? • Logic • What not to test: • Multithreading • Stored procedures • UI @gil_zilberfeld
  • 4. Step 2: Get ready • Pick organization strategy • Create test projects • Remove fluff • VS I’m looking at you @gil_zilberfeld
  • 5. Step 3: Pick a scenario • Scenario: • Context • Action • Success criteria • Pick the simplest one • Say it! • Name it! • Assert it! @gil_zilberfeld
  • 6. How code looks @gil_zilberfeld
  • 7. Simple path test @gil_zilberfeld
  • 8. “Happy path” test @gil_zilberfeld
  • 9. Step 3: Pick a scenario • Scenario: • Context • Logic • Success criteria • Pick the simplest one • Say it! • Name it! • Assert it! @gil_zilberfeld
  • 10. Step 4: Identify dependencies • Read the code • Constructor parameters • Fields • Statics • Global state • Mocking strategy • None (Integration) • Hand-rolled • Interface based • Anything goes @gil_zilberfeld
  • 11. Let’s play: Where are the dependencies? @gil_zilberfeld
  • 12. Step 5: Simplify design • Automatic refactoring • Close down regions you’re not going to cover • Rename fields • Extract methods • Manual refactoring works too • …but more risky @gil_zilberfeld
  • 13. Step 6: Here we go! • Arrange Run Fail • Arrange Run Fail ….. • Success! @gil_zilberfeld
  • 14. Step 7: Next! • Pick the next scenario • Say it • Name it • Assert it • Mutate the test setup • Arrange Run Fail … • Win! @gil_zilberfeld
  • 15. Congratulations! • This is just the beginning • Lifetime improvement • Picking scenarios • Naming • Mocking • Refactoring • … and much more! @gil_zilberfeld
  • 16. Questions? www.typemock.com www.gilzilberfeld.com typemock.com/blog gilz@typemock.com @typemock @gil_zilberfeld @gil_zilberfeld

×