Upgrade to Pro — share decks privately, control downloads, hide ads and more …

I Walk In The Shadow Of Valley Of Tests

I Walk In The Shadow Of Valley Of Tests

Most if not all people in the software development world are telling you that you should write tests for your code. The amount of articles, blog posts, books, and white papers is overwhelming, you start reading them, you feel you are ready, and then you take a look at your code. Chances are you will get disheartened, by the sheer amount of it, by how it might seem hard, by terminology and approaches, by flavors of testing, by the investment of time required, by plain "OMG, I need to touch that code piece, things might break", or by tight deadlines of small projects. We will be looking at ways to start introducing the tests into your code base, to try and cross the uncanny valley of tests, which claimed lives of many code hours.

F2d82b268a7cbccc9809c939428df64f?s=128

Vranac Srdjan

November 22, 2014
Tweet

More Decks by Vranac Srdjan

Other Decks in Programming

Transcript

  1. I WALK IN THE SHADOW OF VALLEY OF TESTS Code4Hire,

    2014, PHP T-Day 1
  2. business owner, developer, consultant, mercenary, writing terrible code that performs

    exceptionally, wrangling elePHPants and Pythons, obsessed with process automation, interested in continuous integration and delivery, clean code, testing, best practices and distributed systems Code4Hire, 2014, PHP T-Day 2
  3. Code4Hire, 2014, PHP T-Day 3

  4. Code4Hire, 2014, PHP T-Day 4

  5. Code4Hire, 2014, PHP T-Day 5

  6. Code4Hire, 2014, PHP T-Day 6

  7. Code4Hire, 2014, PHP T-Day 7

  8. Code4Hire, 2014, PHP T-Day 8

  9. Code4Hire, 2014, PHP T-Day 9

  10. Code4Hire, 2014, PHP T-Day 10

  11. SSSSSOURCE SSSSSNAKE Code4Hire, 2014, PHP T-Day 11

  12. Testing Calisthenics First learn stand, then learn fly. Nature rule,

    Daniel-san, not mine. — Miyagi Code4Hire, 2014, PHP T-Day 12
  13. Testing Calisthenics cyber-dojo.org checkio.org Code4Hire, 2014, PHP T-Day 13

  14. Where to start? Code4Hire, 2014, PHP T-Day 14

  15. Rule of thumb Code4Hire, 2014, PHP T-Day 15

  16. Refactor, Test, Rinse, Repeat Code4Hire, 2014, PHP T-Day 16

  17. Mocks Vs Stubs Code4Hire, 2014, PHP T-Day 17

  18. Mocks Vs Stubs • Dummy • Fake • Stub •

    Mock Code4Hire, 2014, PHP T-Day 18
  19. Mocks Vs Stubs • Dummy • Fake • Stub •

    Mock Code4Hire, 2014, PHP T-Day 19
  20. Mocks Vs Stubs Code4Hire, 2014, PHP T-Day 20

  21. Mocks Vs Stubs Mock objects are used to define expectations

    Mocks record and verify such expectations. Stubs do not record or verify expectations, but rather allow us to “replace” the behavior, state of the “fake”object in order to utilize a test scenario Code4Hire, 2014, PHP T-Day 21
  22. Code4Hire, 2014, PHP T-Day 22

  23. Pixels & Deadlines Code4Hire, 2014, PHP T-Day 23

  24. Web Testing Code4Hire, 2014, PHP T-Day 24

  25. Web Testing • Goutte • Mink • Zombie.js • CasperJS

    • Codeception • Selenium Code4Hire, 2014, PHP T-Day 25
  26. Website recorder? Code4Hire, 2014, PHP T-Day 26

  27. Code4Hire, 2014, PHP T-Day 27

  28. Continuous Integration Code4Hire, 2014, PHP T-Day 28

  29. Continuous Integration • Jenkins • Bamboo • Travis • TeamCity

    • Semaphore Code4Hire, 2014, PHP T-Day 29
  30. Code4Hire, 2014, PHP T-Day 30

  31. Final Level Code4Hire, 2014, PHP T-Day 31

  32. Final Level Code4Hire, 2014, PHP T-Day 32

  33. Final Level Code with no tests, is worse than code

    with bad tests, is worse than code with some tests, is worse than code with all the tests Code4Hire, 2014, PHP T-Day 33
  34. Final Level Hunting for the 100% code coverage most of

    the times is impractical, but getting it to more than 0% is attainable goal. Code4Hire, 2014, PHP T-Day 34
  35. Final Level You are always a student, never a master.

    You have to keep moving forward. — Conrad Hall Code4Hire, 2014, PHP T-Day 35
  36. The End Thank You! Questions? https://joind.in/12412 Code4Hire, 2014, PHP T-Day

    36
  37. Links: https://github.com/FriendsOfPHP/Goutte https://github.com/Behat/en-mink.behat.org/blob/master/ index.rst http://zombie.labnotes.org/ http://casperjs.org/ http://codeception.com/ http://www.seleniumhq.org/ http://sahipro.com/ Code4Hire,

    2014, PHP T-Day 37
  38. Links: https://chrome.google.com/webstore/detail/resurrectio/ kicncbplfjgjlliddogifpohdhkbjogm?hl=en http://www.seleniumhq.org/projects/ide/ Code4Hire, 2014, PHP T-Day 38

  39. Links: http://jenkins-ci.org/ https://www.atlassian.com/software/bamboo https://travis-ci.org/ https://www.jetbrains.com/teamcity/ https://semaphoreapp.com/ Code4Hire, 2014, PHP T-Day

    39