Best Practice: Use New Accounts For Each Test

  • 18 May 2021
  • 0 replies
  • 16 views

Userlevel 1
Badge +1

Reusing your test accounts is an antipattern

Reusing an account between test runs can lead to:

  • Problems with account state before testing starts
  • Failures when account setup code has changed
  • Failures that only show on other accounts (like your production customers)
  • Parallelisation problems between tests using the same account

When should you create a new account?

Roughly speaking, whenever your tests aren't interacting with previous or future tests:

  • Running a test on different platforms
  • Running a test that doesn't depend on other test state (tests with shared state are also an antipattern)
  • Every time you run a test suite

0 replies

Be the first to reply!

Reply