4 ms·
I'm not anti-TDD necessarily but I've yet to see tests yield useful results at almost everyone company I've worked it. It could be I've just never worked with s
by joshstrange 4y ago
I'm not anti-TDD necessarily but I've yet to see tests yield useful results at almost everyone company I've worked it. It could be I've just never worked with someone who was actually good at tests.
Tests in general aren't something I regularly use and a lot of TDD feels somewhat insane to me. You can write all the tests you want ahead of time but until the rubber meet the road it's a lot of wishful thinking in my experience. Also it makes refactoring hell since you often have to rewrite all the tests except the ones at the top level and sometimes even those if you change enough.
I believe tests can work, I've just never really seen them work well expect for very well defined sets of functionality that are core to a product. For example I worked at a company that had tests around their geofencing code. Due to backfilling data, zones being turned on/off by time, exception zones within zones, and locations not always being super accurate, the test suite was impressive. Something like 16 different use cases it tested for (to determine if a person was in violation for a given set of locations, for a given time). However, at the same company, there was a huge push to get 80%+ code coverage. So many of our tests were brittle that we ended up shipping code regularly with broken tests because we knew they couldn't be trusted. The tests that were less brittle often had complicated code to generate the test data and the test expectations (who tests the tests?). In my entire time at that company we very rarely (I want to say "never" but my memory could be wrong) had a test break that actually was pointing at a real issue, instead the test was just brittle or the function changed and someone forgot to update the test. If you have to update the test every time you touch the code it's testing... well I don't find that super useful, especially coupled with it never catching real bugs.
In a lot of TDD/Tests in general tutorials I've seen they make it seem all roses and sunshine but their examples are simple and look nothing like code I've seen in the wild. I'd be interested in some real-world code and the tests as the evolved over time.
All that said, I continue to be at least interested in tests/TDD in the hopes one day it will "click" for me and not see just like a huge waste of time.