4 ms·
Even a string length api like len(s) is not exhaustively testable; you can't prove it correct with blackbox tests. TDD has refactoring steps which only have to
by kazinator 4y ago
Even a string length api like len(s) is not exhaustively testable; you can't prove it correct with blackbox tests.
TDD has refactoring steps which only have to preserve passing tests; refactoring can easly be the vector that introduces dead code as well as changes behavior for untested input combinations.
I suspect that a lot of code developed TDD is actually deployed on input combinations that are not covered in the TDD test suite.
A string length function developed by TDD will still work on len("supercalifragilisticexpealidocious") even though that exact string never appeared as a test case, and the consumers of that function will use it on all sorts of untested inputs all the time.
- dominotw 4y ago> Even a string length api like len(s) is not exhaustively testable; But this has nothing do with what GP said. That isn't what gp is using TDD for. GP is using TDD for, 1. starting with api of a function vs code. 2. avoiding unused lines of code 3. reducing dependencies, its hard to tdd something that has a lots of deps so it drives your refactor it something more testable and thus more readable/maintainable also. 4. simplest set of input/output.