News for hackers. Stuff that matters.
Re:Why Most Unit Testing is Waste (2014) [pdf] by skybrian on Monday May 30, 2016 @01:18AM (#11799693)
Have you seen people reading tests much in practice?

I've heard the "executable documentation" line but my general impression is that people usually read the production code. They'll only look at the tests when they fail or they need to modify them.

Re:Why Most Unit Testing is Waste (2014) [pdf] by wallacoloo on Monday May 30, 2016 @02:04AM (#11799826)
Sorry if this is what you were specifying when saying "executable documentation", but have you seen the way Rust handles documentation tests [1]? The idea is to provide documentation via comments before a function definition, and inside this documentation you can provide example uses. The test-runner automatically extracts these examples and verifies them. In this way, your documentation and tests are always in agreement with each other, and a developer can be aware of expected behavior by reading either the code comments or the auto-generated html docs.

I'm rather fond of this system, personally.

1: https://doc.rust-lang.org/book/testing.html#documentation-te...

Re:Why Most Unit Testing is Waste (2014) [pdf] by agumonkey on Monday May 30, 2016 @02:58AM (#11799974)
Thanks, you got me testing rustlang testing facilities. Very enjoyable. Makes you want to do low level programming 10x more than with c/cpp.
Re:Why Most Unit Testing is Waste (2014) [pdf] by codazzo on Monday May 30, 2016 @01:36AM (#11799747)
That's assuming the code even makes sense. Have you ever been looking at some code, having no precise idea what it does, with no commit history to give an explanation? That's when unit tests would be useful documentation.
Re:Why Most Unit Testing is Waste (2014) [pdf] by mdpopescu on Monday May 30, 2016 @03:33AM (#11800085)
If I start working on a new project and they have tests, I always start there. Heck, if I resume working on an old project of mine, I start with the tests.