Contents tagged with test

  • Why doesn't some of you write unit test?

    I have educated over 1000 developers the last 1 1/2 year and about 5% of them raise their hands when I ask them if they writes test, like unit test or if they use Test Driven Development (TDD). 5%! That is not much. When I asked them why they didn't write any tests, the answer is often, we should but don't have time to do it, some answer "we have test but no one maintain the test and update them".

    "Test code is just as important as production code." - Robert C. Martin "Clean Code".

    If you don't have any unit test, you will spend more time to test your changes (probably manually by using the applications user interface). When you need to do changes to your production code you must make sure your changes work, and all other part of the system will still work after the changes. Most of you would probably not even change existing code because of being afraid to "destroy" something. In this case you add more code that will mostly make the code smell and sooner or later rot. WIth a test in place, you don't need to be afraid of changes, it will make it easier to maintain your application. The interest of writing clean code among developer have increased lately, have in mind that writing unit test is writing code, and that code is also important to have clean. If it's not clean, people will sooner or later not maintain it, it will be harder to change and will rot. When a test start to rot, the production code will also start to rot. There aren't any excuses to skip unit test, or?

    Read more...