Community

The best developers test their code

I am always surprised at how many software developers I meet who are reluctant to write unit tests. Writing good tests is a crucial part of becoming an expert software developer. The best developers I know all consider writing unit tests a crucial part of software development. All of the most successful software companies consider testing ability a vital selection criteria for promoting or hiring senior developers.

But you don’t have to just take my word for it – I have collected quotes from software developers at top software companies to explain how testing their code made them into the top developer they are today. You can share these quotes with your team as inspiration, or with the world using the tag #testyourcode. Maybe we can make software quality just a little bit better today.

I didn’t know how bad a developer I was until I started writing unit tests. At first, it seemed like a waste of time, but as I started writing more and more I noticed that I was catching bugs much earlier in development, which made them a lot easier and faster to find and troubleshoot. Previously, I would write code, deploy, find a bug, spend ages trawling through logs trying to find root cause, fix it, then redeploy. There’s a lot of wasted time there. I would frequently lose half a day because of typos. After I jumped on board the unit testing bandwagon, the quality of what I deliver has increased to the point that the amount of respect I get from my colleagues makes me feel awkward. They think I’m blessed or something. I’m not gifted or blessed or even that talented, I just test my code.

– Justin Yancey, Senior Systems Development Engineer, Amazon

I quickly learned how expensive (both in terms of $$$ as well as reputation) it is to fix bugs in production vs. catching them before users do.

Sibley Bacon, Senior Manager Engineering, Google

To me, writing tests is a core part of building features or fixing bugs. Reviewing test coverage is a key part of reviewing a pull request. Ensuring strong test coverage has helped teams at GitHub prevent regressions when building features, fixing bugs, or refactoring, even with a lot of other engineers working in the codebase.

– James Dennes, Software Engineer, Github

Testing is a necessary part of software development. It ensures the release of high quality and reliable code. Most importantly testing the functionality of your code and ensuring it works as expected is how you maximize customer satisfaction. I’m happy as a developer when I know that the code I ship to the customer is maintainable and it works.

– Susann Keohane, Chief of Staff to the General Manager of IBM Watson Health, and a Master Inventor of 185 issued patents

One of my most formative experiences writing software was an internship I did at Google. I don’t think I’d ever written a test before. We had a project which did about 500 things (had 500 tests) with Firefox. My job was to make those 500 tests pass with Chrome. I learnt very quickly the value of a good test suite; I could see my progress very visibly, I knew when I broke things adding new features. And I got a little addicted to making just one more test pass. Seeing how much having those tests made my life easier, introduced certainty and progress and reliability, had a big impact in the developer I am today.

– Daniel Wagner-Hall, Staff Software Engineer, Twitter

When I was starting out in my career in software development I had a conversation with a friend who had recently returned from working in the US.  He impressed me with having quite a good way of summing up some of the more high-level software engineering skills that really didn’t feature in my degree course at that point. Fresh out of University I really wasn’t thinking too much about the testing software with automated tests and I really felt that coding was the most important thing.

My friend said “Okay; with you with your code how do you know it works?”

And of course I started responding “Well you know I ran it and…”  And of course I realised that my new code would interact with previous code, and I would not be able to test it myself as I added more and more code.

In that moment actually realised that he was right with the point that he was making.  He was right that in fact I couldn’t possibly know that my code was working just by running it and clicking on some stuff, trying to exercise a few branches.  And I realised at that one time that automating that process was the only possible way that actually I could actually know that my lovely code was working like I thought it was.

It seems very simple question. It seems a very simple challenge, but that question “How do you know that it works?” was actually what turned me around from not thinking automated tests were important to suddenly realising that they were vital.

– Sarah Smith, Senior Software Engineer, Expedia

Has testing your code changed your life as a developer? Add your own story in the comments below, or share on social media using the tag #testyourcode. 

2 thoughts on “The best developers test their code

  1. Automated tests are often reduced to the purpose of reducing bugs or preserving functionality. But after you get the hang of it you discover that automated tests also work as:
    * living documentation on how the API of a class works
    * design driver – because you need encapsulation to make good tests
    * performance measurement tool (for integration tests)
    * learning technique – how does this framework or functionality of my language work?
    * discovering technique for legacy code: You don’t know what this strange function does? Write a unit test to discover the output

Leave a Reply