Skip to content
Bugwise
Menu
Tutorials

How to Write Test Cases

Learn what a test case is, what goes into one, and how to write clear, useful test cases — with a full worked example for a mobile banking sign-in screen.

beginner Mobile & web
Short on time? Switch to the quick version.

Picture this: you’ve just joined a team building a banking app. Your lead says, “Can you write test cases for the new sign-in screen?” You nod confidently — and then quietly wonder what exactly that means.

By the end of this lesson, you’ll know. You’ll be able to take a requirement, turn it into a set of clear test cases, and write them so well that anyone on the team could pick them up and run them.

Part Not started

What is a test case?

A test caseTest caseA written set of steps, data and an expected result used to check one specific behavior.Open in glossary → is a written set of instructions for checking one specific thing in an app. It says what you need before you start, exactly what to do, and what should happen.

Why bother writing them down instead of just “trying the app”?

Test scenario vs test case

These two are easy to confuse.

One scenario usually turns into several test cases. (There’s a third artifact, the checklist, and Test Scenarios vs Test Cases vs Checklists explains when to use each.)

Test scenarioTest cases it might produce
Check that a user can sign inValid email and password · Email with uppercase letters · Password exactly 8 characters
Check that invalid sign-ins are handledWrong password · Unregistered email · Empty fields · Invalid email format
Check the account lock ruleLock on 5th failed attempt · No lock after 4 failed attempts

A group of related test cases is called a test suiteTest suiteA group of related test cases that are run together.Open in glossary →. For example, all the cases above could live in a “Sign in” suite.

Check this part

  1. Which of these is a test scenario rather than a test case?

  2. Why write test cases down instead of just trying the app?

A test case is precise, repeatable instructions for checking one thing; a scenario says what to test, cases say how.

Part Not started

What goes into a test case

Every test case needs, at minimum:

When you run the test, you also record the actual resultActual resultWhat really happened when you performed the test.Open in glossary → and a status (Pass, Fail, Blocked).

A compact template

FieldExample
IDTC-001
TitleSign in with valid email and password
PreconditionsApp installed; user has an active account
Steps1. Open the app 2. Enter email 3. Enter password 4. Tap Sign in
Test dataanna@test.com / Secret123!
Expected resultHome screen opens and shows “Hi, Anna”
PriorityHigh

Different companies use different tools — a spreadsheet, JiraJiraA popular tool for tracking bugs, user stories and tasks.Open in glossary → with a test plugin, or a dedicated test management tool — but almost all test cases contain the same fields.

FieldWhat it meansExample
IDA unique reference so people can talk about the caseTC-LOGIN-004
TitleA short summary of what is being checked. Start with the behavior, not “Test…”Password shorter than 8 characters is rejected
PreconditionsPreconditionSomething that must already be true before you can start a test.Open in glossary →Everything that must be true before step 1App installed; user is signed out; account exists
StepsNumbered, specific actions, one action per step1. Open the app 2. Tap the Email field…
Test dataTest dataThe input values, accounts and records you use while testing.Open in glossary →The exact values to useEmail: anna@test.com, Password: Abc1234 (7 chars)
Expected resultExpected resultWhat should happen when you perform a test step, according to the requirements.Open in glossary →What should happen, stated clearly enough that the result is obviously Pass or FailMessage “Password must be at least 8 characters” appears under the field
PriorityHow important the case is to run (not the same as a bug’s priority)High / Medium / Low
TypeWhich kind of testing the case belongs to. Most tools have a fixed list for this fieldFunctionalFunctional testingTesting what the software does, checking features against their requirements.Open in glossary →, RegressionRegression testingRe-running tests to check that new changes didn't break things that used to work.Open in glossary →, SmokeSmoke testingA quick check of the most important features to decide if a build is stable enough to test further.Open in glossary →, UsabilityUsability testingChecking how easy and pleasant the product is for real people to use.Open in glossary →, SecuritySecurity testingChecking that data and features are protected from unauthorized access and attacks.Open in glossary →, PerformancePerformance testingChecking how fast, stable and responsive the software is under different loads.Open in glossary →
Positive / negative / edge (often a label or tag)Whether the case checks the expected path, wrong input or a limit. Not the same thing as a test scenarioPositivePositive testingTesting with valid input to confirm the software works as expected.Open in glossary →, negativeNegative testingTesting with invalid or unexpected input to check the software handles it gracefully.Open in glossary →, edgeEdge caseAn unusual situation at the extreme of what the software should handle.Open in glossary →
Actual resultActual resultWhat really happened when you performed the test.Open in glossary →What really happened when you ran it (filled in during execution)Message appeared as expected
StatusThe outcome of the runPass / Fail / Blocked / Not run

