Saturday, June 22, 2019

Test F.I.R.S.T.

This acronym is in Robert Martin's book Clean Code page 133.

F.I.R.S.T.

  • Fast —Tests should be fast. When tests run slowly, you won’t want to run them frequently.
  • Independent — Tests should not depend on each other. Tests should be able to run in any order.
  • Repeatable — Tests should be repeatable in any environment. If your test aren’t repeatable in any environment, then you’ll always have an excuse for why they fail.
  • Self-Validating — Tests should have a boolean output. You should not have to read through a log file to tell whether the tests pass.
  • Timely — Tests need to be written in a timely fashion. Unit test should be written just before the production code. If you write tests after the production code, then you may find the production code to be hard to test.
source: Clean Code: Unit Tests

No comments:

Post a Comment