fix: add test_case_id to prevent RP history merging#14
Conversation
Signed-off-by: Silvia Tarabova <starabov@redhat.com>
📝 WalkthroughWalkthroughThis PR adds per-test-case identification to ReportPortal integration by introducing a ChangesTest Case ID Propagation and Auto-Analysis Trigger
Sequence DiagramsequenceDiagram
participant Writer as RPWriter
participant WrapperAPI as RPClientWrapper
participant AutoAnalysis as AutoAnalysisTrigger
participant RPAPI as ReportPortal API
Writer->>WrapperAPI: start_test_case(name, suite_name, test_case_id)
WrapperAPI->>RPAPI: start_test_item(test_case_id=suite_qualified_id)
RPAPI-->>WrapperAPI: item_id
WrapperAPI-->>Writer: item_id
Writer->>WrapperAPI: finish_test_case(item_id, result)
WrapperAPI->>RPAPI: finish_test_item(item_id, result)
RPAPI-->>WrapperAPI: ✓
Writer->>AutoAnalysis: trigger_auto_analysis(launch_id)
AutoAnalysis->>RPAPI: POST /auto-analysis (launch_id)
RPAPI-->>AutoAnalysis: ✓
AutoAnalysis-->>Writer: success
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/unit/test_reportportal_client_wrapper.py (1)
244-263: ⚡ Quick winAdd one explicit test for non-
Nonetest_case_idforwarding.Right now the updated assertions only cover the default
Nonepath. A positive-path assertion with an actual suite-qualified ID would directly lock in the PR’s core behaviour.💡 Minimal test tweak
case_id = wrapper.start_test_case( name="Test Case", start_time="2024-01-01T12:00:00", parent_id="suite_456", attributes=[{"key": "color", "value": "green"}], description="Case description", - code_ref="path/to/test.py::test_name" + code_ref="path/to/test.py::test_name", + test_case_id="smoke: path/to/test.py::test_name" ) @@ parent_item_id="suite_456", code_ref="path/to/test.py::test_name", - test_case_id=None, + test_case_id="smoke: path/to/test.py::test_name", retry=False, retry_of=None )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/unit/test_reportportal_client_wrapper.py` around lines 244 - 263, Add a focused positive-path unit test that verifies a non-None test_case_id is forwarded to the ReportPortal client: call wrapper.start_test_case (from the test file) with a concrete test_case_id like "suite_123::case_456" and assert wrapper.client.start_test_item was called with test_case_id set to that exact value (in addition to the existing args); reference wrapper.start_test_case and wrapper.client.start_test_item to locate where to add the assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/unit/test_reportportal_client_wrapper.py`:
- Around line 244-263: Add a focused positive-path unit test that verifies a
non-None test_case_id is forwarded to the ReportPortal client: call
wrapper.start_test_case (from the test file) with a concrete test_case_id like
"suite_123::case_456" and assert wrapper.client.start_test_item was called with
test_case_id set to that exact value (in addition to the existing args);
reference wrapper.start_test_case and wrapper.client.start_test_item to locate
where to add the assertion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 02db9ba1-ff6a-4d21-9aaf-b9310d402cf7
📒 Files selected for processing (3)
src/reportportal/reportportal_client_wrapper.pysrc/reportportal/writer.pytests/unit/test_reportportal_client_wrapper.py
Summary
test_case_idparameter tostart_test_case()in the RP client wrappertest_case_id({suite_name}: {test_path}) so ReportPortal tracks tests under different suites as distinct items in historyCloses #13
Summary by CodeRabbit
Release Notes
New Features
Refactor