lecture 4 of 180 completed

Fixtures: setup that cleans up after itself

Custom fixtures give each test what it needs and take it away afterwards, without repeating code.

What you'll learn

  • How a custom fixture replaces repeated setup
  • Why setup and teardown belong in one function
  • How a test declares only what it needs

Open your test files and count how many times you see this:

members only

Keep reading with the full course

The Foundations track and the first 5 lectures of each framework are free. This lecture is part of the paid course, which unlocks every lecture, all three frameworks, and downloads.

See the options →