Unit Tests

It is not part of this document, find only some thoughts here.

Clean Code = Testable Code

Rules

  • Continuously write unit tests

  • Maintain unit test - keep them running

  • TDD - Test Driven Development

  • Tests must be clean too - they will change with the code

  • Tests must obey the test patterns

  • F.I.R.S.T. principles

Benefits

Enforces to write testable code Makes the code flexible - changes with regression tests

Code coverage

  • Try to reach higher levels (>90%)

  • Do not write tests only for the sake of the code coverage

Good practices

  • Use the default (package) visibility for the sake of the unit testing

Unit Testing briefly:

Last updated