In Allure 2, the previous report's `history/` directory is what gives the next report a trend. In which direction does that copy go, and why must it run before `allure generate` rather than after?
answer
- output of one run, input to the next
- results directory, never the report directory
- one pass reads, computes and writes
- a recursive copy, nothing renamed
basics
~20 sOut of the finished report and into the next run's results directory, before the generator runs. The trend is computed in that single pass, so anything placed later, or placed in the report directory, is never read.
solid answer
~40 sThe copy runs **out of** the finished report and **into** the next run's results directory: `allure-report/history` becomes `allure-results/history`. That direction matters because the generator reads results and writes a report -- it never treats its own output directory as a source, so a `history/` folder left in the report is ignored and liable to be rebuilt away. The timing matters for the same reason: generation is one pass that reads the results, computes each series from the carried history plus this run, and serialises the report. A folder dropped in afterwards is read by nothing, and the report just written still shows a single point. Nothing is renamed on the way -- the file names written under `history/` are the names looked for under `history/`.
code
bash · 2 linescp -R ./allure-report/history ./allure-results/history
allure generate ./allure-results -o ./allure-reportgo deeper
Know the direction: the folder comes out of the finished report and goes into the next run's results directory. Say that it is a plain copy and that it happens before the generator runs.
Explain why direction and timing follow from one fact -- generation is a single pass that reads results and writes a report. Then name the two mistakes that produce an identical, silent single-point trend.
Be ready to debug a pipeline where the copy demonstrably runs and nothing changes. Describe how you would confirm from the artefacts that the folder landed in the directory the generator was actually pointed at.
Take a position on whether this ordering convention should be reimplemented by hand in every team's pipeline, or owned by a shared step that fails loudly when the carry does not land.
## Two directories, two roles `allure generate` has exactly one input shape and one output shape. It reads one or more **results directories** -- the folders the test run filled with `*-result.json`, `*-container.json` and attachment files -- and it writes a **report directory**, by default `allure-report`, holding a self-contained static site. Nothing else is consulted. In particular, **the generator never reads its own output directory as a source.** That single fact settles both halves of the carry step. ## Direction: out of the report, into the results A generated report contains a `history/` directory of its own, written by the history plugins during generation. It holds the series as data: - `history.json` -- the run-by-run block behind an individual test case's history - `history-trend.json` -- the run-over-run trend series - `duration-trend.json` and `categories-trend.json` -- the other series, written into the same folder That folder is simultaneously **this run's output** and **the next run's input**. To be read, it has to move to the input side: ```bash cp -R ./allure-report/history ./allure-results/history allure generate ./allure-results -o ./allure-report ``` Nothing is renamed, merged or converted on the way. The generator resolves `<results>/history/<name>.json` using exactly the file names it wrote under `history/` in the report, so a recursive directory copy is the entire operation. Leaving the folder in the report directory feels reasonable -- it is already sitting there -- and it accomplishes nothing. The generator will not look at it, and the next generation into that directory rebuilds the contents regardless. ## Timing: before the pass, not after Generation is a single pass: read the results, compute, serialise the report. Each trend series is computed *during* that pass, from the carried history plus this run's results. So a `history/` folder that arrives after the generator has exited is not merely late -- it is not read at all, and the report already on disk will not change. | when the copy runs | what the generator sees | what the report shows | |---|---|---| | before generation, into the results directory | the carried series plus this run | the full trend | | after generation, into the results directory | nothing | a single point | | any time, into the report directory | nothing | a single point | The last two rows are the trap. All three cases exit successfully and produce a valid report; only the chart differs. ## Why neither mistake announces itself The generator's history read is a plain file-existence check with no failure branch. When `<results>/history/history.json` is absent, the plugin contributes nothing and generation continues to a clean exit. That is deliberate -- the genuine first run of a suite legitimately has no history -- but it means a copy in the wrong direction, a copy at the wrong time, and a real first run all emit identical signals: a green build and a correct-looking report. The failure is therefore diagnosed from artefacts, not from exit codes: 1. Confirm `history/history.json` exists in the **results** directory immediately before generation runs. 2. Confirm the generator was pointed at that same results directory and not a sibling of it. 3. Open the produced report's `history/history.json` and count the entries recorded for a long-lived test case. That number is the real depth of the carried series. ## Practical shape of the step Three properties make the carry robust: - **It is a directory copy, not a file copy.** The series files travel together, so carrying `history.json` alone yields per-case history with no trend chart behind it. - **It is self-perpetuating in the right order.** Copy first, generate second, and the report you have just produced is itself the correct source for the next build. - **Its absence should be made loud.** Since the generator will not complain, an explicit check that the folder landed -- with an exemption for a first run -- is the only thing that converts a silently truncated trend into a visible failure. ## Summary The `history/` directory travels **out of the finished report and into the next run's results directory**, and it has to be there **before** `allure generate` starts. Both constraints fall out of the same property: the generator reads results and writes a report, in one pass, and never the other way round.
- Does anything in the folder have to be renamed when it moves from the report side to the results side?No. The generator looks for the same file names under `history/` on the results side that it wrote under `history/` in the report, so a recursive directory copy is the entire operation. Nothing is merged, converted or re-keyed on the way in.
- The report directory already holds a `history/` folder. Why is that not the one the next generation reads?Because the generator reads only the results directories it is given. Its report directory is output: it is rebuilt from those results on the next generation, so a history folder sitting there is neither consulted as a source nor guaranteed to survive. The folder has to move to the input side to have any effect.
saying these in an interview costs you the question
- Copies the history folder into the report directory
- Runs the copy after generation instead of before
- Expects the generator to read its own output directory
- Thinks the carried folder must be renamed or merged