Timeline for Are unit tests really that useful?
Current License: CC BY-SA 3.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 24, 2017 at 22:59 | comment | added | niico | It's a cost / benefit situation. Tests aren't free, they can take a significant % of your development time to create - and the benefit is you get a smaller % of bugs. What's more valuable to you - the time, or the reduced bug count? | |
| Jul 25, 2012 at 19:32 | comment | added | CesarGon | "If you practice TDD, your code is created testable—in other words, nice and clean". Ha. Testable and "nice and clean" are very different things. Unit tests interact with the outer interface of your code, which can still be an ugly mess inside. So no, TDD and testable code does not mean "nice and clean". | |
| Jul 25, 2012 at 19:06 | history | made wiki | Post Made Community Wiki by Loren Pechtel | ||
| Jul 25, 2012 at 0:50 | comment | added | Aaronaught | @Coder: It's not documenting what the code does, it's documenting the assumptions inherent in that code, i.e. why and when it's supposed to work. If the underlying assumptions are invalidated by a change to the SUT, one or more unit tests should fail. This doesn't replace higher-level design/architecture documentation, or even XML docs, but it covers what those things never can. | |
| Jul 25, 2012 at 0:49 | comment | added | Rangi Lin | @Coder: I would say a unit test is another kinds of technical document and with different purpose. A well written unit test not only helps other programmers to understand what that code dose, but also how to use that code. Programmer tend to learn faster when there is an example. | |
| Jul 24, 2012 at 23:50 | history | edited | Jon Purdy | CC BY-SA 3.0 | Formatting and style. |
| Jul 24, 2012 at 21:14 | comment | added | Stefano Borini | @coder: documentation of a class tells you the services that class' instances provide. It tells you less information on how this class' instances are used in the larger context, that is, the interaction between objects. Tests give you typical code of interaction in some cases, which has been precious as a starting point so many times I can't even count them. | |
| Jul 24, 2012 at 21:11 | comment | added | user2567 | @Coder: when you test higher level methods, it does involve lot more than 5 lines of code. | |
| Jul 24, 2012 at 21:00 | comment | added | Coder | If unit-tests are working as a documentation, there is something wrong. Reading 500 lines of code to understand how 5 lines of code work is backwards. | |
| Jul 24, 2012 at 19:51 | comment | added | kwelch | Having just started in unit testing I would have to agree. Not only is it a good habit and very usful combined with a TDD approach, but it minimizes so much time. I don't think my projects could be as useful if I was not able to just run a unit test and verify that everything is working properly even after adding in a new feature or fixing a bug. I can't think of doing regression testing any other way. | |
| Jul 24, 2012 at 19:38 | history | edited | KeesDijk | CC BY-SA 3.0 | added 1 characters in body |
| Jul 24, 2012 at 19:32 | history | answered | KeesDijk | CC BY-SA 3.0 |