Unit Testing
Unit testing is checking the smallest pieces of code, usually single functions or classes, in isolation, with automated tests that compare actual results with expected ones. Dependencies such as databases or network calls are replaced by mocks or stubs so each test is fast and reliable.
Unit tests catch bugs early, make refactoring safe and document how code should behave. Higher levels of testing include integration tests (parts working together) and end-to-end tests (the whole app). In Test-Driven Development (TDD) the test is written first. Popular frameworks are JUnit (Java), pytest (Python), Jest and Vitest (JavaScript) and NUnit (C#).