Check this part

  1. Which field describes what must be true before you start the test?

  2. Which fields are filled in only when you run the test?

ID, title, preconditions, steps, test data, expected result and priority; actual result and status are filled in when you run it.

Part Not started

How to write test cases, step by step

Read the requirementRequirementA statement of what the software must do or how well it must do it.Open in glossary → → list what could happen (good inputs, bad inputs, limits) → write precise steps → write a clear expected result → review.

  1. Read the requirement carefully. Read the requirementRequirementA statement of what the software must do or how well it must do it.Open in glossary →, user story or acceptance criteriaAcceptance criteriaConditions a user story must meet to be considered done and accepted.Open in glossary → at least twice. Underline every rule, number and message. Write down anything unclear and ask about it before writing cases — this is verificationVerificationChecking that we built the product right, according to its specification.Open in glossary → at its cheapest.
  2. Identify the scenarios. List the big things a user can do or experience on this screen: sign in successfully, fail to sign in, get locked out, reveal the password, reset a forgotten password.
  3. Think positive, negative and edge. For each scenario, ask three questions. What happens with valid input (positive testingPositive testingTesting with valid input to confirm the software works as expected.Open in glossary →)? What happens with invalid input (negative testingNegative testingTesting with invalid or unexpected input to check the software handles it gracefully.Open in glossary →)? What happens at the limits — exactly 8 characters, exactly 5 attempts (edge casesEdge caseAn unusual situation at the extreme of what the software should handle.Open in glossary → and boundary value analysisBoundary value analysisTesting values at and just around the edges of valid ranges, where bugs love to hide.Open in glossary →, covered in depth in Boundary Value Analysis)?
  4. Write clear, specific steps. One action per step. Name the exact button or field. Assume the reader has never seen the app.
  5. Define the expected result. Say exactly what should be on the screen: which screen opens, which message appears (word for word if the requirement gives it), what is enabled or disabled. If you can’t write an expected result, the requirement probably needs clarifying.
  6. Review. Re-read each case as if you were someone else. Better still, ask a teammate to review. Check that every rule in the requirement is covered by at least one case (test coverageTest coverageHow much of the product, requirements or risks your tests actually check.Open in glossary →).

Check this part

  1. While reading the requirement you find a rule that isn't clear. What should you do?

  2. Which three kinds of cases should you think of for every scenario?

Read the requirement, list scenarios, cover positive, negative and edge cases, write precise steps and a clear expected result, review.

Part Not started

Worked example: a banking app sign-in screen

Here are three cases for a mobile banking app’s Sign in screen (password must be at least 8 characters; the account locks after 5 failed attempts):

TC-001Sign in with valid email and password

Preconditions

  • App is installed
  • An active account exists for anna@test.com

Steps

  1. Open the app
  2. Enter the email in the Email field
  3. Enter the password in the Password field
  4. Tap 'Sign in'

Test data

email: anna@test.com / password: Secret123!

Expected result

The Home screen opens and shows the account overview with the greeting 'Hi, Anna'.

TC-002Error message is shown for a wrong password

Preconditions

  • An active account exists for anna@test.com

Steps

  1. Open the app
  2. Enter the email
  3. Enter a wrong password
  4. Tap 'Sign in'

Test data

email: anna@test.com / password: WrongPass1

Expected result

The user stays on the Sign in screen and sees 'Incorrect email or password'.

TC-003Account locks after the 5th failed sign-in attempt

Preconditions

  • An active account exists for anna@test.com with 0 failed attempts

Steps

  1. Open the app
  2. Enter the email and a wrong password, tap 'Sign in'
  3. Repeat step 2 four more times (5 failed attempts in total)

Test data

email: anna@test.com / password: WrongPass1

Expected result

After the 5th attempt the app shows 'Your account is locked. Reset your password to continue.' Signing in with the correct password is still refused.

Tip: click a test case to expand it.

Let’s put it all together. Here is the requirement for the sign-in screen of a mobile banking app called PocketBank.

The test cases

TC-SIGNIN-001Sign in with valid email and password

Preconditions

  • PocketBank is installed and the user is signed out
  • An active account exists for anna@test.com

Steps

  1. Open PocketBank
  2. Tap the Email field and enter the email
  3. Tap the Password field and enter the password
  4. Tap 'Sign in'

Test data

email: anna@test.com / password: Secret123!

Expected result

The Home screen opens and shows the account overview with the greeting 'Hi, Anna'.

TC-SIGNIN-002Wrong password shows an error and keeps the user on Sign in

