The right tool here is tests at a level higher than machine code instructions that have been in CPUs since the 70s. Maybe TDD practice is not to test at this level, but every example of TDD sure tends to be something similar!
- 0 Posts
- 9 Comments
Either way gets me to a passing test, but I prefer the latter because it enables me to write another failing test.
But you could just write that failing test up front. TDD encourages you to pretend to know less than you do (you know that testing evenness requires more than one test, and you know the implementation requires more than some if-statements), but no-one has ever made a convincing argument to me that you get anything out of this pretence.
Tests should make changing your system easier and safer, if they don’t it is typically a sign things are being tested at the wrong level
TDD is about writing (a lot of) unit tests, which are at a low-level. Because they are a low-level design-tool, they test the low-level design. Any non-trivial change affects the low-level design of a component, because changes tend to affect code at a certain level and most of those below it to some degree.
When faced with a failing test, you make it pass as simply as possible, and then you summon all your computer science / programming experience to refactor the code into something more elegant and maintainable.
Why bother making it pass “as simply as possible” instead of summoning all that experience to write something that don’t know is stupid?
TDD doesn’t promise to drive the final implementation at the unit level
What exactly does it drive, then? Apart from writing more test code than application code, with attendant burdens when refactoring or making other changes.
I don’t want unseeded randomness in my tests, ever.
Seed the tests, and making these pass would be trivial.
As the existing reply stated, there are only ever finitely many tests.
My issue with TDD is that it pretends to drive the final implementation with tests, but what is really driving the implementation is the monkey at the keyboard thinking, “testing for evenness should be done with the modulo operation,” not exhaustive tests.
This is what Test Driven Development looks like
I don’t understand how regex comes into it? Sounds tricky though!
I asked an LLM to write a
jq
scriptlet for me today. It wasn’t even complicated, it just beat working it out/trying to craft the write string to search Stackoverflow for.
Ew