3 ms·
What Can We Learn from an Incorrect TDD Diagram?
- eesmith 9y agoThat's not the only thing incorrect. After refactoring should be "Execute all test cases", as the refactoring may have introduced a bug. Sometimes, especially with "replace algorithm", the refactoring may even require new test cases. I'll add another reason for why a new test may fail - you might not understand the system well enough. For example, suppose you come from C to Python. You have some code which computes modulo on integers, so you use x%y. Later on you realize that you also need modulo on floats, which in C means using fmod(3). You write the test with a float, expecting it to fail, only to find out that it passes, because you didn't know that Python supports modulo a float. For one that affected me recently, I wanted to write a test that my output code would give an error if one of the fields was blank. I wrote a test for it, and the test passed. I had forgotten that the input system was defined to fill in a default value if nothing was specified, so there was no way to pass an empty value to the output.