Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 5
    Wait. Is it really a"bad practice?" Or is it just "not really TDD?" Commented Jul 7, 2018 at 15:09
  • 1
    This answer isn't entirely accurate - commenting out the code and writing the test does accomplish something: it proves that the test fails without that code. If you don't comment out the code to verify that the test fails without it, you could write a test that doesn't actually test anything. Commented Jul 7, 2018 at 15:15
  • 1
    @TehShrike "commenting out the code and writing the test does accomplish something"`- Yes, but it is missing the main line of TDD: *Code exists to provide behavior required by a test. What the OP does is the opposite: A test exists to cover some code. I'd argue that this tests tend to be code centric and not behavior centric and that they tend to step in your way while refactoring. Commented Jul 8, 2018 at 14:46