Skip to content

A tool that turns test results into a report a release can carry - #251

Merged
McCal-Codes merged 1 commit into
mainfrom
test-report-tool
Oct 2, 2026
Merged

McCal-Codes merged 1 commit into
mainfrom
test-report-tool

Conversation

@McCal-Codes

Copy link
Copy Markdown
Owner

The site's new "How Folio is tested" page can state test counts, but only if something measures them. Counts typed into docs go stale (docs/standards/testing.md already says ~476 tests; the notes say well over 800).

What is true now:

  • tools/test-report.py reads Gradle's JUnit XML (TEST-*.xml) and writes a small JSON report: per-module suites, tests, passed, failures, errors and skipped, plus totals, with the version and commit. The output is stable (sorted keys), so the same results give the same file.
  • It cannot report zero by looking in the wrong place: a module directory with no results is an error. It exits 1 when any test failed or errored, but still writes the file, so a release script can decide not to attach it.
  • You point each module at one variant's results (for example app/build/test-results/testDebugUnitTest), because it counts everything under the directory it is given. The docstring says so.
  • tools/test_test_report.py has 5 unit tests (counting across modules, failures counted not passed, no-results is an error, exit codes, stable output). Run: python3 -m unittest discover -s tools -p 'test_*.py'.

Checked: the 5 tests pass. On the old partial results in my working tree it counted 221 tests in 54 suites and exited 0; pointed at a directory that does not exist it refused and exited 1.

Not done on purpose: it is not wired into scripts/release-signed.sh or CI. That is the release path, and it should not change right before the 0.6.8 candidate. After 0.6.8, the release script can run it and attach test-report.json to the release, and the site page will pick it up by itself. It changes nothing that ships, so no changelog line.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: faaa50a2ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/test-report.py
name, _, directory = spec.partition("=")
if not name or not directory:
parser.error(f"--module wants NAME=DIR, got {spec!r}")
modules[name] = Path(directory)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject duplicate module names

When --module is supplied twice with the same name, this assignment silently replaces the earlier directory. The report then counts only the final directory and exits successfully, so a copy/paste error such as two app=... arguments can produce an incomplete release artifact without warning. Reject duplicate names or explicitly combine their results instead of overwriting them.

Useful? React with 👍 / 👎.

@McCal-Codes
McCal-Codes merged commit e38e300 into main Oct 2, 2026
3 checks passed
@McCal-Codes
McCal-Codes deleted the test-report-tool branch October 2, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant