by hitchstory · 1y ago · 0 comments
TDD lets you safely forget by tying the test pass/failure directly to the code.
So, yes, you can do test-after but why?
The only reason Ive ever heard for doing it after anyway is "I just prefer it that way".
Not writing tests at all makes sense (e.g. for a spike), but if I were going to start writing tests at any point I cant see any reason not to do it with TDD.
Also the higher level you test at, the less probable that you have to change the tests when you change a piece of functionality.
I frequently do TDD with integration and end to end tests. The type of test should be dictated by the nature of the code, which TDD doesnt have an opinion on.
TDD is about following red-green-refactor.
Not much traction, unfortunately. Id be interested in any comments you might have.
Usually, I use test harnesses[0]. These generally start before the code, and grow, alongside.
I’ll frequently write unit tests, after the code is done. Sort of like putting solder over a tightened bolt.
But I tend to spend a lot of time and effort on testing. It’s my experience, that I always find issues. I’ve never once, written “perfect” code, out of the starting gate.
Eh. WFM. YMMV.
IRT the post topic, I believe that every job I do -even “farting around” code- needs to be done as well as possible. If I always do a good job, then it becomes habit.