Unit Testing

Unit Testing involves testing individual components (functions, modules) of a software application in isolation.

Elaboration:

  • Usually written by developers using JUnit, PyTest, or Mocha.
  • Early bug detection reduces cost and effort in later stages.
  • Automated unit tests ensure code reliability.

Example (Python Unit Test using PyTest):

 add(a, b):
return a + b

def test_add():
assert add(2, 3) == 5