How to Write Test Cases: Templates, Examples, and AI Prompts

How to Write Test Cases: Templates, Examples, and AI Prompts

Learn how to write test cases step by step, with a ready-to-use template, real examples for manual testing, good-practice tips, and how to use AI safely.

InsightAudrey·

Knowing how to write test cases comes down to a simple pattern: pick one behavior from a requirement, set the preconditions, list numbered steps with exact test data, and state an expected result that someone can mark as pass or fail. Clear test cases let anyone on the team repeat a test the same way, catch regressions before a release, and show which requirements are actually covered. This guide walks through the standard test case format, a 7-step method, a complete example set for one sign-up form, tips for manual testing, a good-practice checklist, and how to use AI to draft test cases faster without letting mistakes slip through.

H2: What is a test case?

A test case is a defined check of one behavior in a piece of software. The ISTQB glossary, which follows the ISO/IEC/IEEE 29119 testing standard, defines it as "a set of preconditions, inputs, actions (where applicable), expected results and postconditions, developed based on test conditions."

In plain English, one test case checks one thing, such as "a user can sign up with a valid email and password." It's easy to mix up with two related terms:

TermWhat it isExample
Test planThe overall approach: scope, schedule, environments, and who tests whatTest plan for release 2.4
Test scenarioA high-level situation to check"Check the sign-up flow"
Test caseExact steps, data, and an expected result for one behavior"Sign up with an email that is already registered"

Test plan vs test scenario vs test case hierarchy for a sign-up flow

Test cases come in several types. Functional cases check that a feature does what the requirement says. Negative cases check how the software handles invalid input. Boundary cases test the edges of allowed values. UI and usability, integration, regression, smoke, and user acceptance (UAT) cases cover the rest. The same writing method works for all of them, whether you're testing a mobile app or a web app.

H2: Standard test case format (copy-ready template)

Most teams use the same core fields, whether they work in a spreadsheet or a test management tool. For formal documentation, ISO/IEC/IEEE 29119-3 replaced IEEE 829 in 2013 as the standard for test documents, including the test case specification.

FieldWhat to writeExample
Test case IDA unique, readable IDTC_SIGNUP_004
TitleOne behavior, starting with a verbReject a password shorter than 8 characters
Requirement/user storyThe requirement or acceptance criterion it coversUS-12: Password must be 8-64 characters
PriorityHigh, Medium, or Low based on riskHigh
PreconditionsWhat must be true before the test startsUser is logged out; sign-up page is open
Test stepsNumbered, one action per step1. Enter a valid email 2. Enter "Pass12!" 3. Click Sign up
Test dataExact input valuesEmail: test.user+04@example.com; Password: Pass12! (7 characters)
Expected resultOne observable, checkable outcomeForm isn't submitted; "Password must be at least 8 characters" appears under the field
Actual resultFilled in during the test run-
StatusPass, Fail, or Blocked-
EnvironmentOS, browser or device, buildChrome 141, Windows 11, build 2.4.0
Postconditions/notesCleanup, screenshots, bug IDNo account created

H2: How to write software test cases: 7 steps

The steps below take you from a user story to a test run you can report on. The running example is a sign-up form for a to-do app.

Seven steps to write software test cases from requirement to report

H3: Step 1: Read the requirement and acceptance criteria

Start from the user story or spec, not from the screen. Example story: "As a new user, I want to sign up with my email so I can save my tasks."

  • List the hidden rules: valid email format, unique email, password length of 8-64 characters, and a confirmation email after sign-up.
  • Clear up gaps first: ask the product owner about anything unclear before writing, such as whether a "+" is allowed in email addresses.

H3: Step 2: List the test scenarios

Break the feature into situations: successful sign-up, duplicate email, invalid email, password rules, empty fields, and the confirmation email. Map each scenario to its requirement in a simple traceability column, so coverage gaps are easy to spot.

H3: Step 3: Choose test design techniques

  • Equivalence partitioning: group inputs that should behave the same, such as valid emails versus invalid emails, and test one value from each group.
  • Boundary value analysis: test at and around the limits. For an 8-64 character password, that means 7, 8, 64, and 65 characters.
  • Decision tables: use these for rules that combine conditions, such as a discount code plus member status.
  • State transition: use this for flows with states, such as an account moving from unverified to verified.
  • Error guessing: add common real-world mistakes, like a space before an email address or a pasted password.

Boundary value analysis for a password field that accepts 8 to 64 characters

H3: Step 4: Write each test case

  • Title: start with a verb and name one behavior.
  • Preconditions: state the setup, so the steps don't have to.
  • Steps: one action per step; keep most cases under 10-15 steps.
  • Test data: use exact values instead of "enter a valid email."
  • Expected result: describe something anyone can verify, such as the exact message, page, or database change.

a poor test case compared with a good one

H3: Step 5: Add priority and traceability

Mark each case High, Medium, or Low by business risk; Sign-up and payment flows are usually high. Tag cases such as smoke, regression, or release, so you can run the right subset later instead of the whole suite.

H3: Step 6: Have someone else review them

