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

9 ways to test your spaghetti code

9 ways to test your spaghetti code

From Nordic Testing Days 2019

52482b46b478633a2b766bbf36916fd3?s=128

Mads Opheim

May 30, 2019
Tweet

Transcript

  1. Nordic Testing Days 9 ways to test your spaghetti code

    Mads Opheim @MadsOpheim 1
  2. Tere! I’m Mads. I’m a developer 2

  3. Spaghetti code? 3

  4. The 9 ways 4

  5. 5 1. Test all or Test small

  6. 6 2. Set your dependencies

  7. 7

  8. Singletons 8

  9. 3. Package-protect problematic parts 9

  10. Tools for your toolbox 10

  11. 4. Do simple refactorings to get your code under test

    11
  12. In general: untangling and looking at one part at a

    time 12
  13. You’re not as smart as you think you are 13

  14. Well-designed code is testable code 14

  15. 15 5. Help your team

  16. You’ll forget things 16

  17. 6. Run your tests - and care 17

  18. 7. Feature toggles 18

  19. 8. One mile at a time 19

  20. Refactor in separate commits 20

  21. 9. Test-driven development 21

  22. Test-driven spaghetti 22

  23. TDD on legacy code in practice 23

  24. Tip 10, 11 and onwards 24

  25. 25 The Deadline For Kunngjøring Is Four Weeks()

  26. 26 Properties For Namsmann Mainly Follow The Same Rules as

    Hovedstevnevitne()
  27. You’ll do stupid things - and that’s ok 27

  28. Be consistent 28

  29. Give me more @lisacrispin, @lisihocke, @techgirl1908, @maaretp... 29

  30. Key takeaways 30 1. Good code design improves testability 2.

    TDD on spaghetti code: TDD + test spaghetti code 3. Write tests for you legacy code - you can do it!
  31. Thank you! @MadsOpheim mads.opheim@computas.com 31