What is Unit testing?

  • A unit is the smallest testable part of an application like functions, classes, procedures, interfaces. Unit testing is a method by which individual units of source code are tested to determine if they are fit for use.
  • Unit tests are basically written and executed by software developers to make sure that code meets its design and requirements and behaves as expected.
  • The goal of unit testing is to segregate each part of the program and test that the individual parts are working correctly.
  • This means that for any function or procedure when a set of inputs are given then it should return the proper values. It should handle the failures gracefully during the course of execution when any invalid input is given.
  • A unit test provides a written contract that the piece of code must assure. Hence it has several benefits.
  • Unit testing is basically done before integration as shown in the image below.
What is unit testingAdvantages of Unit testing:
3. Since the bugs are found early in unit testing hence it also helps in reducing the cost of bug fixes. Just imagine the cost of bug found during the later stages of development like during system testing or during acceptance testing.

4. Unit testing helps in simplifying the debugging process. If suppose a test fails then only latest changes made in code needs to be debugged.

Comments

Post a Comment

Popular posts from this blog

Compare a range of Hardware and Software Troubleshooting Tools

What is System testing

What is Boundary value analysis in software testing?