Should Developers Test Their Own Code?

What do you think about testing? This is a topic I want to gain more knowledge on, and I realize the importance of software testing. There are a lot of different tests. Luckily, you don’t have to be an expert on all the different types. There are pros and cons of testing, but should developers test their own code?

Should Developers Test Their Own Code- bug

Before I researched this, I just realized how broad the topic was. Fortunately, there are a lot of testing tools that help developers ensure the quality of their software.

Luckily, there are usually departments that handle testing in the workplace, and specific developers focused on only testing, such as Software Engineer in Test, QA Software Engineer, etc.

Not every company has a QA team, and it is essential to be knowledgeable about testing to be an asset to your company.

Primarily if you work at a startup, there may be no QA team, and you may have more responsibility than the role you were hired for.

I want to investigate what testing is and the pros and cons of testing. Do you think testing is worth the trouble, and what next steps can you take to be a better asset to your company?

What is Testing?

To ensure that our software applications are working as we want them to, we need to test them. When I started Lambda School, aka Bloom Tech, I didn’t understand why we needed testing. At that point, the school didn’t have a detailed testing unit, but no school is perfect.

Should Developers Test Their Own Code? - What is it?

After researching online and talking to other developers, I am proud to say I have gained more knowledge about software testing.

Testing can ensure that other developers don’t unintentionally break our code if we work on a team with other developers. Testing helps other developers, as well as yourself, understand what a piece of code is doing.

In software development, there are usually constant changes to product requirements. Testing allows us to easily change our code without breaking it.

Pros and Cons

Pros

Helps Find Bugs

As I mentioned above, writing tests can help track down bugs that would otherwise take a while. I remember I was on a team in school to build a product for a real-life stakeholder, and we had to get the product out fast, and writing tests should have been a priority.

While testing our API, I used Postman for some manual testing. I plugged in the URL for one of the update endpoints, and it worked. However, we did not have a separate testing database, and I accidentally altered the data in the production database. That growing pain led me to investigate the testing topic more.

Imagine if you have a giant application with over 100 endpoints. It would definitely be worth automating those tests. You would have to spend hours plugging in every single endpoint into the Postman every time the code changes, and that would drive developers crazy.

Helps Other Developers

If you are on a team, testing is a way to tell developers that they should not alter specific code. If you change someone else’s code, be prepared to spend hours with your team trying to find that feature that was changed.

Cons

Expensive

However, testing is expensive. In many companies, there may be whole teams dedicated to testing. If companies do not have a QA team, the testing may rest on the developer’s shoulders, writing the code.

Should Developers Test Their Own Code?- Money

If the project has a deadline and needs to be shipped out fast, testing can be a drawback because it involves a lot of time developers have to spend on it, which means the company pays more.

This was the situation with the team I worked with. We were under a tight deadline.

Big Time Commitment

Depending on the type of testing required, you need to learn a framework to test your application. For example, I have done a lot of development with React. One of the trendy end-to-end testing frameworks is Cypress.

Should Developers Test Their Own Code? - Time

This framework is fun to learn. When you use it, it opens up a browser and simulates events that users take. There is a big-time commitment to learning this framework.

Should I Bother?

The answer is that it depends. It would help if you weighed the pros and cons. Some applications are far more critical than others and have detrimental effects if a bug occurs.

A lot of companies incorporate Test-driven development as their software development process. This is writing the test cases of the expected behavior first and then writing the code and refactoring until the test passes. I appreciate this software development style more with the bugs I have made in the past.

My Experience with Testing

I have made so many small personal projects that I didn’t even write any tests. I relied on Postman on the backend to test my APIs because there weren’t any.

However, for some personal projects, I recommend testing your apps, no matter how small, so that you can showcase your ability. You could end up working at a company where writing some tests is your responsibility, even if there is a QA team.

Next Steps

Thank you for reading my blog. I hope that you found a lot of value in it. Testing is crucial for every developer to know; you never know when you will need it.

If you are tired of spending hours finding bugs in your code, you should develop better skills in testing.

To learn about testing, you may want to look at Treehouse, Codecademy, or Udemy.

If you have comments, let me know below. Please share this on your social media.

Here are some questions to get the conversation going:

  1. What is your experience with testing?
  2. What would your advice be for a new developer about testing?

The topic of testing is so broad that I hope to write more articles about it as I learn more.

Leave a Comment

 

33 views 0 Shares
Share via
Copy link