What is Unit Testing? Pros and cons of Unit Testing?

A unit test is a test that checks a single component of code, usually modularized as a function, and ensures that it performs as expected.

Unit testing is a type of atomic testing method that many people argue about.  Some think it’s necessary and useful, while others don’t like to use it unless they are forced to do so, for example: Unit Testing is a part of a bidding project.  

Theoretically, Unit Testing is a good for health software application, but why many people resists it, despite the fact that the software industry is becoming more complex and doom to failure without any measure against the rot code.

Safety net for source code

Benefits
Pros of Unit Testing

  • Change your mindset into "failing tests" first. Think about imperfection before you are going for perfection.
  • Changes for developer team to dig through the implicit requirements.
  • Changes for developer team to simplify the business complexity.
  • Tests can fail intermittently for a number of reasons and identifying why they fail is often revealing about your codebase and environment.

Limitations
Cons of Unit Testing

  • Unit Testing (UT), literally half-automation testing, requires a more complex environment and lots of effort to set up and tear down. If test coverage is not sufficient enough, the test quality is not up to par. It's like a medical prescription which requires a sufficient amount of taking drugs to cure the disease.
  • UT requires having go/no-go decision points, otherwise useless.
  • UT is not a part of the project lifecycle. If UT is a must-have choice, it’s highly recommended to experimental UTs for a set of critical test cases, i.e. edge test cases. For the system upgrades in future, the technical team will extend test case scope for the intensive processing.
  • UT brings the increased risks and increased cost for the project. it will take time to build the testing environment for Unit Testing.
  • UT is useful for the commercial systems having a large user base or high volume of transaction data.
  • UT cannot prevent the objective from the “unknown unknown risk” so in the run, it’s necessary to initiate the annual maintenance plan to prevent unplanned failure.
  • It isn't realistic -- or necessary -- to expect 100% code coverage through UT. The unit tests a development team creates depends on business needs and the application or applications' complexity.
  • If your team has no proper framework for UT execution, it's better to set up an isolated UT system to execute periodically not just development/staging but also production environment. This will not affect the performance of the up-and-running Portal system. There are various commerce tools to develop UT projects.

Via TIGO Solutions

Category