> For the complete documentation index, see [llms.txt](https://petozoltan.gitbook.io/simplecode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://petozoltan.gitbook.io/simplecode/clean-code/clean-code-outline/unit-tests.md).

# 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:

![](/files/-M1fWXicBtavoUQL8PLz)
