find a location for property in a new city

Thursday, 6 August 2015

Skipping unit tests is a false economy

You only need unit tests if you write buggy code but why would I write bugs? I don't need them.

For a long time I thought unit tests was just vanity code. Oooh look, I've made this repository unit testable and I've used my fav' IoC container to inject dependencies now so in my tests I mock them to create and elegant suite of unit tests. No one will ever run the tests but it is cool because all the top dev bloggers write about it.

That is probably a lot of people's motives, that and the lead dev told them to. You can tell when people don't fully understand why they are writing unit test when they are running short of time to complete their work and the first thing they compromise is the unit tests. Unit tests are always the first to be dropped in high pressure environment.

Let me sell unit tests to you

They save you time! How can that be right? They take so long to write and refactor every time you change your code. Unit tests save you time because you no longer need to trawl through mountains of code to work out in you head any possibility for causing a bug. You don't need to step through every line of code in your application finding potential for unexpected consequences when you have decent unit test. Which saves so much time!

Worse still is the people that wouldn't have trawled through the code to find a potential bug and just committed their code anyway and broke something. Sooner or later it will get noticed and someone is going to spend a very long time tracking it down and then fixing the root cause.

What about deployment time as well, when you come to merge and commit a branch or do a deployment, how long would it take you to review every line in the merge or click about every section of the site? 30mins? Hours? Or maybe you wouldn't bother and as mentioned that is when the even harder to find bugs creep in. It is such a waste of time!

Writing unit test from the beginning will slash all this wasted time!

Unit tests should be the first things your write!

This is called TDD (Test Driven Development) and it is the most effective way of ensuring your tests get written as you can't drop them out to save time as they are already written. It also forces you to really think about your code before writing it.

But TDD or not, please PLEASE write them. Lots of them. Use NCrunch that has continuous test runners for your test suite and shows the lines of code covered and the state of that test. Aim for 80%+ code coverage from the beginning and you will save so much time in the future doing all that boring clicking about or line by line reviewing of your code merges.

Not writing unit tests is a false economy

And developers are expensive so don't waste their time.

Please send this on to your team including the project manager. Everyone must know the importance of getting unit tests done and written well.

Follow britishdev on Twitter

24 comments:

  1. This was so helpful. This article showed me the importance of unit tests.
    digital marketing training courses in chennai

    ReplyDelete
  2. You have really great work. I appreciate your hard working. "Skipping unit tests is a false economy" Really great post because in which you discuss some informative points. Heavy duty Grass Mats for sale visit our site http://groundreinforcementmeshuk.co.uk/grass-mats.html

    ReplyDelete
  3. You done a great job. I really enjoyed by reading your blog post. Thanks a lot for providing us this unique post which will be helpful in attaining my knowledge


    Digital Marketing Training in Chennai

    ReplyDelete
  4. The blog is Really informative and looks realistic. I appreciate your style and surely come back again to increase my knowledge.Mostly comments to match to eatch other.I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got Garage Flooring

    ReplyDelete

  5. Thanks for posting this useful content, Good to know about new things here, Let me share this, . Hadoop training in pune

    ReplyDelete
  6. You don't have to worry about customer support, you don't have to worry about staff, you don't have to worry about investing thousands of dollars into starting a traditional business. You can also do it part-time around your current job until you are earning enough money to replace the income.
    top stocks

    ReplyDelete
  7. Education online is getting very popular and lots of people are choosing to improve their skill through an online course. Here I tell a story about 4 young boys who's education I followed closely and watched how successful some of them became because of there determination to succeed in life. This is a possibility for most people if they put their mind to it and believe that they can do it.http://www.thesisexample.info/

    ReplyDelete
  8. I like your all post. You have done really good work. Thank you for the information you provide, it helped me a lot. I hope to have many more entries or so from you.
    Very interesting blog.
    http://www.baixarfacebookgratis.com.br

    ReplyDelete
  9. Interesting post! This is really helpful for me. I like it! Thanks for sharing!

    Webseiten Gestaltung L├╝denscheid

    ReplyDelete
  10. For instance, since about one quarter to one portion of all store checkout paths are currently these self-operational machines,investment article

    ReplyDelete
  11. Thanks for sharing this very useful kindly visit us @ Jewellery box

    ReplyDelete
  12. AvriqPrinter RepairPrinter InstalltionWifi trouble shooting
    Software InstalltionNicely well-written article. It was an awesome article to read. Complete rich content and fully informative.
    Virus removal

    ReplyDelete
  13. Very nice post here thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.

    Digital Marketing Course in Chennai
    Digital Marketing Training in Chennai
    Online Digital Marketing Training
    SEO Training in Chennai
    Digital Marketing Course
    Digital Marketing Training
    Digital Marketing Courses

    ReplyDelete
  14. Good stuffs from this blog. I got very interesting points in this article Thanks for providing very nice article Such a lovely website !
    Water purifier service in Coimbatore Aquaguard Service Centre in Coimbatore

    ReplyDelete
  15. Surprisingly better, you can catch those investment bargains on magnificent properties that would go for three to four fold the amount, if not more, in your very own nearby market. Your obtaining power turns out to be substantially more grounded in different markets, on the grounds that everything's relative.option alert service

    ReplyDelete
  16. Amazing article. Your blog helped me to improve myself in many ways thanks for sharing this kind of wonderful informative blogs in live. I have bookmarked more article from this website. Such a nice blog you are providing ! Kindly Visit Us @ Madurai Travels ! Best Travels in Madurai | Tours and Travels in Madurai

    ReplyDelete
  17. Generally, on the grounds that they don't show their monetary specialists how to be incredible stock guides and how to distinguish openings in the worldwide markets that will boost the profits in your portfolio. bitcoin casino slots

    ReplyDelete