Repository navigation
feat: add timeline report - #279
Conversation
|
I think this is a great idea, the report itself and using a mermaid gant chart. Design looks nice too! How would it behave for large test runs? Should we add a max test count? |
It should be tested for different setups, which I haven't done, yet: Long, short, rerun flaky tests etc. This is still a draft, that's why i created an issue #278 , to collect some feedback, and enhance requirements. Not using mermaid there is an obvious issue, when test is failed on initialization and has very short duration, it is difficult to visualize. For now, let's proceed with this design. Once I test more edge cases, I'll mark this PR as ready for review and tag you. Thank you! |
Add a `timeline-report` input that adds a "Timeline" section to the job summary: a Mermaid Gantt chart of when each test ran on each thread or worker, a per-thread table of busy time, idle time and utilization, and a collapsible table of test timings. - Rows come from `threadId`, or the pytest-xdist worker in `extra.worker`. A thread whose tests overlap in time, such as the "Test worker" thread of every Gradle fork, is split into several rows. Without thread IDs, or when the threads need more than 40 rows, rows are inferred from start and stop times. - Bars are colored by result. Tests too short to tell apart are merged into one bar labelled with their count, failures are never merged into passes, and a failure too short to see is drawn as a diamond or a sliver. This keeps the chart under 20,000 characters, well within GitHub's Mermaid limit. If more than 40 rows remain, or the chart is still too large, the rows with failures and the busiest ones are drawn. - Names are written on bars wide enough to hold them. A bar too narrow for its name carries the number of its row in the test timings table (the `#` column). - Runs before a retry (`retryAttempts`) are drawn on their test's thread where it was free, or in a row of their own. - When one report holds several runs, the wait between them is cut out of the chart, and earlier runs that a later run repeated are left out. - Times in seconds, microseconds or nanoseconds are converted, reports with whole-second times show the order of tests, and Go parent tests are left out. - A `timelineReport` Handlebars helper gives custom templates the same data. Also adds docs (report showcase, custom template example, README, changelog), unit and template tests, a self-test job with a sample report, and the rebuilt dist.
5d772fa to
1898a95
Compare
|
@Ma11hewThomas this is ready for review. I rebuilt it on top of current On your question about large runs: there is no max test count. The chart stays under 20,000 characters by merging tests too short to see into one bar labelled with their count. Failures are never merged. With more than 40 rows, it infers fewer rows from start and stop times, and if that is not enough, it draws the rows with failures and the busiest ones. Here is 20,000 tests on 16 threads. The description has the details and more examples. The CI and self-test workflows are waiting for your approval to run. |
|
Thank you @alexshamrai, the report is great! To be released shortly |
Closes #278
Adds a
timeline-reportinput. It adds a Timeline section to the job summary with three parts:It answers questions a list of results can't:
Examples
Rendered by GitHub, from the preview folder:
Job summaries from real workflow runs:
Large runs
This answers the question on the draft. There is no maximum test count: the report scales the chart down instead.
What else it handles
threadId, or from the pytest-xdist worker inextra.worker.#column).retryAttempts) are drawn on their test's thread where it was free, otherwise in a row of their own. A failed run before a retry is yellow with a dashed outline. CTRF has no field for the thread an earlier attempt ran on, so this placement is a best guess; Proposal: Add optionalthreadIdtoretryAttemptsentries ctrf#74 proposes adding one.timelineReportHandlebars helper exposes the same data (seedocs/build-your-own-report.md).Compatibility
falseby default). Other reports are unchanged.How to review
All the logic is in
src/ctrf/timeline/:types.tscollect.tsgantt.tsreport.tstext.tsheap.tsThe template is
src/reports/timeline.hbs. The rest is wiring: the input, the report order and the helper.dist/is rebuilt withnpm run package.Testing
npm test(321 tests, including runs of 20,000 and 40,000 tests);lint:check,format:checkandbuild:check.npm run packagereproducesdist/from a cleannpm ci.ctrf-reports/timeline/ctrf-report.json.