3 ms·
Don't you think that if tests are effective, they may let you go faster? To put it another way, it is not surprising that error rates are similar since, presum
by omarhaneef 7y ago
Don't you think that if tests are effective, they may let you go faster?
To put it another way, it is not surprising that error rates are similar since, presumably, you keep coding till you produce an error, fix it and then repeat.
The question is how much error free code you wrote between the errors. If testing -- or any technique for that matter, like relaxing, jogging, discussing, planning -- reduces errors, it will manifest as more functionality per error.
- barrkel 7y ago"Effective tests" are a bit like the sufficiently smart compiler, or No true Scotsman fallacy. Tests either take a long time to run because they're integration tests in disguise, or they mock and stub module boundaries and are an impediment to design refactoring because lots of tests are invalidated. I tend towards favouring unit tests for leaf modules, especially those that get reused a lot, and fewer but rich (and slow) integration tests for a whole stack of functionality, end to end, where the test doesn't need much rewriting even if the design changes substantially. Unit testing everything usually undertests the composition of modules. You can fool yourself (especially using code coverage as a metric) that unit testing makes it easier to have complete testing, but actually the space of code under composition of units is much larger, and unit tests don't really test that at all.
- Huggernaut 7y agoDepending on your use of the term "unit" and "integration" (testing taxonomy is bad), I tend to do the opposite, but with the addition of acceptance (user feature testing) to tie the whole thing together. By this I mean that I unit test (as driven out by Discovery Testing i.e mocking collaborators) down the dependency graph until I hit a leaf node, which I will integration test against real external systems or black box unit test if the logic is self contained. This sort of drives out a world where slow tests are kept to the leaf components, or the e2e acceptance, and everything else is quick with confidence in all the paths. It certainly does lead to a world where refactoring is more costly because of the burden of these mocks but this isn't trying to follow Chicago TDD where the refactor step is part of the cycle, instead looking like London TDD where the testing puts pressure on the design itself, so refactors are far less common.
- ed_elliott_asc 7y ago> (testing taxonomy is bad) So true, it is terrible! What I say is: Unit tests - small tests that show the intent of one line of code or small set of lines, what the developer thought it was meant to do - can't prove correctness of an entire process Integration tests - test one specific process works (login success, login fail, etc.) starts to prove correctness of one part of an application Acceptance tests - larger, test that processes interact together and prove that multiple processes work Production tests - (roll out to x users and monitor or something similar) - prove that the entire application works, in production. Tests go from: Small to large, fast to slow, no risk to complete risk