Ask a teammate to run one or two cases without asking you any questions. If they get stuck, the case needs more detail. The reviewer should also look for missing negative and boundary cases and for duplicates.

H3: Step 7: Run, record, and report

Record the actual result, status, and environment, plus a screenshot of every failure. Then log a bug with the test case ID, the steps to reproduce, and the expected versus actual result. Developers picking up the failure can follow a guide on how to debug software code to trace the cause.

H2: How to write test cases examples: a full set for one sign-up form

Every case below uses the same requirement: the email must be valid and unique, the password must be 8-64 characters, and a confirmation email is sent after sign-up.

IDTitleTypeTest dataExpected result
TC_SIGNUP_001Sign up with a valid email and passwordPositivenew.user01@example.com/Tasks2026!Account created; "Check your inbox" page shown; confirmation email received
TC_SIGNUP_002Reject an email that is already registeredNegativeexisting@example.com/Tasks2026!Error "An account with this email already exists"; no new account
TC_SIGNUP_003Reject an invalid email formatNegativenew.user03@example/Tasks2026!Inline error "Enter a valid email address"; form not submitted
TC_SIGNUP_004Reject a 7-character passwordBoundaryPass12! (7 characters)Error "Password must be at least 8 characters"
TC_SIGNUP_005Accept an 8-character passwordBoundaryPass123! (8 characters)Account created
TC_SIGNUP_006Accept a 64-character passwordBoundary64-character stringAccount created
TC_SIGNUP_007Reject a 65-character passwordBoundary65-character stringError "Password must be 64 characters or fewer"
TC_SIGNUP_008Block submission with empty fieldsNegativeEmail and password left blankBoth fields show required-field errors; form isn't sent
TC_SIGNUP_009Show errors next to the right field on mobileUIiPhone 15 Safari, invalid emailError text appears under the email field, readable without zooming
TC_SIGNUP_010Verify account from the confirmation linkPositiveLink from the TC_SIGNUP_001 emailAccount status changes to verified; user lands on the dashboard

Here is TC_SIGNUP_002 written out in full, using every field from the template:

FieldValue
Test case IDTC_SIGNUP_002
TitleReject an email that is already registered
RequirementUS-11: Each account must use a unique email address
PriorityHigh
PreconditionsAn account already exists for existing@example.com; the user is logged out; The sign-up page is open
Test steps1. Enter "existing@example.com" in the Email field. 2. Enter "Tasks2026!" in the Password field. 3. Click Sign up
Test dataexisting@example.com / Tasks2026!
Expected resultThe error "An account with this email already exists" appears; no second account is created
Actual result(filled in during the run)
Status(Pass, Fail, or Blocked)
EnvironmentChrome 141, Windows 11, build 2.4.0
Postconditions/notesCheck the users table still has one record for this email

Teams that use behavior-driven development (BDD) can write the same case in Given/When/Then form: Given an account exists for existing@example.com, when I sign up with that email, then I see "An account with this email already exists."

H2: How to write test cases in manual testing

Manual test cases are read and run by people, so they need a little more context than automated ones.

  • Write for a newcomer: assume the tester has never seen the feature, with no assumed knowledge of hidden settings or test accounts.
  • Include the environment: browser, device, and build, because manual results often depend on them.
  • Ask for evidence: a screenshot or screen recording for every failed case.
  • Keep a regression suite: a set of high-priority cases to rerun before each release.
  • Leave room for exploration: add a short exploratory charter alongside scripted cases, such as "explore sign-up with unusual emails for 20 minutes."
  • Store them where they'll be used: a spreadsheet works for small projects; TestRail, Qase, or Jira with Xray or Zephyr makes sense once the suite grows.

H2: How to write good test cases: checklist

Run every new test case through these checks before it goes into the suite:

  • One behavior per test case: if a case checks two things, split it.
  • Traceable: it links to a requirement or acceptance criterion.
  • Exact and checkable: it has exact test data and a single expected result.
  • Full coverage: the set includes positive, negative, and boundary cases, not just the happy path.
  • Independent: it doesn't rely on another test running first, and it cleans up after itself.
  • Right level of detail: detailed enough to repeat, but not so detailed it breaks on every UI change. Practitioners on the Ministry of Testing forum suggest leaving out steps you don't care about; if a case keeps growing, it's probably testing two things.
  • Reviewed and current: a second person has checked it, and it's updated when the requirement changes.

Good test case checklist with eight checks

The most common mistakes are vague expected results ("works correctly"), several checks crammed into one case, missing preconditions, and copying the same login example for every feature.

H2: How to write test cases with AI

AI tools are good at drafting scenarios, suggesting negative and edge cases you might miss, generating test data, and turning a manual case into an automation script. They also get things wrong: they can misread business rules, invent behavior that isn't in the requirement, and produce duplicates. Every AI-drafted case needs a human review.

A safe workflow looks like this:

  1. Paste the requirement and acceptance criteria, never production data, passwords, or API keys.
  2. Ask for test cases in your exact template.
  3. Ask a second time for missing negative, boundary, and accessibility cases.
  4. Review the output, correct expected results against the requirement, and remove duplicates.
  5. Import the final cases into your test management tool.

