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.

Required fields*

8
  • Regardind input validation take a look at this answer. Commented Dec 31, 2021 at 14:53
  • 1
    You do (or at least should) test your tests. In TDD you run them when you're expecting them to fail, and check that they fail for the reasons you're expecting (and give useful feedback when they do) - hence red, green, refactor. And once they're passing you're constantly rerunning them, so you'll find out if something changes and get to decide whether the test or the implementation needs changing as a result. There are also methods of testing (like mutation and fuzz testing) that can find the problems you forgot to check for. Commented Dec 31, 2021 at 16:37
  • 8
    Your arguments here and in comments below all appear to assume that the objective of testing is 100% certainty that your code is correct. This is a strawman argument: it is an unrealistic goal, and is not the reason people test. The reason is that in practice we do catch errors in test. You do test your code in some way before delivering it, don't you? You don't just write so many lines of code and hand it over without actually trying it to see if it works, right? Commented Dec 31, 2021 at 16:46
  • 2
    @jonrsharpe: And mutation testing is actually testing tests as well, or more precisely, testing test coverage. (Every mutation should lead to at least one failing test, indicating 100% coverage, but only a maximum small number of tests, indicating tightly focused tests.) Commented Jan 1, 2022 at 10:18
  • 1
    Actually, if a Sudoku solver tells you there is no solution, you are stuck. If it tells you that the Sudoku follows the rules by having exactly one solution, you are stuck. Commented Jan 26, 2022 at 19:45