Is the popularity of unit tests waning?
binstock.blogspot.com
binstock.blogspot.com
In my experience with unit testing:
1. It doesn't help much if you are working in client side enginering. No matter how clever your unit test is, it can't help on detected ui rendering errors, animations, or multithreading programming.
2. Java + unit test, means you have to throw away all encapsulation, and good OO design to apease your unit tests, exposing your program to your coworkers to create havock by calling methods that shouldn't be visible to them.
3.Unit tests can give you a false sense of security. Oh, look, it passed the unit tests, my code must be good. Well, most of the time unit tests != real world scenarios.
4. TDD (test driven design) of software, can be slow. I would recommend it to all my competitors. In a startup, I'd rather release something fast, that might be still little buggy, than something that works well, but it took forever to get there. Plus TDD is constraining, as you are programming around your tests, and not around what the user will see. I found often, that my final design on a functionality, is different from how I thought it would be at the beginning. When working in large systems, you don't have the luxury to know how your final design will be.
5. Unit testing stiffles creativity in design, goes against "Exploratory programming". If you already know the answer on what you are building when you start, then you probably are not exploring around.
6. Unit testing != fun. Honestly, I'd rather be implementing features, than testing them.
Where unit testing is good:
1. When building an api that will be used by other people amd that is more static, less fluid. As oposed to UI enginering, something like geoCoding api's, have simple and clear results. That is very easy to unit test, as the value returned by the api is within a determined range, and the unit tests can be few, simple, and clear.
2. Scripting languages. Unit testing helps on detecting errors, where in a static language they would have been caught earlier. Plus it is much more easier to unit test on something like Python, then something like Java, or god forbid C/C++.
3. Coorporate enviroment. If you are waiting for something form a different group/department, you can build some unit tests to test if this group's code is meeting minimum standards.
Overrall Unit testing has its place, but be careful not to rely on it too much. It can't be substitue to real testing.
When people get dogmatic about unit tests, they write way more than is needed to bring value. The value is: you can refactor code more easily; you can think things through a little bit at a time and let the design evolve; the code you write tends to be really simple and easy to understand; you get executable documentation of code as a side-effect. And for me, a huge benefit is that when pair-programming, the current test defines the current task.
If the unit tests are making the code harder to refactor and evolve, then it's time to write fewer of them. And if unit testing isn't fun, then something is seriously wrong.
Do people not know that when you want to just explore a wild design idea, you should abandon unit testing and just go wild?
It has saved me some headaches - especially when software grows in size and you simply cannot predict what impact even a simple change can have.
Anyway, I wanted to say that I agree with most of what you said :-)
Meanwhile, the logic of the article seems weak:
1. A company that claimed to auto-generate unit tests for your code failed? Give me a break. You can't write good tests without understanding what you're testing. If it could do that, why didn't it just auto-generate all your code in the first place? One needn't look far to see why this failed.
2. Few OSS tools have been adopted (except xUnit which is used massively)? This is normal. Most open source projects fail, a few succeed big. xUnit won. You don't need much else.
3. Not everyone teaches it? Why should everyone do anything?
4. Not many new unit testing books? There are many such books already. What don't they cover? Why should there be a whole book about JUnit 4?
5. Alternative unit-testing frameworks aren't used... see #2.
The author seems to think of unit testing as if it were a domain. It isn't, it's a technique. Why should there be an industry around it?
I haven't hit a point where I've invested too much into the quality of the software. It's fine with me if TDD isn't popular. I'll just keep using it as a tool in my arsenal to beat the competition.
When I was working with Rails, I found the unit test framework to be nearly useless for my application since it relied on a SOAP service (and at least back then, you couldn't hit the service with a unit test), but the Rails integration tests were great.
So I ended up writing a fairly extensive suite of integration tests, but nearly no unit tests at all.
It's probably close to impossible to prevent people from using unit tests as a substitute for QA, though. The concepts are similar enough that people are bound to confuse them, or at least take the confidence they get from passing unit tests as "good enough" to substitute for QA.