dcsimg
Is Junit productive and efficient?
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   matthieu_crogiez
Posted On:   Tuesday, May 25, 2004 02:17 AM

I'm interested in testing my frameworks with Junit and I've read a lot about this.
But, I'm still asking me the same questions :

-> Is Junit productive ? (Does it take a long time to write tests, because I don't want to spend the double of developpement time)

-> Is it really efficient ? (does it catch all possible exceptions or concepting mistakes)

If you have any testimony to bring to me, it will be very helpful for me. Thank you in advance.

Re: Is Junit productive and efficient?

Posted By:   Anonymous  
Posted On:   Wednesday, May 26, 2004 11:15 AM

Is it productive?

How much time do you typically spend debugging your code? With a good suite of unit tests, this time can be vastly reduced, especially when writing your tests closely to the production code, preferably shortly before ("test-first"). Some developers using this technique don't even remember how to operate a debugger... ;)

Additionally, writing unit tests also test the modularity of your design and therefore can help you find and fix "design bottlenecks" early in development.

So, yes, you actually might spend half your development time writing and maintaining tests - and still reduce overall development time.

Is it efficient?

As someone else already stated, the quality of the tests only depend on your ability to write them. And no, tests will probably never find *all* problems with your code. On the other hand, writing good unit tests actually isn't that hard to learn, and teams doing extensive unit testing consistently report massive drops in bugs encountered in production (down to only a handfull of bug reports a year).

Be aware, though, that unit testing is not the only thing there is to testing. At least equally important is acceptance (system) testing, that is, testing that the whole product is doing as expected (instead of single units). I would think about starting with writing those tests, possibly using FitNesse.

Also take a look at TestDriven.com for more info.

Re: Is Junit productive and efficient?

Posted By:   Sean_Owen  
Posted On:   Tuesday, May 25, 2004 07:36 AM

This is a big question! JUnit itself is very simple, and nothing magical. It will not add any value that you do not put there yourself; it's just a framework.



JUnit is no better or worse than other testing frameworks I've seen. In all cases, yes, it takes a lot of work to write comprehensive tests. Writing good tests for complex web applications is nearly impossible... it is an engineering effort at least as big as the project itself. Also, people forget that tests must be maintained -- there is an ongoing effort to keep them updated.



Unit tests only save you time in the long run. They take a lot of work upfront to write and debug. They also take time to change and correct as your application changes. Hopefully they save you a little time with every release, and after months or even years they pay off. Just keep that in mind when deciding whether to invest effort in unit tests.



Unless you have a large, dedicated staff of unit test writers, I would abandon the idea of testing everything through JUnit, and only through JUnit. Instead, use JUnit to unit-test specific bits of functionality, or core functionality that may be easier to test. That does add some value, but it does not replace a regular QA process.

Re: Is Junit productive and efficient?

Posted By:   Christopher_Koenigsberg  
Posted On:   Tuesday, May 25, 2004 07:18 AM

I think it depends entirely on you, your coding skill/habits/style, your organization, its culture, etc.

About | Sitemap | Contact