Steps, test info and attachments
Name the parts of a long test so the report reads like a story, and attach screenshots or notes to a result so a failure comes with its evidence.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: chapter headings and photographs in a lab notebook. Imagine a notebook with one long page of notes. To find the part about the mixing, you must read everything. Now add chapter headings and tape a photograph beside the odd result. A new reader finds the right place at once.
Daily List is a to-do list app. Tom, the tester, has written a long test that signs up, adds a task and shares a list. When it fails, the report is one block of lines. Mei, the test lead, cannot tell which part broke.
What it is: Playwright is a free tool, made by Microsoft, that drives real web browsers from test code. Its , called , also writes a report of each run. This topic is about two helpers that make that report easier to read. A step is a named group of actions inside one test, like a chapter heading. An attachment is a file or note added to a test result, like a photograph. Playwright keeps facts about each running test in an object called test info, and that object is how you add an attachment.
Why it matters: a long failure without headings leaves Mei guessing which part broke. Named steps and attachments put the place and the proof in the report, so she can fix the right stage without running the test again.
The picture has a limit. A heading does not make the test better. It only makes the report easier to read.
Kept simple: the notebook has one kind of heading and one kind of photograph. Playwright has more options than this lesson shows.
(SYNTHETIC / TRAINING ONLY: Daily List, its test site and every person named here are made up.)
PLAIN WORDS · 1 in this section
- playwright
- a free Microsoft tool that drives a browser for tests
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB Making a long test report easy to read, and keeping the evidence for a failure with the result.
- Name the step
- Run the test
- Attach the proof
- Read the report
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| The chapter headings | Report steps made with test step |
| The photograph taped beside the odd result | A test attachment |
| The notebook's own page for one experiment | The output folder owned by one test |
| The facts on the notebook cover | Test info |
WHERE THIS PICTURE STOPS
- A heading does not make the experiment better. A step does not make the test better.
- A photograph can show private things. An attachment can hold private data.
- A notebook is read by one person. A report is read by a whole team, so names must stay stable.
HOOK
Headings for the story, photographs for the proof.
REMEMBER IT THIS WAY
A contrast: two neighbours told apart by one test.
Headings tell where it broke, photographs show what it looked like. Add a step per chapter and an attachment for the odd result.
| In the trick | What it stands for |
|---|---|
| step | the heading |
| attachment | the photograph |
An attachment can hold private data, so check it before sharing the report.
TELL A FRIEND
A lab notebook with chapter headings and a photograph beside the odd result.
OFTEN MIXED UP WITH Reporters and artifacts: reports, screenshots, videos and traces. The reporters lesson covers files Playwright saves by itself. This lesson covers the steps and attachments you add on purpose.
Sources & standards — 4 sources
- Market practice
Playwright Test class reference (Playwright documentation) ↗ — Microsoft (Playwright) · test.step groups actions under a name in the report; test.info() returns the TestInfo of the running test (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Test info (Playwright documentation) ↗ — Microsoft (Playwright) · testInfo.attach takes a name and either a body or a path, not both; outputPath gives a file path inside the test's own output folder that is safe when tests run in parallel; workerIndex and parallelIndex identify the worker (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Test step info (Playwright documentation) ↗ — Microsoft (Playwright) · TestStepInfo.attach attaches a value or file to the current step instead of to the whole test; added in recent versions (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Playwright Test class reference (Playwright documentation) ↗ — Microsoft (Playwright) · Reviewed 6 November 2026: beforeEach, step, fail and locks type definitions. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: beforeEach, step, fail and locks type definitions. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
PRACTISE AND KEEP
Sources for this topic — 4 sources
- Market practice
Playwright Test class reference (Playwright documentation) ↗ — Microsoft (Playwright) · test.step groups actions under a name in the report; test.info() returns the TestInfo of the running test (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Test info (Playwright documentation) ↗ — Microsoft (Playwright) · testInfo.attach takes a name and either a body or a path, not both; outputPath gives a file path inside the test's own output folder that is safe when tests run in parallel; workerIndex and parallelIndex identify the worker (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Test step info (Playwright documentation) ↗ — Microsoft (Playwright) · TestStepInfo.attach attaches a value or file to the current step instead of to the whole test; added in recent versions (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number; read at the time of writing. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Playwright Test class reference (Playwright documentation) ↗ — Microsoft (Playwright) · Reviewed 6 November 2026: beforeEach, step, fail and locks type definitions. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: beforeEach, step, fail and locks type definitions. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.