Fully Agentic Test Case Management Tool
Write, Track and Manage Every Manual or Automated Tests in One Agentic Test Management Platform with TestMu AI Test Manager.
How to Write Test Cases: Format, Examples and Templates
Learn how to write test cases with a field-by-field example, weak vs strong steps, the standard format, AI-assisted drafting, and free test case templates.
Last Updated on:
A test case tells a tester exactly what to set up, what to do, and which result proves the feature works. It is also the testing artifact AI now drafts most often: in the Applause 2025 State of Digital Quality in AI report, 65.6% of the 781 respondents using generative AI in testing apply it to test case generation.
This guide builds one real test case field by field, a password reset check for an unregistered email, then covers the standard format, scenario-specific cases, common mistakes, and how to review AI-drafted cases before they enter your suite.
TL;DR
To write a test case, give it an ID and a title that states the expected outcome, record the preconditions and test data, write one action per step with exact inputs, and define one observable expected result for each check. Anyone should be able to run the test case without asking a question and reach the same pass or fail.
- Test case vs test scenario: A test scenario is a user goal such as resetting a password, and one scenario usually needs several test cases to cover its positive and negative paths.
- Test case ID: An ID that encodes module, path type, and sequence, such as AUTH_NEG_001, tells a developer where a failing test case belongs before they open it.
- Expected result: Each test case needs one observable expected result per check, because a test case that verifies several things at once gives no clear pass or fail when it breaks.
- AI-drafted test cases: AI tools draft test cases from a requirement in seconds, but a tester still reviews them for edge cases, security checks, and product rules the model cannot know.
Where Should Test Cases Live?
A spreadsheet works for a handful of test cases. Once the suite grows, the TestMu AI Test Management Platform keeps each test case linked to its requirement, its runs, and its defects in one workspace.
What Is a Test Case?
A test case is a documented check that verifies one behavior of an application: the starting conditions, the exact steps and inputs, and the result that proves it worked. Writing one means turning a requirement into something a person or a script can execute and judge as pass or fail.
Test cases make results repeatable. Two testers running the same case on the same build should reach the same verdict, and a failing case should point to the step that broke.
Test Case vs Test Scenario
A test case is a detailed, low-level check that verifies a specific behavior with exact inputs, steps, and expected results, with no ambiguity. It either passes or fails.
A test scenario is higher-level and describes a real user goal without defining how to test it. One scenario usually leads to multiple test cases, since there are many ways a goal can succeed or fail.
For example, the login scenario is simple: a user signs in to access their account, but it breaks down into many test cases underneath.
- Valid credentials redirect the user to the dashboard
- An unregistered email address gets the same generic error as a wrong password
- A correct email with a wrong password is rejected
- Submitting the form with both fields empty shows a validation message
- An email with trailing whitespace is handled without breaking authentication
- The system locks the account after repeated failed attempts
Each item above is a separate test case. Together they show whether the login scenario holds up on the ideal path and on the inputs a real user actually sends.
How to Write a Test Case: Field-by-Field
This section builds one test case from scratch and explains each field as it is filled in. The feature is a password reset flow, and the check is what happens when a user enters an email that is not registered.
The negative path is the deliberate choice here, because a reset page that answers "this email is not registered" leaks which accounts exist. Getting this one case right covers both a functional bug and a security requirement.
Test Case ID That Encodes Meaning
A plain sequential ID like 001 tells you nothing when someone references a failing test in a bug report. Use a format that encodes module, path type, and sequence instead.
The ID for this case: AUTH_NEG_001
- AUTH - Authentication module
- NEG - negative path test
- 001 - first negative test in this module
When a developer receives a bug referencing AUTH_NEG_001, they know the module and path type before opening it.
Title That States the Outcome
If the test fails, the title should read like a bug description without rewriting.
| Weak | Strong |
|---|---|
| Test invalid email on reset page | Unregistered email shows ambiguous error, no link sent, no account revealed |
The strong title captures what you're proving, including the security requirement that the weak title loses entirely.
Preconditions Before Step One
- User is on the password reset page
notregistered@example.comdoes not exist in the system database- User is logged out
- No prior reset request made in this test run
The second precondition requires you to check the database before running. If an earlier run accidentally created this account, the negative test passes for the wrong reason and nobody notices.
Test Steps With One Action Each
The standard: a person who has never seen this application should complete every step without asking a single question.
Weak steps
Go to the reset page, enter an invalid email, and click submit, then check the error
"Enter an invalid email" - which value? "And click submit" - that's two actions in one step. "Check the error" - check what exactly?
Strong steps
| Step | Action | Input |
|---|---|---|
| 1 | Navigate to [test-env]/login | - |
| 2 | Click "Forgot password?" below the login form | - |
| 3 | Enter value in the Email field | notregistered@example.com |
| 4 | Click "Send Reset Link" | - |
| 5 | Observe the response on the current page | - |
| 6 | Check inbox for any incoming email | - |
Separating action from input forces one action per step. If your action column contains "and," you have two steps written as one.
Expected Results per Observable Output
After step 4 - The page displays "If this email is registered, you'll receive a link shortly." The wording is ambiguous on purpose: an error saying "This email is not registered" tells an attacker which addresses exist, a vulnerability known as account enumeration, so the expected result asserts the vague message.
After step 6 - No email is delivered within 2 minutes.
Test Data and Its Required State
- The email value
notregistered@example.com - Confirm this address does not exist in the database before running
- Email delivery must be active in the test environment so step 6 is meaningful
Listing "confirm not in DB" as a test data requirement turns it into a pre-execution checklist item, which prevents the false passes that negative path tests are prone to. For seeding and resetting data like this across runs, see this guide to test data management.
Done Checklist for a Test Case
- Stranger test - a colleague who's never seen the feature can execute it without asking one question.
- Failure test - if it fails, you can tell from the test case alone exactly which step broke and why.
- Rerun test - after test execution, the environment resets to its starting state without manual cleanup.
The Completed Test Case
| ID | AUTH_NEG_001 |
| Title | Unregistered email shows ambiguous error, no link sent, no account revealed |
| Module | Authentication |
| Priority | P1 Critical |
| Preconditions | User on reset page; notregistered@example.com not in DB; user logged out |
| Test Data | notregistered@example.com; confirm not in DB before running; email delivery active |
| Step | Action | Input |
|---|---|---|
| 1 | Navigate to [test-env]/login | - |
| 2 | Click "Forgot password?" below the login form | - |
| 3 | Enter value in the Email field | notregistered@example.com |
| 4 | Click "Send Reset Link" | - |
| 5 | Observe the response on the current page | - |
| 6 | Check inbox for any incoming email | - |
| After step | Expected result |
|---|---|
| Step 4 | Ambiguous message displayed, no redirect |
| Step 6 | No email delivered within 2 minutes |
| Actual Result | (to be filled after execution) |
| Status | Pass / Fail |
What Is the Standard Test Case Format?
Most teams use the same core fields, whether their cases live in a spreadsheet or a test management platform. The example above fills in the fields that need the most judgment; the table lists the full set.
| Field | What it holds |
|---|---|
| Test case ID | A unique reference that encodes module, path type, and sequence |
| Title | The expected outcome, written so a failure reads like a bug report |
| Module and priority | Where the case belongs and how much a failure matters |
| Preconditions | Application, data, and user state before step one |
| Test steps | One action per step, in order |
| Test data | The exact input values, kept out of the step text |
| Test environment | The browser, device, OS, build, or API version the case runs against |
| Expected result | One observable outcome per check |
| Actual result and status | Filled in at execution: what happened, and pass or fail |
| Requirement link | The user story or requirement the case proves |
Types of Test Cases
The fields stay the same across types; what changes is what the expected result checks. Let your requirement analysis decide the type, since a response-time requirement needs a performance case rather than a functional one.
- Functional test case - Verifies that a feature behaves as the requirement specifies, such as a reset link arriving for a registered email.
- User interface (UI) test case - Checks layout, labels, links, and visual consistency across browsers and devices.
- Performance test case - Measures response time and stability under a defined load, and is usually automated.
- Integration test case - Confirms that two modules or services exchange data correctly, such as the reset service handing a token to the email service.
- Usability test case - Checks how easily a user completes a task such as searching or checking out. For a worked set, see these test cases for search functionality.
- Database test case - Verifies data integrity and query results, and that writes are neither lost nor duplicated.
- Security test case - Checks authentication, access control, and data exposure, like the account enumeration check in the example above.
- User acceptance test (UAT) case - Confirms with business users that the release meets their requirements before it ships.
How to Write Test Cases for Specific Scenarios
The format stays fixed, but each kind of feature brings its own conditions to cover. Chatbots, for example, add multi-turn context and fallback replies, which this guide to chatbot test cases collects.
Test Cases for Login Functionality
Login needs both positive and negative cases. Positive cases cover valid email and password combinations; negative cases cover wrong passwords, unregistered emails, empty fields, SQL injection strings in the inputs, and the lockout after repeated failed attempts. Each one is a separate test case, not extra steps inside one case.
Test Cases for an API
An API test case replaces the interface with an endpoint, an HTTP method, request headers, a request body where one applies, and the expected status code and response body. For a POST /api/users endpoint, the positive case sends a valid JSON body and expects 201 with the new user ID in the response.
The same endpoint needs separate cases for a missing email field (400), a missing or expired token (401), and a duplicate email (409). Assert on the status code and the specific fields, since a full-body match breaks every time an unrelated field is added.
Test Cases for a Mobile App
Mobile test cases cover conditions a web app never sees: slow or dropped networks, an incoming call during an active session, the app being backgrounded and resumed, and differences across device models and OS versions. Each of these is its own scenario with its own test cases.
Test Cases in Manual Testing and Jira
In manual testing, the test case is the entire instruction set, so its steps and expected results need more detail than an automated case whose code already encodes them. In Jira, test cases usually live in a linked test management tool rather than as plain issues, with each case tied to the story it covers; this guide to Jira test management walks through the setup.
For ready-made examples in a regulated domain, this free set of banking application testing test cases covers login, fund transfers, and account management.
Best Practices for Writing Test Cases
- Write from the current requirement - Base each case on the requirement or acceptance criterion, and when the product has moved past the original spec, update the case to the behavior that actually ships.
- Derive cases with design techniques - Equivalence partitioning and boundary value analysis turn one input field into a small, complete set of cases; these test case design techniques show how.
- Write negative cases early - Empty fields, invalid formats, expired sessions, and repeated submissions are the cases most often skipped under deadline pressure, so write them alongside the positive ones.
- Prioritize by risk - Give each case a priority based on business impact and likelihood of failure, so a shortened test cycle still runs the cases that matter.
- Link every case to a requirement - A requirement with no linked case is a coverage gap, and a case with no requirement is a candidate for deletion.
- Reuse shared steps - Login, navigation, and setup steps repeat across many cases; keep them as one shared block so a UI change means one edit instead of dozens.
- Prune every release - Retire cases for removed features and merge duplicates, so the suite's pass rate describes the product as it is now.
- Mark automation candidates - Stable, high-priority cases that run every release are the first to automate; exploratory and one-off checks stay manual.
Common Mistakes When Writing Test Cases
- Vague test steps - "Click on the button and check the result" does not say which button, which action, or what result. Vague steps produce a different execution every time.
- Missing preconditions - A case without preconditions assumes the tester knows the setup. State the system state, test data, user permissions, and environment required before step one.
- Only the happy path - A suite that covers only what should work misses the empty fields, unexpected inputs, and interrupted flows that users hit every day. Write negative cases for every critical feature.
- Several scenarios in one case - A case that verifies login, profile update, and logout in one sequence is three cases. When it fails, you cannot tell which part broke.
- No expected result - Without an expected result, a case can be executed but never passed or failed. "Application should work correctly" does not count as one.
- Skipping peer review - A second reader catches missing scenarios, ambiguous steps, and wrong expected results that the author cannot see in their own work.
Note: Draft test cases from a user story, a requirement document, or a Jira ticket with the AI test case generation in the TestMu AI Test Management Platform, then review and edit them before they join your suite. Create a TestMu AI account.
How to Write Test Cases With AI
AI test case generators take a requirement, user story, or ticket and return draft cases with preconditions, steps, and expected results. That removes the blank-page step, which is why test case generation leads the use-case list in the Applause survey; a tester still owns the review.
A Real Generation Run for the Password Reset Case
To compare a generator against the hand-written AUTH_NEG_001, the same requirement went to the generate command of Kane CLI, capped at two scenarios:
kane-cli generate --agent --scenario-limit 2 --per-scenario-limit 4 "Password reset flow: a user enters an email address that is not registered and submits the Forgot password form. The app must show a deliberately ambiguous message, send no reset email, and never reveal whether the account exists (account enumeration). Also cover a registered email and an empty email field."The run finished with this final event, followed by the generated cases:
{"type":"generate_done","request_id":"43661","status":"completed","scenario_count":2,"case_count":5}- TS1, Password Reset Request for Registered, Unregistered, and Empty Email Addresses - Three functional cases: a registered email, an unregistered email (priority Highest, titled "Prevent account enumeration for an unregistered email address"), and an empty email field.
- NF01, Prevent Account Enumeration via Timing Attacks - Two security cases that record the response time for a registered email and check that an unregistered email's response time is indistinguishable from it.
In review, the generator had added a timing-attack scenario that AUTH_NEG_001 does not cover: if an unregistered email returns faster than a registered one, the response time leaks what the message hides.
It also folded "no email is sent" into the expected result of the Send Reset Link click, which the page alone cannot prove. A reviewer would split that into a separate inbox check, like step 6 of AUTH_NEG_001.
Human Review of AI-Drafted Test Cases
Generated cases follow patterns, so they tend to be strongest on the happy path and weakest on product rules the model has never seen. Use AI for the first draft and for coverage ideas, and keep a tester accountable for edge cases, security expectations, and business-critical flows.
Once a case is approved, KaneAI can turn its plain-English steps into an executable test, so the same wording drives both the manual and the automated run.
Free Test Case Templates
For a blank sheet with every field from the format table, start with this test case template. Each template below applies the same format to one platform or industry, with ready-made cases you can adapt.
Web and Frontend
Platforms and Engineering
Managing Test Cases in a Test Management Platform
A spreadsheet stops working once you need to know which requirement a failing case covers, or which cases ran on the last build. The TestMu AI Test Management Platform keeps cases, plans, runs, and defects in one workspace:
- AI test case generation - Turns a description, user story, requirement document, or Jira ticket into a structured case with steps, expected results, preconditions, and priority.
- Structured repository - Folders, tags, priority, custom fields, and version history on every case.
- Requirement traceability - Links each requirement to its test cases, execution history, and defects, so coverage gaps show up before a release.
- Two-way Jira and Azure DevOps sync - A failing case logs a defect with its steps and expected versus actual result, and status changes in the tracker sync back to the case.
- One results view - Manual runs and automated results roll into a single pass/fail view.
The manual test case creation docs show how each field in the format above maps to the platform.
Next Steps
Pick one feature you are testing this week and rewrite its weakest test case with an outcome-based title, explicit preconditions, one action per step, and one expected result per check. Then follow the Test Manager documentation to bring the rest of your suite into TestMu AI and generate drafts for the features that have none.
Tracking tests across tools and teams? TestMu AI's Test Manager keeps test cases, runs and results in one place.
Author
Himanshu Sheth is the Director of Marketing (Technical Content) at TestMu AI, with over 8 years of hands-on experience in Selenium, Cypress, and other test automation frameworks. He has authored more than 130 technical blogs for TestMu AI, covering software testing, automation strategy, and CI/CD. At TestMu AI, he leads the technical content efforts across blogs, YouTube, and social media, while closely collaborating with contributors to enhance content quality and product feedback loops. He has done his graduation with a B.E. in Computer Engineering from Mumbai University. Before TestMu AI, Himanshu led engineering teams in embedded software domains at companies like Samsung Research, Motorola, and NXP Semiconductors. He is a core member of DZone and has been a speaker at several unconferences focused on technical writing and software quality.
Reviewer
Abhishek Mishra is a Technical Product Manager at TestMu AI, where he owns Test Manager, the test management product. He has over 8 years of experience in product management and market analysis. His expertise spans across AI-native software testing, product strategy, and analytics. Previously, Abhishek served as the Product Lead at IndiaClan and co-founded Gartley618 Technologies, where he led innovative projects in quantitative trading and blockchain. He holds a B.Tech degree.
Writing Test Cases FAQs
Did you find this page helpful?
More Related Blogs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance
- Advanced access controls
- Advanced data retention rules
- Advanced Local Testing
- Premium Support options
- Early access to beta features
- Private Slack Channel
- Unlimited Manual Accessibility DevTools Tests


















