Mystery Guest

Test relies on external resources not visible in the test.

Meszaros, xUnit Test Patterns

Signs of Use (Symptoms)

  • Test reads from a file on disk that’s not shown in the test.
  • Test depends on database state set up elsewhere.

Refactoring Solution

  • Inline test data or use clearly named fixtures.
  • Setup data explicitly in the test.

Code example

Bad

Good