Example prompt: "You are a QA engineer. Using the requirement below, write test cases in a table with the columns ID, Title, Type, Preconditions, Steps, Test data, Expected result. Include positive, negative, and boundary cases. Only use behavior stated in the requirement. Requirement: [paste]."

Example AI prompt for drafting test cases and a review checklist for the output

Before you use any AI output, check that:

  • Expected results come from the requirement, not from what the current app happens to do.
  • Nothing is invented: no features or error messages that the spec doesn't mention.
  • Boundaries are right: values match the real limits.
  • There are no duplicates: each case tests one behavior.
ToolGenerates test cases fromNotes
ChatGPT/ClaudeA pasted requirement or user storyNo project context; copy results into your tool
GitHub CopilotCode and requirements in the editorBest for unit tests; check that expected values come from the spec
TestRail AIRequirements and user storiesBuilt into TestRail Cloud
Qase AIRequirementsIncluded as AI credits on paid plans
BrowserStack Test ManagementPrompts, files, Jira, Figma, ConfluenceAI test case generation inside BrowserStack Test Management
Katalon AI AssistantRequirements and promptsManual or automated tests

Note: Figures and data are current as of October 2026. Features and plans change often, so check each vendor's site before you choose a tool.

BrowserStack Test Management page showing AI test case creation

H2: Test the app you build with Enter Pro

Founders and small teams who build an MVP with the AI MVP builder in Enter Pro still need test cases before launch. Enter Pro's Plan Mode lays out the pages, user roles, and data structure before any code is generated, which gives you ready-made user stories to write test cases from. Once the app is built, you can run each case in the live preview, describe failures in chat, and roll back with version history if a fix breaks something else.

Enter Pro

Build and Test Your App with Enter Pro →

H3: How to write and run test cases for an Enter Pro app

Step 1: Describe the app and review the plan

Describe the app, for example, a to-do app with sign-up, due dates, and a filter by due date. Copy the user stories and rules from the plan into your test case template.

Describing a to-do app with sign-up and due dates in the Enter Pro prompt box

Step 2: Write test cases from the plan, then generate the app

Write positive, negative, and boundary cases for each story in the plan, such as sign-up, log-in, and adding a task, then generate the app.

Enter Pro Plan Mode listing pages and features for a task app before building

Step 3: Run the cases in the preview and fix what fails

Run each case in the live preview at desktop, tablet, and phone widths and record the results. Describe each failure in chat, or fix text and layout in the visual editor, and use version history to roll back if a fix breaks something.

Publlish the app and test

Build and Test Your App with Enter Pro →

H2: Conclusion

Learning how to write test cases comes down to three habits: one behavior per case, exact test data, and an expected result anyone can check. Start from the requirement, list your scenarios, add boundary and negative cases, and get a second person to review before the suite grows. AI can draft cases in seconds, but every one still needs a human check against the requirement. You can build your own MVP with Enter Pro, use the plan it creates as your list of user stories, and test every flow in the preview before you publish. Try it today!

H2: FAQs about how to write test cases

H3: Where should a beginner start when writing test cases?

Start with one user story and its acceptance criteria. Write one positive case for the main flow, then add negative and boundary cases using the standard template fields: ID, title, preconditions, steps, test data, and expected result.

H3: What are the 5 steps to write a test case?

A common short version is: read the requirement, identify the scenario, write the steps with exact test data, define the expected result, and review the case with someone else. The 7-step method above adds design techniques, priority, and reporting.

H3: What is the standard format of a test case?

Most teams use an ID, title, linked requirement, priority, preconditions, numbered steps, test data, expected result, actual result, status, and environment. ISO/IEC/IEEE 29119-3 is the international standard for test documentation, including test case specifications.

H3: What is the difference between a test case and a test scenario?

A test scenario is a high-level situation to check, such as "check the sign-up flow." A test case is one exact check within it, with defined steps, data, and an expected result, such as "reject an email that is already registered."

H3: Who writes test cases?

QA testers usually write and maintain them, but developers often write unit-level cases, and business analysts or product owners help define acceptance criteria. In small teams, whoever builds the feature often writes the first set. With AI-powered development platforms like Enter Pro, teams can also streamline feature development and make it easier to refine and validate applications throughout the development process.

H3: How detailed should a test case be?

Detailed enough that someone new can run it the same way and reach the same result, but no more. Leave out steps that don't affect the outcome, and split a case if it starts checking more than one behavior.

H3: Can AI or ChatGPT write test cases?

Yes, AI tools can draft test cases quickly from a requirement or user story and suggest edge cases you might miss. They can also misread rules or invent behavior, so a person should review every case against the requirement before it's used. AI-powered development platforms like Enter Pro can further simplify the development workflow by helping teams build and refine applications, making it easier to turn requirements into functional features that can be tested and improved.

H3: Are test cases still needed in Agile teams?

Yes, though they're often lighter. Many Agile teams write acceptance criteria as Given/When/Then scenarios, automate the repetitive checks, and keep a small set of manual cases for exploratory and regression testing.

You might also like

Curated automatically from similar topics to keep you in the same flow.