Live data from Hacker News

Poll: What proportion of start-ups/non-start-ups use automated unit tests/TDD?

news.ycombinator.com

31–40 of 41 posts

Re: Poll: What proportion of start-ups/non-start-ups use automated unit tests/TDD?

#31
post #2

I've admitted on a few occasions that I've never written a unit test for anything. This is something I keep meaning to change, if only I could find the time. For the time being, I can still keep the code dependencies and side-effects in my head so it has yet to cause any serious issues. I still slap my own hand, though.

The problem is that many testing advocates are 100% testing diehards. They believe that anything under 100% test coverage in several disciplines (unit, functional, integration, etc) is just as bad as no testing.

There is, of course, a middle way. Implement as much testing as makes sense for you. Think Pareto.. just the right 20% of testing could give you 80% of the gains.

So.. implement integration tests that test your apps very broadly and as soon as one fails, you know you can start looking deeper. No need to always start with line by line unit tests :)

Re: Poll: What proportion of start-ups/non-start-ups use automated unit tests/TDD?

#32
Remember.. almost every major piece of software you will have used together was not and has not been developed using TDD (think: does the Linux kernel have unit tests? That's way more important than what you're ever likely to develop!). That's nothing to be proud of, but if you are even aware of TDD and considering where you can implement parts of it, it puts you ahead of 90% of the industry.

Re: Poll: What proportion of start-ups/non-start-ups use automated unit tests/TDD?

#33
post #2

I've admitted on a few occasions that I've never written a unit test for anything. This is something I keep meaning to change, if only I could find the time. For the time being, I can still keep the code dependencies and side-effects in my head so it has yet to cause any serious issues. I still slap my own hand, though.

The problem is that many testing advocates are 100% testing diehards. They believe that anything under 100% test coverage in several disciplines (unit, functional, integration, etc) is just as bad as no testing. There is, of course, a middle way. Implement as much testing as makes sense for you. Think Pareto.. just the right 20% of testing could give you 80% of the gains. So.. implement integration tests that test yo…

I agree, it seems to me that like many things in life, the answer lies between the extremes

Re: Poll: What proportion of start-ups/non-start-ups use automated unit tests/TDD?

#36
post #25

Earlier quoted context omitted.

> if I could only find the time The asinine thing about this is that unit testing saves a massive amount of time in the long run. In the short run, even, it saves time. You're really shooting yourself in the foot.

is the any studies done you can point out, or is it just personal anecdotal evidence?

http://www.rttsweb.com/research/studies/study_functionalTest...

"...automated test suite saved the client 117 days of manual effort per testing cycle."

Sure, it takes more time to construct any given feature with unit tests versus a completely untested solution. However, any time you need to change the code, add a feature, or change something it interacts with, you are saving an incredible amount of time both in testing and the prevention of bugs discovered in production.

I really don't understand how, in the long run, automated testing can't save you time. If you don't think so, you obviously haven't maintained any software.

Re: Poll: What proportion of start-ups/non-start-ups use automated unit tests/TDD?

#37
For Sponty (http://thesponty.com/mit) we write unit and functional (http level) tests for every server side functionality. We use Python, so writing tests is actually fun. This has saved us from many regression bugs, and made our release cycle very short. We can write a feature today, and release it tomorrow.

Re: Poll: What proportion of start-ups/non-start-ups use automated unit tests/TDD?

#38
post #2

I've admitted on a few occasions that I've never written a unit test for anything. This is something I keep meaning to change, if only I could find the time. For the time being, I can still keep the code dependencies and side-effects in my head so it has yet to cause any serious issues. I still slap my own hand, though.

The problem is that many testing advocates are 100% testing diehards. They believe that anything under 100% test coverage in several disciplines (unit, functional, integration, etc) is just as bad as no testing. There is, of course, a middle way. Implement as much testing as makes sense for you. Think Pareto.. just the right 20% of testing could give you 80% of the gains. So.. implement integration tests that test yo…

You're right. And the problem with that is that the only opportunities for 100% coverage happen when you can start a project that way with the buy in of everyone on it. That is only likely to happen when everyone is familiar with TDD and comfortable with it. That creates a substantial hurdle for a group to cross when adopting it for the first time.

I prefer the approach we used here (at a non-startup). We simply decided that we were going to use automated tests as much as possible on a new project. Everyone was encouraged to use them. Our coverage wasn't 100%. However, when you are committed to creating an automated test case to reproduce any bug regardless of how the bug was originally found, your coverage expands. Usually you can write variants of the same test to cover related areas.

I can't speak for every member of the group, but my total testing time went down slightly and my test coverage improved enormously. Full TDD is not necessary in every instance. Just because you can't immediately make the jump to full TDD doesn't mean that automated unit test tools won't make your code better, and your testing easier.

Re: Poll: What proportion of start-ups/non-start-ups use automated unit tests/TDD?

#39

Earlier quoted context omitted.

You and I both suffer from SDS: single developer syndrome.

This is a common fallacy regarding test driven development. I use BDD/TDD MORE as a single developer. I may spend significant time writing tests, but the product is significantly better and I spend less time tracking down bugs. The time you "lose" on the frontend of development is made up on the back.

I know that in my mind. That's why I call it a syndrome - it is irrational. Without others, you make worse decisions because they work immediately.

Re: Poll: What proportion of start-ups/non-start-ups use automated unit tests/TDD?

#40
I spent a lot of time at the beginning of my project (bigtweet.com) writing some unit tests in the Perl Catalyst environment. I think that it was very worthwhile at the time while I was changing structure, implementing exception handling, etc. Now that the project has stablilized and I'm mostly working on incremental functionality, I've largely skipped writing new tests (due mostly to time constraints).

I still run "prove" before any new release though.

I've also experimented with Perl code coverage early on with good success. Again, time constraints prevent me from pursuing this further for now.

If you have the time, I would highly encourage writing some unit tests for the core functionality.

Post reply on HN