4 ms·
The code is the “test” for your tests ;)
by chewbacha 9y ago
The code is the “test” for your tests ;)
- michaelmrose 9y agoThe code and the test are probably to some degree based on the same logical construct. If that logical construct is malformed your tests may pass and your code might not work. Regardless if your code works your tests could still fail, likewise your code could not work and your tests pass so since the tests and code may vary independently if either is buggy I don't see how this can possibly be true.
- chewbacha 9y agoIf the logical construct is flawed, no amount of tests will ever catch it, only user testing would. The point I’m trying to make is that the verification of correctness is bidirectional. If I’m writing tests around existing code, I rely on the code to test my expectations. If I’m writing new code, I write tests to assert my new assumptions. All automated tests do are assert that I’ve written the same logic twice. Writing it a third time will also decrease the likelihood of transcription error again, but at diminished returns.