Friday, December 5, 2008

Unit Testing.

This is great video from Google about Unit Testing:



I really want to start doing UT in my code.

Yes, it's time consuming(it seems like this at first :) ).
Yes, the amough of code is approximatelly the same as your original code.
But hey, then you have unit tests you can easily know that all your classes and etc works correctly, you can easily catch bugs, you can easily reproduce the bugs latter.
And in the end it really helps to save time after you finish your product, because it's tested already in some cases, and if some bug happens you can easily write a test for it and see what will happen, Then you exactly will know what went wrong.

4 comments:

Isaack said...

Perhaps also double development time, hehe :D

"Boss: I'll need 2 months to code... 1 month for writing the unit testing code, I'll need another 2 months to test the unit code and finally 3 months to unit-test my code. By then I'll be ready to release the first version, fix bugs and update my unit test code. Obviously, I'll need some time to test my..."

Let it be known, I didn't watch that video yet and I'm not very experienced using Unit Testing in practice :)

Lukas Šalkauskas said...

I'm talking about long-term value of TDD.

If I need a temporary software for one simple task, i will never do unit test's for it. I'm talking about long term libraries, frameworks, big long term projects.

Yeah maybe you will be ready to release smth(version of your software), but latter you will spend definitely more time for fixing some bug (imagine bug happens after a year of you code working properly and you forget everything), also you will spend definitely more time implementing new features in your code and test it properly.

And also imagine a class library which is written by me with unit tests and another by you without it, and I/you need give it to other folk to use, or implement some features, so he can easily read unit test and learn how to use my library without any introduction to it/imagine your way of doing that :), so it automatically becomes some kind of usage documentation, and user can play with it, and watch what happens.

Some time ago I already using it for my hobby projects. But now I have no time for "hobby projects", so I stopped, but I think I need start using in work.

If you have concerns about TDD, you can read wiki about it, also you can try read this : http://misko.hevery.com/

"Misko Hevery - works as an Agile Coach at Google where he is responsible for coaching Googlers to maintain the high level of automated testing culture."

Isaack said...

No concerns, merely joking :)

Lukas Šalkauskas said...

I know, me too :)
also this is good article about it:
"TDD: Test-Driven Development with Visual Studio 2008 Unit Tests" http://weblogs.asp.net/stephenwalther/archive/2008/03/19/tdd-test-driven-development-with-visual-studio-2008-unit-tests.aspx

Post a Comment