A Beautiful Day For Unit Tests

A Beautiful Day For Unit Tests

Writing unit tests on Legacy Code is an adventure. Today I spent several hours doing that with two developers, Mark and Yelena.

The system has a flow you are used to and when you write code you fit it into this flow. Then you test the entire system.

With unit tests it works differently. You are required to start the flow from the middle and stop it when your deed was done.

This requires a different level of system understanding. When we started off in the morning we looked at the code and thought “how are we going to harness this?”

To instantiate the class we needed a session so we extracted the code to a different place, then there was a logging mechanism we had to bypass. Everything was almost working when we realized that instead of getting a specific exception we got a null pointer. After additional investigation we found that the exception itself throws the null pointer because it didn’t get the file access it required.

On the way we found defects, it was a pleasure.

The main achievement was to reduce the level of anxiety from doing this. The more you practice it the faster it will go and you will become a true master of the system. Do not hesitate – take that adventure!

要查看或添加评论,请登录

Yaki Koren的更多文章

  • How to change mindset - the Jahnun lesson

    How to change mindset - the Jahnun lesson

    As a coach helping organizations become agile, I'm asked how to change the mindset of the people, how to help them see…

    1 条评论
  • How to Achieve Valuable Retrospectives

    How to Achieve Valuable Retrospectives

    “Oh no, it’s retrospective time!” This cry for help is not uncommon, I’m afraid, among practitioners of scrum. That is…

  • The horrible truth about software development estimation, and what to do about it

    The horrible truth about software development estimation, and what to do about it

    The Horrible Truth In recent years I've been working with many software development teams and almost all of them…

  • 5 steps to get unit tests going

    5 steps to get unit tests going

    Once you start unit testing, you will find significant benefits to your design, throughput, quality and peace of mind…

    3 条评论
  • Setting Goals For Improvement - Leading vs. Lagging

    Setting Goals For Improvement - Leading vs. Lagging

    Many organizations are becoming agile to improve quality, throughput or many other good things that agile brings along.…

  • 3 steps towards better team work

    3 steps towards better team work

    Working with teams I sometimes feel that teamwork is similar to the weather: everybody talks about it but not much is…

  • Legacy Code: Extract-FirstUT-Cover-Refactor-TDD

    Legacy Code: Extract-FirstUT-Cover-Refactor-TDD

    Recently, I had the opportunity to work on legacy code with several teams from various organizations. I would like to…

  • The Professional Developer

    The Professional Developer

    Last week I called a technician to repair an electrical shutter that was broken. The technician did a good job in…

  • Amusement Park Methods

    Amusement Park Methods

    Sometimes you stumble upon amusement park methods. Remember the feeling when first going through the gates of a big…

  • Team Storming and Compost

    Team Storming and Compost

    A team I am working with is in the storming stage of their development. Finally.

社区洞察

其他会员也浏览了