Skip to main content

Test naming conventions that actually communicate intent — what works for our team

Ajitesh Mohanta
Ajitesh MohantaAmbassador
Feb 10, 2026 4,099 0
Test names are the first thing you read when a test fails in CI. After years of bad names, here's the convention our team landed on: **Format:** `test_[action]_[context]_[expected_outcome]` Examples: ``` test_create_user_with_duplicate_email_returns_409 test_checkout_flow_when_cart_is_empty_shows_empty_state_message test_admin_user_can_access_settings_page test_regular_user_cannot_access_admin_panel ``` **Rules we enforce:** 1. No "test_happy_path" or "test_sad_path" — be specific about what happy means 2. The expected outcome is always part of the name 3. Use `when` or `with` to set context: `test_login_when_account_is_locked_returns_403` 4. Avoid abbreviations in test names — they're documentation This seems obvious written out but our old tests had names like `test_user_1` and `test_checkout_3`. The refactor took a sprint and we've never looked back.

Join the discussion

Have something to add?

Sign in to reply, follow this thread, and earn XP when your answer helps someone.

Test naming conventions that actually communicate intent — what works for our team — QA Bash Community | QA Bash