F.I.R.S.T principles of testing
- Fast
- Isolated/Independent
- Repeatable
- Self-validating
- Timely
Thread

Fast

You should be able to run the unit tests at any point of their development cycle.

Even if there are thousands of unit tests, they should run & show you the desired output in a matter of seconds

Isolated/Independent

For any given unit test, for its environment variables, It should be independent of everything else so that it results is not influenced by any other factor

Should follow the 3 A’s of testing: Arrange, Act, Assert

Repeatable

Tests should be repeatable, their values shouldn’t change based on being run on different environments.

Self-validating

You shouldn’t need to check manually, whether the test passed or not.

Timely

Unit tests should be written just before the production code that makes them pass.

If you write tests after the production code, then you may find the production code to be hard to test.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.