Successfully reported this slideshow.
Your SlideShare is downloading. ×

Advanced junit and mockito

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Upcoming SlideShare
JUnit & Mockito, first steps
JUnit & Mockito, first steps
Loading in …3
×

Check these out next

1 of 18 Ad
Advertisement

More Related Content

Advertisement

Similar to Advanced junit and mockito (20)

Recently uploaded (20)

Advertisement

Advanced junit and mockito

  1. 1. Mathieu Carbou, 13/10/2011 github.com/Ovea/conf-junit montreal-jug.org junit.org Advanced Junit
  2. 2. <ul><li>Junit basics
  3. 3. Junit advanced
  4. 4. Experimental features
  5. 5. Mockito </li></ul>Schedule
  6. 6. <ul><li>@Test </li></ul>Junit basics
  7. 7. <ul><li>@Test
  8. 8. @Before, @After
  9. 9. @BeforeClass, @AfterClass </li></ul>Junit basics
  10. 10. <ul><li>@BeforeClass
  11. 11. For each @Test </li><ul><ul><ul><ul><ul><li>Instanciate test class
  12. 12. @Before
  13. 13. Invoke the test
  14. 14. @After </li></ul></ul></ul></ul></ul><li>@AfterClass </li></ul>Junit lifecycle
  15. 15. <ul><li>@Test
  16. 16. @Before, @After
  17. 17. @BeforeClass, @AfterClass
  18. 18. Suites </li></ul>Junit basics
  19. 19. <ul><li>@Test
  20. 20. @Before, @After
  21. 21. @BeforeClass, @AfterClass
  22. 22. Suites
  23. 23. Assertions </li></ul>Junit basics
  24. 24. <ul><li>Hamcrest </li></ul>Junit advanced http://code.google.com/p/hamcrest
  25. 25. <ul><li>Hamcrest
  26. 26. @ClassRule & @Rule </li></ul>Junit advanced
  27. 27. public interface TestRule { Statement apply( Statement base, Description description); } @Rule Statement @ClassRule Statement Junit advanced
  28. 28. <ul><li>Hamcrest
  29. 29. @ClassRule & @Rule
  30. 30. @RunWith </li></ul>Junit advanced
  31. 31. Junit runners Runner ParentRunner BlockJUnit4ClassRunner Suite Junit4 RunnerScheduler
  32. 32. public interface RunnerScheduler { void schedule(Runnable childStatement ); void finished(); } childStatement Scheduling
  33. 33. <ul><li>Enclosed runner </li></ul>Experimentals
  34. 34. <ul><li>Enclosed runner
  35. 35. @Category </li></ul>Experimentals
  36. 36. <ul><li>Enclosed runner
  37. 37. @Category
  38. 38. @Theory </li></ul>Experimentals
  39. 39. <ul>http://code.google.com/p/mockito/wiki/FeaturesAndMotivations http://docs.mockito.googlecode.com/hg/latest/org/mockito/Mockito.html </ul>expect-run-verify stubbing-run-(verify) VS Mockito EasyMock JMock Mockito
  40. 40. QUESTIONS ? Advanced Junit

Editor's Notes

  • - presentation: expert en java &amp; design, Depuis 16 ans (jdk 1 – sous windows) specialiste en dev web (5 ans), Infra maven Archi backend (web service, clustering, event driven, ajax &amp; reverse-ajax) - presentation sera sur mon blog
  • - presentation: expert en java &amp; design, Depuis 16 ans (jdk 1 – sous windows) specialiste en dev web (5 ans), Infra maven Archi backend (web service, clustering, event driven, ajax &amp; reverse-ajax) - presentation sera sur mon blog

×