UAT: 62 Robot Framework integration test helper files use MagicMock/unittest.mock — violates CONTRIBUTING.md prohibition on mocking in integration tests #5630

Open
opened 2026-04-09 07:58:37 +00:00 by HAL9000 · 3 comments
Owner

Background and Context

CONTRIBUTING.md explicitly states under Test Isolation and Mock Placement:

Unit Tests Only: Mocks, fakes, stubs, and test doubles are permitted only in unit tests. Integration tests must exercise real services, real endpoints, and real dependencies — mocking of any kind is strictly prohibited in integration tests.

The Robot Framework tests in robot/ are the project's integration test suite (run via nox -s integration_tests). However, 62 of the robot/helper_*.py files import and use MagicMock and unittest.mock, directly violating this rule.

Current Behavior

62 Robot Framework helper files use mocking:

robot/helper_a2a_facade_wiring.py
robot/helper_action_cli_spec.py
robot/helper_actor_add_rich_output.py
robot/helper_actor_add_yaml_first_path.py
robot/helper_actor_cli_show.py
robot/helper_actor_run_signature.py
robot/helper_apply_pipeline.py
robot/helper_automation_profile_cli.py
robot/helper_cli_consistency.py
robot/helper_cli_extensions.py
robot/helper_cli_formats.py
robot/helper_cli_lifecycle.py
robot/helper_cli_lifecycle_e2e.py
robot/helper_cloud_resources.py
robot/helper_config_cli.py
robot/helper_config_project_scope.py
robot/helper_config_resolution.py
robot/helper_correction_subtree_isolation.py
robot/helper_decision_di.py
robot/helper_error_recovery.py
... (42 more)

Example from robot/helper_cli_formats.py:

from unittest.mock import MagicMock, patch
...
svc = MagicMock()

Example from robot/helper_a2a_facade_wiring.py:

from unittest.mock import MagicMock
...
def _mock_session_service() -> MagicMock:
    svc = MagicMock()

Expected Behavior

Integration tests must exercise real services, real endpoints, and real dependencies. Mocking is strictly prohibited. These tests should be refactored to:

  1. Use real service instances with real (in-memory or test) databases
  2. Use dependency injection to provide test-specific implementations (not mocks)
  3. Or be moved to the Behave unit test suite (features/) if they require mocking

Acceptance Criteria

  • All robot/helper_*.py files are free of MagicMock, unittest.mock, and any other mocking frameworks
  • Integration tests exercise real service implementations
  • If a test cannot be written without mocking, it is moved to features/ as a Behave unit test

Supporting Information

  • CONTRIBUTING.md: "Integration tests must exercise real services, real endpoints, and real dependencies — mocking of any kind is strictly prohibited in integration tests."
  • Verified via: grep -l "MagicMock\|unittest.mock" /app/robot/helper_*.py | wc -l → 62 files

Metadata

  • Commit Message: fix(tests): remove mocking from Robot Framework integration test helpers
  • Branch: fix/integration-test-no-mocks