Preconditions

  • User is signed out
  • An active account exists for anna@test.com with 0 failed attempts

Steps

  1. Open PocketBank
  2. Enter the email
  3. Enter the wrong password
  4. Tap 'Sign in'

Test data

email: anna@test.com / password: WrongPass1

Expected result

The message 'Incorrect email or password' appears. The user stays on the Sign in screen.

TC-SIGNIN-003Unregistered email shows the same generic error

Preconditions

  • User is signed out
  • No account exists for nobody@test.com

Steps

  1. Open PocketBank
  2. Enter the unregistered email
  3. Enter any valid-length password
  4. Tap 'Sign in'

Test data

email: nobody@test.com / password: Secret123!

Expected result

The message 'Incorrect email or password' appears. The app does not reveal whether the email is registered.

TC-SIGNIN-004Password with 7 characters is rejected before sign-in

Preconditions

  • User is signed out

Steps

  1. Open PocketBank
  2. Enter the email
  3. Enter a 7-character password
  4. Tap 'Sign in'

Test data

email: anna@test.com / password: Abc1234 (7 characters)

Expected result

The message 'Password must be at least 8 characters' appears under the Password field. No sign-in attempt is made and the failed-attempt counter does not increase.

TC-SIGNIN-005Password with exactly 8 characters is accepted

Preconditions

  • User is signed out
  • An active account exists for ben@test.com whose password is exactly 8 characters

Steps

  1. Open PocketBank
  2. Enter the email
  3. Enter the 8-character password
  4. Tap 'Sign in'

Test data

email: ben@test.com / password: Abcd1234 (8 characters)

Expected result

No length message appears. The Home screen opens.

TC-SIGNIN-006Account locks on the 5th consecutive failed attempt

Preconditions

  • User is signed out
  • An active account exists for anna@test.com with 0 failed attempts

Steps

  1. Open PocketBank
  2. Enter the email and the wrong password, then tap 'Sign in'
  3. Repeat step 2 until 5 failed attempts have been made
  4. Enter the correct password and tap 'Sign in'

Test data

email: anna@test.com / wrong: WrongPass1 / correct: Secret123!

Expected result

After the 5th failed attempt the message 'Your account is locked. Reset your password to continue.' appears. In step 4 the user still cannot sign in, even with the correct password.

TC-SIGNIN-007Account does not lock after 4 failed attempts followed by a correct one

Preconditions

  • User is signed out
  • An active account exists for anna@test.com with 0 failed attempts

Steps

  1. Open PocketBank
  2. Enter the email and the wrong password, then tap 'Sign in'
  3. Repeat step 2 until 4 failed attempts have been made
  4. Enter the correct password and tap 'Sign in'

Test data

email: anna@test.com / wrong: WrongPass1 / correct: Secret123!

Expected result

The Home screen opens. The account is not locked.

TC-SIGNIN-008Show password toggle reveals and hides the password

Preconditions

  • User is on the Sign in screen

Steps

  1. Enter the password in the Password field
  2. Tap the eye icon
  3. Tap the eye icon again

Test data

password: Secret123!

Expected result

Before step 2 the password is masked (dots). After step 2 it shows as plain text 'Secret123!'. After step 3 it is masked again. The typed text is unchanged throughout.

TC-SIGNIN-009Forgot password link opens the Reset password screen

Preconditions

  • User is on the Sign in screen

Steps

  1. Tap 'Forgot password?'

Expected result

The Reset password screen opens. Tapping the back button returns to the Sign in screen.

TC-SIGNIN-010Sign in button is disabled while a field is empty

Preconditions

  • User is on the Sign in screen with both fields empty

Steps

  1. Look at the 'Sign in' button
  2. Enter the email only
  3. Clear the email and enter the password only

Test data

email: anna@test.com / password: Secret123!

Expected result

The 'Sign in' button is disabled (greyed out and not tappable) in all three steps.

Tip: click a test case to expand it.

Always test a limit from both sides: a password of 7 characters (rejected) and exactly 8 (accepted), 4 failed attempts (no lock) and the 5th (locked). That’s boundary value analysisBoundary value analysisTesting values at and just around the edges of valid ranges, where bugs love to hide.Open in glossary → in action, covered in depth in Boundary Value Analysis.

Check this part

  1. The requirement says passwords must be at least 8 characters. Which pair of inputs best tests the boundary?

  2. The account locks after 5 failed attempts. Which case is an edge case?

Test cases for a banking app's sign-in screen, with limits tested from both sides: 7 vs 8 characters, 4 vs 5 attempts.

Part ProNot started

