Unit test

F.I.R.S.T.:

  • Fast: Unit tests are small pieces of code that perform one, specific task.
  • Independent: Unit tests must be independent of each other.
  • Repeatable: A unit test should be repeatable and if run multiple times should produce the same result.
  • Self-validating: This means that to learn if a unit test has passed or not, the developer should not do any additional manual checks after the test completes.
  • Thorough? - Timely?: This means that when testing a function, we should consider a happy path as well as a negative scenario.