Test driven development

416 views
384 views

Published on

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

  • Be the first to like this

No Downloads
Views
Total views
416
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Test driven development

  1. 1. Test Driven Development Marcelo Cure
  2. 2. Where did it come from? • Kent Beck in 2003 • Concepts related to Extreme Programming
  3. 3. What’s TDD? • Development technique • Focus on quality • First test then code • Requirements before code • Based on cycles
  4. 4. How does TDD work? • Developer must have the feature knowledge • Think baby steps • Write a failing test • Make it pass • Make sure it didn’t break any other test • Refactor • Loop
  5. 5. Benefits • More tests, less bugs • Code quality • Rare necessity to debug • Leads to modularize your system • Big coverage
  6. 6. Limitations • Management support is required • Fake tests • Are we really doing TDD?
  7. 7. Environment (talking about Java) • Java • Eclipse • JUnit
  8. 8. Examples – NameRetriever
  9. 9. NameRetrieverTest public class NameRetrieverTest { private NameRetriever nameRetriever; @Test public void testRetrieveName() { String name = nameRetriever.retrieveName(); Assert.assertEquals("cure", name); } }
  10. 10. NameRetriever public class NameRetriever { public String retrieveName() { return ""; } }
  11. 11. NameRetriever public class NameRetriever { public String retrieveName() { return "cure"; } }
  12. 12. NameRetrieverTest public class NameRetrieverTest { private NameRetriever nameRetriever; @Test public void testRetrieveName () { Assert.assertEquals("cure", nameRetriever.retrieveName()); } }
  13. 13. That’s all, thanks!

×