Creating High Quality, Low Bug Code


Testing is a check process to see if an application is running as intended, or as envisioned by the developer. The idea is using a test case based on an "expected result" to test for an "actual result".

The scope and goals of testing will differ depending on the phase of development the product is in. Normally testing is divided into and conducted in three major stages; Unit Testing, Integration Testing, and System Testing. The first two start testing from smaller, more compact pieces like individual method components in unit testing, and individual functional components in integration testing. System testing looks at the application as a whole and how it functions as a collection of components. To put it simply, imagining what the application will really look like as in the hands of users and testing it in that state, from the developers' and system's perspective.

Unit testing could be considered the base of the testing process as it evaluates the smallest components of the application. This is the point where the overall quality of the product can be greatly improved with opportunities like finding bugs and fixing them here. Testing isn't only conducted once, instead it's essential to conduct tests coinciding with code changes and doing it multiple times.

Testing is broken down into two types. The first is manual testing which is done by human beings themselves. The other is automated testing, which is handled by automated tools that are set to the specifications of the test case. In recent years the scale of applications have continued to get bigger and bigger, in turn causing changes and updates to become more frequent. Because of this reality automated tools and frameworks have come to be utilized with more aggression in each phase of testing.


Learning Objectives

With team-based development, bugs caused by code written by different developers or changes in code can result in unforeseen effects.

If testing is conducted continuously throughout the development process it becomes much, much easier to find the bugs caused by such issues. Improvements in development speed can also result from a sense of relief that comes from being able to develop knowing that changes in existing code can happen without fear of breaking everything.

Furthermore, if a developer learns how to create a suitable test case they may gain the awareness to minimize the pratfalls and mistakes that lead to bugs or critical errors through the act development itself.

Testing happens every time there is a change or a new feature added to an application when it comes to development. Learning about test automation will definitely be a benefit to any developer.

Learn from Here

Take the opportunity here to learn about a unit test that utilizes the JavaScript testing framework, Jest. To start, try to visualize test automation by learning about a unit test limited to JavaScript (Node.js) without worrying about including Express.js.

  • Conducting a Unit Test With Jest

    Install Jest

    Use Matchers

    Test Asynchronous Code

    Setup and Teardown

    Mock Functions

    Write a Test for a FizzBuzz Program

Recommended Materials

  1. Jest

Share what you learn today!