Say what the user should be able to do
A screen can look finished while the task behind it is incomplete. Start with the promise: who can do what, with which information, and what should be true afterward? Keep the check close to that promise.
Playwright's testing guidance recommends checking behavior visible to the user rather than internal details such as CSS class names. For a work-order form, the useful result is a correct saved draft that the coordinator can open, not just a function being called.
Give each check four parts
State the starting condition, the action, the expected result, and how you will check it. Write the expected result before running the test. Otherwise, it is easy to accept whatever the app happens to do.
Be clear about what the check covers. A page load proves the page can load in that setting. It does not prove a form saves, an email arrives, or a user has the right access. Split those claims into checks with their own evidence.
- Start: a known quote exists, with known fields and a known user role.
- Action: the coordinator chooses Create draft once.
- Expected result: one draft refers to that quote, with the correct address and status.
- Evidence: open the saved draft and compare its fields and record count with the expected result.
Use the kind of check that answers the question
A small logic test can check a calculation or matching rule. A connected test can check that parts exchange the right data. A browser test can follow the task from the user's view. Each answers a different question.
Start with the most important outcomes and likely failures. Do not count tests as proof by themselves. Ten tests of a page heading leave the save operation untested. Record the system version and test setting so someone can understand what actually passed.
Worked example
A testable promise for Create draft
The fictional app should let a coordinator create one draft from approved quote Q-1042. The quote has the invented job address 14 Cedar Lane.
- Starting state
- In a test environment, Q-1042 is approved, has the expected address, and has no draft work order. The test user has permission to create a draft.
- Action
- Open Q-1042 and choose Create draft once. Wait for the app to report the result.
- Expected result
- Exactly one new draft links to Q-1042. Its address is 14 Cedar Lane and its status is Draft. It is not yet scheduled.
- Evidence
- Open the draft through a fresh list view and compare the quote link, address, and status. Check the saved record count through an approved test view or API as well. Record the observed result and the app version.
A success message is part of the experience. The saved record is part of the promised result. Both need checking.
Fictional teaching example. No customer data or measured business results.
Your exercise
Write three checks before you test
Choose one task in your own test app, or write a plan for the fictional work-order app.
- Write the promise in one sentence: the person, action, and finished result.
- Write a normal-case check with a starting state, action, expected result, and evidence source.
- Write a missing-detail check and a repeated-action check in the same format.
- For each check, say whether a logic test, a connected test, or a browser journey would give useful evidence. Mark checks you have only planned as not run.
You have a useful first draft when...
Another person can run your checks and tell the difference between a pass, a failure, and a test that has not been run.
Check your understanding
Try the practice quiz.
Choose one answer for each question, then check the feedback. Answers stay in this page's memory. They are not submitted or saved.
Sources and further reading
The examples and exercises are original. These primary sources support the technical methods used in this lesson.
- Playwright: testing best practices
Primary documentation for tests based on user-visible behavior and independent test data.