I’ve read a lot about the importance of tests. You can assume I have a very abstract idea of topics like TDD, testable code, design for testability & the importance of tests in an evolving codebase.
But, I’m still very much deprived of motivations to actually spend time, writing tests.
#1. A lot of it is just procrastination, because I’ve never written any useful tests before & it feels like I need to know a lot more, for writing any useful tests.
#2. When I hold myself & sit down for writing tests, this is my thought sequence.
”The fake data that I’m going to pass as input for this function, is a static, dead, useless, hardcoded json.”
“For any useful feedback from the tests, I need to be feeding in fake data, that vary wildly and also it should look closely like real world, live, production data.”
“And I have to test the same function multiple times, with multiple types of fake data (dirty testing and such)”
“And the module I’m gonna write tests for has like, 148 functions!”
“And I have to mock this long list of interfaces & external calls”
“Jeez, that’s a lot of work!”
“Continue with #1”
I’m convinced that I have to change my perspective entirely, to overcome the procrastination.
Developers who’ve made the transition: How did you make it? What tricks can get me change my perspective? Advice please.