feat(testcase): annotate testcase links with results - #739
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //src:license-checkStatus: Click to expand output |
|
Documentation preview for this pull request is available at: |
There was a problem hiding this comment.
Pull request overview
This PR introduces a doctree-resolved post-processing hook in score_source_code_linker to annotate testcase links with a colored status badge derived from each testcase need’s result, and adds documentation + unit tests for the behavior.
Changes:
- Add
testcase_annotations.pyimplementingannotate_testcase_results()to append(passed|failed|skipped|disabled|<other>)badges to testcase references. - Register the new hook from the extension
__init__.pyand document the new module in extension docs. - Add unit tests covering reference resolution via
refid/refurifragments and result-to-color mapping/fallback behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/extensions/score_source_code_linker/tests/test_testcase_annotations.py | Adds unit tests for reference target resolution and result badge rendering. |
| src/extensions/score_source_code_linker/testcase_annotations.py | Implements doctree post-processing to append colored result badges to testcase references. |
| src/extensions/score_source_code_linker/init.py | Wires the new doctree-resolved hook into the extension setup. |
| src/extensions/docs/source_code_linker.md | Documents the presence/purpose of the new module file. |
| docs/how-to/test_to_doc_links.rst | Updates user documentation around test linking and describes testcase result annotations. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
456cdb7 to
a40328d
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
docs/how-to/test_to_doc_links.rst:48
- This removes the only placement guidance for manually generated reports, but the linker does not discover arbitrary JUnit XML: it searches for files named
test.xmlunder the workspace-roottests-report/or Bazel'sbazel-testlogs/. Without that detail, users of the advanced path cannot make the documented integration work.
This section is only relevant when your language or test framework does not
have one of the integrations above. In that case, produce JUnit XML with the
metadata described below. The generated test results are processed
automatically and create GitHub links from the requirements to the testcases.
.github/workflows/license_check.yml:42
- The composite action emits only one
--comply-withflag, so this value expands to--comply-with ASF EF; the scanner consumesASFas the policy and treatsEFas another lockfile. The job will then try to parse a nonexistentEFfile instead of checking both policies. Pass one policy here, or update the action to emit--comply-withonce per policy.
comply_with: ASF EF
MaximilianSoerenPollak
left a comment
There was a problem hiding this comment.
Overall looks okay I think.
It works in the implementation and rendered page and looks good.
MaximilianSoerenPollak
left a comment
There was a problem hiding this comment.
Seems okay though still some questions open that can be adressed in future PRs.
Would like @a-zw approval too before merge.
The doctree-resolved hook that decorates testcase back-links with a coloured (passed)/(failed) badge has been extracted, generalized (it now also covers GitHub testlink references on requirements, not just links on module-verification-report pages) and moved to score_source_code_linker in #739. Drop the local duplicate: - testcase_annotations.py and its tests - the doctree-resolved registration + docstring bullet in __init__.py - the corresponding comment in directive.py The module_verification_report_registry itself is kept: it is still used by consistency_checks.py for the build-finished component-link validation, independent of testcase annotation. Depends on: #739
| # annotation. Keeping them in one block avoids repeating inline style rules on | ||
| # every testcase link and lets the same classes handle theme changes. | ||
| _TESTCASE_STATUS_CSS = """ | ||
| <style> |
There was a problem hiding this comment.
for future PR maybe move this to overall css files
MaximilianSoerenPollak
left a comment
There was a problem hiding this comment.
Talked about in a call, can be simplified a lot.
Work in Progress.
all findings discussed and addressed
MaximilianSoerenPollak
left a comment
There was a problem hiding this comment.
Talked about in a call. Looks much simpler now. 💯
Summary
score_source_code_linkerExtracted from #730; original author is @antonkri
see https://eclipse-score.github.io/docs-as-code/pr-739/internals/requirements/requirements.html
