If you’ve been a developer for any length of time, you will start to realize that we all bear scars from the struggles we’ve encountered. Some start to fade as time goes on. But there are those that will be red and gnarly for the ages. These start to define how we work, things we like to avoid, and things we become extremely passionate about.

Testing is one of those things for me.

I’ve been a developer for over ten years. Early in my career, I was not familiar with testing, and I definitely suffered the effects of that lack of knowledge. My path to software engineer was not through a traditional degree program. I was primarily self-taught, learning as I went, and doing my best to meet the business requirements of my work and to grow as a developer along the way.

When I was introduced to unit testing and other agile methodologies such as pair programming and iterating, I quickly realized their value.

Unit testing helped me write better code, as it forced me to focus on the “single responsibility” paradigm and writing more modular code. The “aha” moment of seeing the reusability of functions was great; no more copying and pasting from screen to screen. I know that might sound so fundamental that everyone should know it, but that isn’t always the case! And when you see there is a better way, you embrace it.

Next came integration testing, where I learned how to test more complex functionality within my applications by validating that units of code are working together in harmony. This allowed me to focus on developing quickly and with more confidence, while being able to quickly validate that my changes weren’t introducing bugs or errors along the way.

Finally, I learned about end-to-end (E2E) testing. Think of this type of testing as being like an autonomous user who has the ability to click through your application, testing all of the interactions that occur. This testing helps us to ensure that each action has the appropriate reaction, including things such as error handling and creating a good user experience.

You might test that when a user comes to your application, they are greeted with a welcome message, and if they attempt to log in but input bad credentials, they get a valid error message and your application doesn’t crash. As more developers interact with your code base, these tests will ensure that another interaction in your application does not regress. Additionally, E2E testing lines up closely with the overall business requirements of an application.

With each level of testing you add, you can be more confident about the resiliency of your code base. Small investments in testing up-front lead to large payoffs throughout the application lifecycle.

Originally published on TechWell Insights.

X
X