Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 996 Bytes

1.readme.md

File metadata and controls

34 lines (23 loc) · 996 Bytes

Unit testing

Is a software development process during which the smallest testable parts of an applications are collectively and independently assessed for operability.

A unit test is a method that tests a unit of behavior represented by an individual class or a function/procedure/method.

Scope of unit testing

  • Core business logic methods / functions

  • High-risk services

  • Utility methods and algorithms

    DO NOT

  • Procedures that don't contain any validations ( E.g Models).

  • Configuration (e.g constants, read-only fields, configs, enumerations).

  • Private methods / functions directly.

  • Database queries or multi-threading code.

Benefits

  • Enable safe refactors
  • Find bugs quickly and easly
  • Save time and money
  • Provide code documentation for developers.

The FIRST principle of Writting Unit Test

  • Fast
  • Isolate & Independent
  • Repeatable : must be deterministic.
  • Self-validation : clearly indicates whether it passes or failed
  • Thorought and timely