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

“Test the legacy code as well” has been a mantra for many years now. But how do you actually do that? When stuck with tangled legacy-spaghetti, it may be hard to see the way out. The path from struggling with your spaghetti into doing TDD is shorter than you think.

It's so easy to say that you should test code as you change it, now matter how legacy, but in a real-world project, you need to know some tools and techniques to be able to do that. This talk will give you concrete techniques, along with a way of thinking to figure out those tricks you need in your code base.

I came into a project where writing tests was considered really hard and time consuming, and TDD was “impossible”. I did it anyway, and I want to share what we did and what we've learned from it.

Given at https://javaday.istanbul/

Mads Opheim

March 16, 2019
Tweet

More Decks by Mads Opheim

Other Decks in Technology

Transcript

  1. 11

  2. 13

  3. 16

  4. Key takeaways 46 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!