Before we begin, let us get one thing right, Unit Testing has been around for decades and surprisingly people learn of it quite late, among the last things ! Here is an overview of a serious recruiting basic requirement.
What is Unit Testing ?
- unit testing is a test
- define a basic block / unit and test
- the outcome is passed or fail
forms part of Test Driven Development
David J. Panzl in 1976 described testing tools as those of unit testing suites
Sample – python with integrated module
import unittest def add_one(x): return x + 1 class MyTest(unittest.TestCase): def test(self): self.assertEqual(add_one(3), 4)
now if 4 is not returned well your test failed
- Modularisation : Find the gears of your software. Knowing which part works helps with customisations and tuning. This point runs into many other points.
- Detection : Find problems before they occur on main run
- does not catch system-level errors
- some blocks cannot be unit tested
- too many and that method is redundent
- book keeping – say welcome to your new clerk : the change and test doc writer