4 ms·
I'm currently writing a personal project for university, and I've made sure to test it all the way through. When I was part-way into coding this thing, I took
by cytzol 18y ago
I'm currently writing a personal project for university, and I've made sure to test it all the way through.
When I was part-way into coding this thing, I took a day to go through all the code and write tests for anything I could. I found a few bugs, so I could at least say that it helped somehow. But the tests have helped a lot more when I added to it - it feels -good- to see a big green bar light up whenever I add something. It's -nice- to run all tests, leave it a minute, and confirm that it's not going to blow up before I have to demonstrate to anybody. Of course, finding bugs is nice, and I set up a better testing rig to make sure it doesn't fail on anything I haven't thought of, but the benefits of unit testing go further than bug detection.
When you're all crestfallen with no desire to code, finding bugs is only secondary.
- axod 18y agoIt's a false sense of security though. It's like putting a big badge on your website saying it 'validates' - even if it's totally broken in real world browsers. In my experience, the more common bugs are integration bugs, scaling bugs, weird memory usage issues, not to mention interfacing to external systems - for example some weird browser comes along and does idiotic requests you'd never expect a sane person to do. Those things are very hard to test for, and don't really produce a good ROI as abstractbill says... Best just to log things, graph things where possible, spot weirdness, investigate and fix.
- biohacker42 18y agoEverything you mentioned I count as part of TDD or BDD or what ever automated testing acronym you like. What I suspect is that all of us have basically the same idea in mind, and what we're disagreeing over is mostly semantics and context. Btw, all of my unit tests include memory usage validation. It's easy in c and c++, but I'm not sure how it would be done in a web development environment.
- abstractbill 18y agoIf passing unit tests give you the motivation you need to work, that's great! Personally, just making something people want is enough motivation for me ;-)