Subtasks

  • Audit all 62 robot helper files for mock usage
  • Refactor each to use real service instances or move to Behave unit tests
  • Verify integration tests pass without mocks

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created with the prescribed commit message.
  • The commit is pushed to the branch and submitted as a pull request to master, reviewed, and merged.

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Background and Context CONTRIBUTING.md explicitly states under **Test Isolation and Mock Placement**: > **Unit Tests Only:** Mocks, fakes, stubs, and test doubles are permitted only in unit tests. Integration tests must exercise real services, real endpoints, and real dependencies — mocking of any kind is strictly prohibited in integration tests. The Robot Framework tests in `robot/` are the project's integration test suite (run via `nox -s integration_tests`). However, 62 of the `robot/helper_*.py` files import and use `MagicMock` and `unittest.mock`, directly violating this rule. ## Current Behavior 62 Robot Framework helper files use mocking: ``` robot/helper_a2a_facade_wiring.py robot/helper_action_cli_spec.py robot/helper_actor_add_rich_output.py robot/helper_actor_add_yaml_first_path.py robot/helper_actor_cli_show.py robot/helper_actor_run_signature.py robot/helper_apply_pipeline.py robot/helper_automation_profile_cli.py robot/helper_cli_consistency.py robot/helper_cli_extensions.py robot/helper_cli_formats.py robot/helper_cli_lifecycle.py robot/helper_cli_lifecycle_e2e.py robot/helper_cloud_resources.py robot/helper_config_cli.py robot/helper_config_project_scope.py robot/helper_config_resolution.py robot/helper_correction_subtree_isolation.py robot/helper_decision_di.py robot/helper_error_recovery.py ... (42 more) ``` Example from `robot/helper_cli_formats.py`: ```python from unittest.mock import MagicMock, patch ... svc = MagicMock() ``` Example from `robot/helper_a2a_facade_wiring.py`: ```python from unittest.mock import MagicMock ... def _mock_session_service() -> MagicMock: svc = MagicMock() ``` ## Expected Behavior Integration tests must exercise real services, real endpoints, and real dependencies. Mocking is strictly prohibited. These tests should be refactored to: 1. Use real service instances with real (in-memory or test) databases 2. Use dependency injection to provide test-specific implementations (not mocks) 3. Or be moved to the Behave unit test suite (`features/`) if they require mocking ## Acceptance Criteria - [ ] All `robot/helper_*.py` files are free of `MagicMock`, `unittest.mock`, and any other mocking frameworks - [ ] Integration tests exercise real service implementations - [ ] If a test cannot be written without mocking, it is moved to `features/` as a Behave unit test ## Supporting Information - CONTRIBUTING.md: "Integration tests must exercise real services, real endpoints, and real dependencies — mocking of any kind is strictly prohibited in integration tests." - Verified via: `grep -l "MagicMock\|unittest.mock" /app/robot/helper_*.py | wc -l` → 62 files ## Metadata - **Commit Message**: `fix(tests): remove mocking from Robot Framework integration test helpers` - **Branch**: `fix/integration-test-no-mocks` ## Subtasks - [ ] Audit all 62 robot helper files for mock usage - [ ] Refactor each to use real service instances or move to Behave unit tests - [ ] Verify integration tests pass without mocks ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created with the prescribed commit message. - The commit is pushed to the branch and submitted as a pull request to `master`, reviewed, and merged. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: High — 62 Robot Framework integration test helpers using MagicMock directly violates CONTRIBUTING.md's explicit prohibition on mocking in integration tests. This is a systemic test quality issue that undermines the entire integration test suite's value.
  • Milestone: None (cross-cutting quality issue — should be addressed as part of ongoing test quality work)
  • Story Points: 13 — XXL — Auditing and refactoring 62 files to use real services is a significant effort, 1 week+.
  • MoSCoW: MoSCoW/Must have — CONTRIBUTING.md explicitly prohibits mocking in integration tests. This is not optional. Integration tests that use mocks provide false confidence and violate the project's testing standards.
  • Parent Epic: #5406 (Testing Infrastructure & Quality Hardening Legendary)

This is a critical test quality violation. The CONTRIBUTING.md rule is clear: "mocking of any kind is strictly prohibited in integration tests." 62 files violating this rule means the integration test suite is effectively a second unit test suite with mocks, not true integration tests.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: High — 62 Robot Framework integration test helpers using MagicMock directly violates CONTRIBUTING.md's explicit prohibition on mocking in integration tests. This is a systemic test quality issue that undermines the entire integration test suite's value. - **Milestone**: None (cross-cutting quality issue — should be addressed as part of ongoing test quality work) - **Story Points**: 13 — XXL — Auditing and refactoring 62 files to use real services is a significant effort, 1 week+. - **MoSCoW**: MoSCoW/Must have — CONTRIBUTING.md explicitly prohibits mocking in integration tests. This is not optional. Integration tests that use mocks provide false confidence and violate the project's testing standards. - **Parent Epic**: #5406 (Testing Infrastructure & Quality Hardening Legendary) This is a critical test quality violation. The CONTRIBUTING.md rule is clear: "mocking of any kind is strictly prohibited in integration tests." 62 files violating this rule means the integration test suite is effectively a second unit test suite with mocks, not true integration tests. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner
HAL9000 added this to the v3.2.0 milestone 2026-04-09 08:05:56 +00:00
Author
Owner

Label compliance fix applied:

  • Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md

Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: backlog-groomer

Label compliance fix applied: - Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
Author
Owner

🏷️ Label Fix Applied by Backlog Groomer

The State/Verified label has been added to this issue.

Reason: During a routine backlog grooming pass, this issue was found to have Type/Bug and a Priority/ label but was missing a State/* label entirely — a violation of the CONTRIBUTING.md requirement that every issue must have exactly one State/ label.

Since this issue has been triaged with a priority and type, State/Verified is the appropriate state: the issue has been confirmed as legitimate and is now part of the active backlog.

No other changes were made.


Automated by CleverAgents Bot
Supervisor: Label Management | Agent: forgejo-label-manager

## 🏷️ Label Fix Applied by Backlog Groomer The `State/Verified` label has been added to this issue. **Reason**: During a routine backlog grooming pass, this issue was found to have `Type/Bug` and a `Priority/` label but was missing a `State/*` label entirely — a violation of the CONTRIBUTING.md requirement that every issue must have exactly one `State/` label. Since this issue has been triaged with a priority and type, `State/Verified` is the appropriate state: the issue has been confirmed as legitimate and is now part of the active backlog. No other changes were made. --- **Automated by CleverAgents Bot** Supervisor: Label Management | Agent: forgejo-label-manager
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#5630
No description provided.