How to Write a Good Test Case (with Example)
A test case is a short set of steps with an expected result. Anyone should be able to follow it and get the same answer.
The parts of a test case
- ID and title: a short name, for example "Login with a wrong password".
- Preconditions: what must be true first (the user already exists).
- Steps: numbered actions.
- Test data: the exact values to use.
- Expected result: what should happen.
Example: login with a wrong password
- Open the login page.
- Type the username
admin. - Type the password
wrong123. - Click Login.
Expected result: the user stays on the login page and sees the message "Invalid credentials".
Tips for better test cases
- Test one thing per test case.
- Write the expected result clearly. "Works fine" is not a result.
- Cover bad input too: empty fields, very long text, special characters.
- Keep the steps short.
From test case to automation
A clear manual test case turns into an automated test almost line by line: each step becomes an action, and the expected result becomes an assertion.
Want to practise this step by step?
Our free Playwright course teaches it in simple English, one day at a time.
Open the free course
Our free Playwright course teaches it in simple English, one day at a time.
Open the free course