Junit functional upload#419
Conversation
- Create a pydantic model to handle the data storage - Allows for writing regression tests for upload simplification
There was a problem hiding this comment.
Pull request overview
This PR enhances Greenboard result uploads by deriving pass/fail counts from pytest’s JUnit XML output (when available), falling back to the existing in-process hook counters otherwise. It also refactors the uploaded payload into a typed RunResult model and adds unit tests around the uploader and fixture behavior.
Changes:
- Add JUnit XML parsing (
junitparser) and use it in the greenboard session fixture to determine pass/fail counts. - Refactor Greenboard upload payload construction to use a
RunResultPydantic model and centralize timestamp/upsert logic. - Add comprehensive unit tests for
GreenboardUploaderand thegreenboardfixture.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Locks the new junitparser dependency in the workspace. |
client/pyproject.toml |
Adds junitparser dependency and configures pytest to emit a JUnit XML by default. |
client/src/cbltest/plugins/greenboard_fixture.py |
Reads JUnit XML (when present) to prefer XML-derived counts for Greenboard uploads. |
client/src/cbltest/greenboarduploader.py |
Implements JUnit XML counting helper and refactors upload document construction to RunResult. |
client/tests/test_greenboarduploader.py |
Adds unit tests validating uploader payloads and fixture upload behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Some of these fixtures are very similar to #418, I'll see about @borrrden merging that PR so we can reuse them. It would be fine to move these to conftest.py for reuse in unit tests. Do you have an example jenkins job that picks these up? You can fork this branch to just run in jenkins.
We want to make sure that we can see the results separately, which might need to set |
torcolvin
left a comment
There was a problem hiding this comment.
This can be in a separate PR, but I want a PR that adds to toplevel pytest.ini tools.pytest.ini_options
junit_xml = "junit_report.xml"
junit_output = "all"
junit_log_passing_tests = false # don't store output for passing tests
For the tests which self aggregate junit files, you can do pytest -o junit_xml=custom_name.xml
borrrden
left a comment
There was a problem hiding this comment.
I think this is ok as long as the stray file for checking commit message is removed
|
Since this can be in a separate PR, and Tor is in a recovery for a while, I will merge this PR for now, based on resolving all of his comments and Jim's PR approval as well. I will work on that separate PR related suggestion and will implement it as a part of Upgrade Test related Junit implementation, SINCE THIS PR ONLY CONCERNS WITH FUNCTIONAL TESTS, hence no AGGREGATION of pytest files. |
CBG-5403