Hacker News new | ask | show | jobs
by peteradio 1386 days ago
What is wrong with your first test? Find some way to persist the result if you like it and make a test that checks that you can still get that result. Now you can sanity check by running the test to make sure it didn't break. That is one benefit of having the test, did something new break something old. Generally that is as far as I take TDD. While writing new routines, it is nice to have a test calling those routines rather than maintain whole executables because many IDEs will run those tests and you can lay down breakpoints to figure out why the routine is bombing or giving an incorrect result. When/if something breaks and you find yourself debugging back into any particular nitty areas, that might indicate a good place to think about putting a test so you don't have to exert yourself getting to that breakpoint again, next time you'd run the test and get a pass fail. I wouldn't worry at all about the purity of it all, think about how having a test can save you time in the debugging process thats it.