Good vs bad test cases

Most weak test cases fail in one of three ways:

  • Vague steps. “Log in with a short password” could mean 1 character or 7, so two testers run it two different ways.
  • Several checks in one case. If a case checks the sign-in, the eye icon and the lock rule at once and fails, which part failed?
  • A fuzzy or missing expected result. “Error is shown” would pass even if the app said “Something went wrong”, which would actually be a bug.

Vague steps vs specific steps

Specific

  1. Open PocketBank.
  2. Enter anna@test.com in the Email field.
  3. Enter Abc1234 (7 characters) in the Password field.
  4. Tap Sign in.

Vague

  1. Open the app.
  2. Log in with a short password.
  3. Check it.

“A short password” could mean 1 character or 7. “Check it” tells the reader nothing. Two testers would run this case two different ways.

Multiple checks in one case

One case, one purpose

TC-SIGNIN-008: Show password toggle reveals and hides the password.

TC-SIGNIN-009: Forgot password link opens the Reset password screen.

Everything at once

TC-01: Check the sign-in screen works, the eye icon works, forgot password works, and the account locks.

If the giant case fails, which part failed? You can’t mark it “half passed”, and the bug report becomes a guessing game.

Missing or fuzzy expected result

Clear expected result

The message “Password must be at least 8 characters” appears under the Password field. No sign-in attempt is made.

Fuzzy or missing

Error is shown. (Or nothing at all.)

“Error is shown” would pass even if the app displayed “Something went wrong” — which would actually be a bug. A good expected result leaves no room for argument.

Common mistakes

Check this part

  1. What is wrong with the expected result 'It works'?

  2. A case is titled 'Sign-in works and the eye icon works and the account locks'. What should you do?

Weak cases have vague steps, several checks in one case, or a fuzzy expected result.

The rest of this lesson is in Bugwise Pro

The last parts of every lesson are part of Bugwise Pro. Sign in to unlock them if you have it.

Part ProNot started

Tips for mobile-specific test cases

Mobile apps live in a messy world. A sign-in screen that works perfectly on a desk can break on a bus. Add cases (or at least checklist items) for these situations:

  • Rotation: type the email, rotate to landscape. Is the text kept and Sign in still visible?
  • Keyboard: does the email keyboard show @, and does the keyboard hide the Sign in button?
  • Interruptions: a call or notification mid-typing, the app sent to the background, the screen locked.
  • Network: airplane mode, switching Wi-Fi to mobile data, a slow connection (can you tap Sign in twice?).

Rotation

  • Enter the email and password, then rotate the phone to landscape. Is the typed text still there?
  • Is the Sign in button still visible and tappable in landscape?

Keyboard

  • Does the email field open the email keyboard (with @ and .)?
  • Does the keyboard cover the Sign in button on a small screen? Can the user scroll to it?
  • Does the Next key move from Email to Password, and does Done or Go submit?
  • Does the app accept the password from a password manager or autofill?

Interruptions

  • Receive a phone call or notification mid-typing. When you return, is the screen the same?
  • Send the app to the background for a few minutes and reopen it. Is the user still on Sign in, and is the password safely cleared if the team expects that?
  • Lock and unlock the screen during sign-in.

Network

Check this part

  1. You're writing mobile-specific cases for a sign-in screen. Which is the best example?

  2. On a slow connection, a user taps Sign in twice. What are you checking for?

Add cases for rotation, the keyboard, interruptions and the network.

The rest of this lesson is in Bugwise Pro

The last parts of every lesson are part of Bugwise Pro. Sign in to unlock them if you have it.

Before you submit a test case

Use this quick checklist every time you finish writing a case. It works just as well for cases an AI assistant drafted for you; see AI in Testing for what to look for in those.

Before you submit a test case

0 of 10 checked

Key takeaways

  • A test case is a precise, repeatable set of instructions for checking one thing.
  • The core fields are ID, title, preconditions, steps, test data, expected result and priority; actual result and status are filled in when you run it.
  • A test scenario says what to test; test cases say how.
  • Cover positive, negative and edge cases — and test limits from both sides.
  • Specific steps and a crystal-clear expected result are what separate useful cases from useless ones.
  • For mobile apps, think about rotation, the keyboard, interruptions and network changes.

Where next? When a case fails, you’ll need How to Write a Bug Report. To see how cases are organized into runs, executed and tracked, go to Test Runs and Test Management Tools.

Finished this page?Nice work, this page is complete!

Mark it as done to track your progress. It's saved in this browser, no account needed.

Its cards are now in your Bites review ⚡
Esc

Type to search the whole site.