Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

DEV.BG - Angular 1 and Jasmine (Unit Testing and TDD)

224 views

Published on

I'd like to share: shares common pitfalls in writing unreadable, unmaintainable unit tests in javascript.

Agenda:

1. My experience with Enterprise projects - good, bad and ugly part
2. What is TDD
3. What is Unit Testing
4. Understanding Mock and Stub Objects
5. TDD - Possible Mistakes
6. Angular and Unit Testing and yohottowel (jpapa.me/yohottowel)

Published in: Software
  • Be the first to comment

  • Be the first to like this

DEV.BG - Angular 1 and Jasmine (Unit Testing and TDD)

  1. 1. Angular and Jasmine
  2. 2. @d_danailov
  3. 3. Topics Today ● What is TDD and Unit Testing ● What is Jasmine ● Horrible Mistakes (Possible Mistakes) ● Examples
  4. 4. Priorities and Management
  5. 5. Code Base: Monolithic Applications
  6. 6. Image Source: memegenerator.net
  7. 7. Team Size
  8. 8. Challenges
  9. 9. Team Size
  10. 10. Long time
  11. 11. TDD and Unit Testing
  12. 12. Image Source: niden.net
  13. 13. Unit Testing ● Only on memory ● Fast ● Repeatable ● Not touch any external resources
  14. 14. Class Voice Recognition function Record(object) // void function Voice Recognition API
  15. 15. Class Voice Recognition function Record(object) // void function Voice Recognition API Fake Voice Recognition API - Mockup Object (Assert)
  16. 16. Mock objects vs Stub objects function Record(object) // void function Voice Recognition API LogWritter
  17. 17. Mock objects vs Stub objects function Record(object) // void function Voice Recognition API LogWritter
  18. 18. Mock objects vs Stub objects function Record(object) // void function Voice Recognition API LogWritter Fake Voice Recognition API Fake LogWritter
  19. 19. Mock objects vs Stub objects function Record(object) // void function Voice Recognition API LogWritter Fake Voice Recognition API - Stub Fake LogWritter - Mockup Object (Assert)
  20. 20. Understanding Mock Objects - Roy Osherove
  21. 21. Possible Horrible Mistakes
  22. 22. Image Source: bryanmmathers.com
  23. 23. GOTO 2013 • JS Unit Testing Good Practices & Horrible Mistakes • Roy Osherove
  24. 24. Image Source: media.bsix12.com
  25. 25. Image Source: media.licdn.com
  26. 26. Just by doing it, Unit Testing Makes Your file easier Possible Horrible Mistake
  27. 27. Unit testing makes your developer lives easier ● Easier to find bugs ● Easier to maintain ● Easier to understand ● Easier to Developer Unit test have bugsNo TrustRefactoringTest Code is not an important
  28. 28. No Test Review Possible Horrible Mistake
  29. 29. Test reviews vs code reviews ● Understand intent of developer ● 10 times quicker ● Drill in when needed ● Important for learning teams
  30. 30. Test reviews ● Making your test TRUSTworthy ● Creating MAINTAINable tests ● READable tests RTFM
  31. 31. Mocking all the things Possible Horrible Mistake Faking
  32. 32. Mock objects vs Stub objects function Record(object) // void function Voice Recognition API LogWritter Fake Voice Recognition API - Stub Fake LogWritter - Mockup Object (Assert)
  33. 33. Mixing Unit And Integration Tests Possible Horrible Mistake
  34. 34. Unit Testing ● Only on memory ● Fast ● Repeatable ● Not touch any external resources
  35. 35. The Testing Diamond and the Pyramid by Todd Little Article: The Testing Diamond and the Pyramid
  36. 36. Image Source: pinterest.com
  37. 37. Play by Play: Angular Testing with John Papa and Ward Bell
  38. 38. Article: The power of lazy programming
  39. 39. Image Source: media.licdn.com
  40. 40. Лекцията на Aлекс Тодоров: Мутанти, зомбита и тестове
  41. 41. jpapa.me/yohottowel
  42. 42. 25 % Discount - Valid for first ten registrations (FriendOfMitko)
  43. 43. Resources http://bit.ly/angular-jasmine
  44. 44. Questions

×