Day Zero: WTH is software testing?

Yomi N.
3 min readSep 7, 2018

--

Let’s begin with a Wikipedia definition shall we?

Software Testing, the process of verifying that a software program works as expected.

In everything we do, there’s the expected output, and then there’s reality. This becomes more pronounced when anything is designed to be part of another system, or

“Oh sure, it’s very important obviously, I test my code as I write it, duh”

The words of every newbie developer, it’s alright though, everyone has humble beginnings. Manual testing is quite inefficient, and lets be honest, also terribly unprofessional, unless you sit down and send like a billion requests with every possible character combination through that login form you just built. Don’t forget the emojis.

Two very important levels of testing ASAP;

  • UNIT TESTING is a level of software testing where individual units or components of a software are tested. An example is writing tests to check every function in your code individually, and yeah, the functions are the units. The purpose is to ensure that each unit[function] of the software behaves how you intended it to.
  • INTEGRATION TESTING is a level of software testing where individual units are combined and tested as a group. The purpose of this level of testing is to show that might occur as different units of code come together and start interacting with each other. In short, you test whats happens when the different units behave as a system and no longer a individuals.

Test drivers and test stubs are used to assist during software testing. For example if some function in your code requires, say a user to respond by making a payment through an external system or third party, takes response this third party, and you intend to test this function’s behavior when this happens, your guess is as good as mine. 100% failure is certain. But what stubs do, as simply as possible, is to mimic the behavior of the external service, so your tests don’t fail because of some external factors. In other words, no excuses for your tests to fail. If they do, completely your fault.

Yeah, but why should I write tests

In case this wasn’t passed across enough in the beginning, here are some more concrete reasons to write tests for your code.

  • Helps ensure that the application should not result into any failures because it can be very expensive in the future or in the later stages of the development.
  • If you and possibly other people are going to modify your code, it’s very easy to break it in unexpected ways. A suite of automated tests gives you confidence you’ve not broken anything significant.
  • Tests can be used for profiling, to help you understand changes in your system’s performance, and raise a flag if something degrades significantly.
  • Most importantly, makes you a more employable, and overall, more bad-ass developer.

Next Steps

It’s alright to not know how to write tests yet, but please do yourself a favor and just check out the various tools for testing whatever you write, and for web developers, you can check out this intro to Mochajs, a java-script testing framework.

PS: I feel java script is quite an unpredictable programming tool and not testing your JS code when building enterprise web applications is murder for you, your boss and every unfortunate human being that would come in contact with your code. Please, please and please test. My sincerest condolences to JS developers around the world.

--

--