Skip to main content

Test Case Template

Test Case Template

Project: {{PROJECT_NAME}} Version: {{VERSION}} Date: {{DATE}} Author: {{AUTHOR}} Status: Draft | In Review | Approved Reviewers: {{REVIEWERS}}

Document History

Version Date Author Changes
0.1 {{DATE}} {{AUTHOR}} Initial draft

1. Test Case ID Format & Naming Convention

Format: TC-{{MODULE_CODE}}-{{SEQUENCE}}

Part Description Example
TC Test Case prefix (always TC) TC
MODULE_CODE 2-4 letter module abbreviation AUTH, CART, PAY, USR
SEQUENCE 3-digit zero-padded number 001, 042, 100

Examples:

  • TC-AUTH-001 — Authentication module, first test case
  • TC-PAY-015 — Payment module, 15th test case
  • TC-CART-003 — Shopping cart module, 3rd test case

2. Test Suite Organization

Suite ID Suite Name Module Test Cases Owner
TS-AUTH Authentication Auth module TC-AUTH-001 to TC-AUTH-XXX {{OWNER}}
TS-CART Shopping Cart Cart module TC-CART-001 to TC-CART-XXX {{OWNER}}
TS-PAY Payment Processing Payment module TC-PAY-001 to TC-PAY-XXX {{OWNER}}
TS-SMOKE Smoke Tests All critical paths TC-SMK-001 to TC-SMK-XXX {{OWNER}}
TS-REG Regression Suite Full application All high-priority TCs {{OWNER}}

3. Individual Test Case Format


Test Case: TC-{{MODULE}}-{{SEQ}}

Field Value
ID TC-{{MODULE}}-{{SEQ}}
Title {{CONCISE_DESCRIPTION}}
Description {{FULL_DESCRIPTION}}
Module / Feature {{MODULE_NAME}}
Priority {{PRIORITY}}
Type {{TYPE}}
Requirement {{REQ_ID}} / {{STORY_ID}}
Automation Status {{STATUS}}
Automation ID {{AUTOMATION_ID}}

Preconditions

  1. {{PRECONDITION_1}}
  2. {{PRECONDITION_2}}
  3. {{PRECONDITION_3}}

Test Data

Field Value Notes
Email {{TEST_EMAIL}} Test account, pre-created
Password {{TEST_PASSWORD}} Stored in test vault
{{DATA_FIELD}} {{VALUE}} {{NOTE}}

Test Steps

Step Action Expected Result
1 {{ACTION_1}} {{EXPECTED_1}}
2 {{ACTION_2}} {{EXPECTED_2}}
3 {{ACTION_3}} {{EXPECTED_3}}
4 {{ACTION_4}} {{EXPECTED_4}}

Expected Final Result

{{OVERALL_EXPECTED_RESULT}}

Post-conditions

  • {{POSTCONDITION_1}}
  • {{POSTCONDITION_2}}

Notes / Edge Cases

  • {{NOTE_1}}
  • Related: TC-{{RELATED_ID}}

4. Priority Definitions

Priority Definition Examples
Critical Core functionality; system unusable without it Login, payment, data persistence
High Important feature; significant user impact if broken Search, notifications, user profile
Medium Standard feature; workaround exists Export, advanced filters, preferences
Low Minor feature, cosmetic, or edge case Tooltips, sorting preferences, animations

5. Test Case Type Definitions

Type Description
Functional Verifies a feature works as specified
Regression Verifies previously working functionality still works
Smoke Fast check of most critical paths (subset for quick confidence)
Boundary Tests at the edges of valid input (min, max, empty)
Negative Tests invalid input, error conditions, unauthorized access
Performance Verifies response time, throughput under defined load
Security Verifies access controls, injection resistance, auth
Accessibility Verifies WCAG compliance, keyboard navigation, screen readers

6. Batch Test Execution Template

Test Run: {{RUN_ID}} Environment: {{ENVIRONMENT}} Build / Version: {{VERSION}} Tester: {{TESTER}} Date: {{DATE}}

Test Case ID Title Priority Result Actual Result / Notes Defect ID
TC-{{MODULE}}-001 {{TITLE}} Critical Pass / Fail / Blocked / Skip {{NOTES}} {{DEFECT_ID}}
TC-{{MODULE}}-002 {{TITLE}} High

Summary:

  • Total: {{TOTAL}}
  • Passed: {{PASSED}}
  • Failed: {{FAILED}}
  • Blocked: {{BLOCKED}}
  • Skipped: {{SKIPPED}}
  • Pass rate: {{PASS_RATE}}%

7. Test Execution Log Format

Timestamp Test Case ID Tester Environment Build Result Duration Notes
{{TIMESTAMP}} TC-{{MODULE}}-{{SEQ}} {{TESTER}} staging {{BUILD}} Pass {{DURATION}}s

8. Defect Linking

Defect format: BUG-{{ID}} (in {{BUG_TRACKER}})

Test Case Defect ID Severity Status Fixed In
TC-{{MODULE}}-{{SEQ}} BUG-{{ID}} {{SEVERITY}} {{STATUS}} {{VERSION}}

Defect fields required:

  • Steps to reproduce (reference test case ID)
  • Expected vs actual behavior
  • Environment + build version
  • Screenshot / screen recording
  • Severity and priority

Example Test Cases


Test Case: TC-AUTH-001

Field Value
ID TC-AUTH-001
Title User can log in with valid email and password
Description Verifies that a registered user can successfully authenticate using correct credentials and is redirected to the dashboard.
Module / Feature Authentication — Login
Priority Critical
Type Functional
Requirement REQ-AUTH-001
Automation Status Automated
Automation ID tests/e2e/auth/login.spec.ts:valid-credentials

Preconditions

  1. User account with email [email protected] exists and is verified
  2. User is not logged in (no active session)
  3. Application is accessible at {{APP_URL}}/login

Test Data

Field Value Notes
Email [email protected] Pre-created test account
Password Retrieved from test vault Never hardcoded

Test Steps

Step Action Expected Result
1 Navigate to {{APP_URL}}/login Login page loads with email field, password field, and login button
2 Enter [email protected] in email field Email value visible in field
3 Enter valid password in password field Password masked, not visible
4 Click "Log In" button Loading indicator shown, network request initiated
5 Wait for response Redirect to /dashboard

Expected Final Result

User is authenticated and redirected to /dashboard. Auth cookie/token is set. Welcome message visible. Navigation shows user's name/avatar.

Post-conditions

  • Session exists and is valid
  • Audit log entry created for login event
  • Test cleanup: session will be cleared in test teardown

Test Case: TC-AUTH-002

Field Value
ID TC-AUTH-002
Title Login fails with invalid password — correct error shown
Description Verifies that an incorrect password returns a generic error without revealing whether the email exists (prevents user enumeration).
Module / Feature Authentication — Login
Priority Critical
Type Negative / Security
Requirement REQ-AUTH-002, SEC-001
Automation Status Automated

Preconditions

  1. User account with email [email protected] exists
  2. User is not logged in

Test Data

Field Value
Email [email protected]
Password DefinitelyWrongPassword123!

Test Steps

Step Action Expected Result
1 Navigate to /login Login form displayed
2 Enter valid email Email entered
3 Enter wrong password Password masked
4 Click "Log In" Form submits
5 Observe response Error message displayed: "Invalid email or password" (generic, not "wrong password")
6 Verify URL Still on /login (no redirect)
7 Verify no session No auth cookie set

Expected Final Result

Generic error message shown. User remains on login page. No session created. Error does not reveal whether the email exists.



Approval

Role Name Date Signature
Author
Reviewer
Approver