Jenkins part 6: publish test reports and artifacts
Make a pipeline record its test results with the junit step, keep screenshots and logs as artifacts, and read the trend of passes and failures.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: a report card and a filing box. After each exam the teacher files a card, so the marks add up over the term. Any paper that proves a mark goes into a box with the date on it. If the teacher only files the card when the exam was easy, the bad days vanish.
The card is the junit step. The stack of cards is the trend. The box is the archived files.
Mei and Tom, a tester at Daily List, a to-do list app, want the failed test name and the screenshot, not only a red log.
What it is: This is a slice of a Jenkins pipeline, the (CI) file named Jenkinsfile. The reads test result XML (Extensible Markup Language) and records each test. JUnit here is the report format, not a rule that you must write Java. An archived artifact is a file kept with the run, and a test result trend graphs passes and failures. The console log is the neighbour, and it buries the same facts in text.
Why it matters: A red Daily List console does not name the test in a way Mei can trend. The junit step lists the failed test. The artifact holds the screenshot. The trend shows whether failures are falling. If those steps are skipped whenever pytest fails, the evidence disappears on the runs that need it most.
PLAIN WORDS · 5 in this section
- vanish
- go out of sight
- junit
- a file format for test results
- extensible
- able to be added to later
- buries
- hide something under a lot of other things
- pytest
- A free Python tool that finds and runs checks.
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 A report card file and a filing box.
- Card
- File
- Box
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| A report card after an exam | The junit report |
| Always filling it in, pass or fail | Post always |
| The file of cards over the term | The trend |
| The filing box of marked papers | The archived artifacts |
WHERE THIS PICTURE STOPS
- A report card is filled by a teacher, but junit reads a file the tests wrote.
- A term ends, but the trend keeps the recent runs only.
- A box can hold anything, but a secret must never go in.
HOOK
Card, file, box.
TELL A FRIEND
A card, a file and a box.
OFTEN MIXED UP WITH Jenkins part 4: your first Jenkinsfile pipeline. That topic writes stages and reads the stage view. This one records test results and files and reads the trend.
PRACTISE AND KEEP
Sources for this topic — 3 sources
- Market practice
Recording tests and artifacts (Jenkins documentation) ↗ — Jenkins · Jenkins docs say the junit step records test result files so Jenkins can show trends. It sits in a post always block so it runs when tests fail. The archiveArtifacts step keeps files that match a pattern. A run with failing tests is marked unstable
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
Pipeline syntax (Jenkins documentation) ↗ — Jenkins · Jenkins docs on pipeline syntax say the post section supports always, success, failure, unstable and changed. The always condition runs whatever the status of the run
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
junit: Archive JUnit-formatted test results ↗ — Jenkins · Result files and unstable status; does not repair an already failed shell step.
Publisher primary source opened and relevant sections read on 6 November 2026 for the Agile/DevOps domain analysis. Original explanations are used; no extensive source text is copied. Also read for the CI/Containers analysis; live documentation does not establish the version installed in a learner environment.
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.