...

/

[F]IRST: [F]ast

[F]IRST: [F]ast

Learn the importance of running tests efficiently.

Slow and fast test

  • Fast tests deal solely in code and take a few milliseconds at most to execute.
  • Slow tests interact with code that must handle external components such as databases, files, and network calls. They can take many times longer.

The distinction between fast and slow unit tests is somewhat arbitrary.

Time taking by tests

On a typical Java system, we’ll probably want a few thousand unit tests. If an average test takes 200 ms, we’ll wait over eight minutes each time to run 2,500 unit tests.

Eight minutes might not seem terrible, but we’re not going to be able to run an eight-minute set of tests too many times throughout our development day.

Below is a dialogue between a recently recruited developer and his ...

Access this course and 1400+ top-rated courses and projects.