TEST-INFRA: [test-architecture] Reorganize shared Behave steps #2444

Open
opened 2026-04-03 18:23:12 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: chore/m7-reorganize-shared-behave-steps
  • Commit Message: chore(test): reorganize shared Behave steps into features/steps/shared/ directory
  • Milestone: v3.6.0
  • Parent Epic: #1678

Background and Context

The current organization of shared Behave steps can be improved. The CONTRIBUTING.md suggests that shared steps should be placed in a features/steps/shared/ directory, but this convention is not being followed. Currently, shared steps are located in files like features/steps/cli_coverage_steps.py, which contains a mix of different kinds of shared steps, making the test suite harder to navigate and maintain.

Expected Behavior

Shared Behave steps are organized into a dedicated features/steps/shared/ directory with logically grouped, focused modules — making it easy to locate, reuse, and extend shared step definitions across the test suite.

Proposed Solution

To improve the organization and maintainability of the Behave tests:

  1. Create a features/steps/shared/ directory.
  2. Move the shared steps from features/steps/cli_coverage_steps.py and other similar files into smaller, more focused modules within the shared directory. For example:
    • Steps related to shell commands → features/steps/shared/shell_steps.py
    • Steps related to CLI output validation → features/steps/shared/cli_output_steps.py
    • Steps related to file system operations → features/steps/shared/fs_steps.py

Subtasks

  • Audit all existing shared step files and catalogue which steps belong to which logical group
  • Create the features/steps/shared/ directory with an __init__.py
  • Create features/steps/shared/shell_steps.py and migrate shell-related steps
  • Create features/steps/shared/cli_output_steps.py and migrate CLI output validation steps
  • Create features/steps/shared/fs_steps.py and migrate file system operation steps
  • Remove or deprecate the original monolithic step files (e.g., cli_coverage_steps.py) once migration is complete
  • Verify all existing Behave feature files still resolve their step definitions correctly
  • Run the full Behave test suite and confirm all tests pass

Definition of Done

  • The features/steps/shared/ directory exists and contains logically grouped step modules
  • All shared steps previously in monolithic files are migrated to the appropriate module under features/steps/shared/
  • No step definition is duplicated or lost during migration
  • All existing Behave tests pass after the reorganization
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done
  • All nox stages pass
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: Test Infrastructure | Agent: ca-new-issue-creator

## Metadata - **Branch**: `chore/m7-reorganize-shared-behave-steps` - **Commit Message**: `chore(test): reorganize shared Behave steps into features/steps/shared/ directory` - **Milestone**: v3.6.0 - **Parent Epic**: #1678 ## Background and Context The current organization of shared Behave steps can be improved. The `CONTRIBUTING.md` suggests that shared steps should be placed in a `features/steps/shared/` directory, but this convention is not being followed. Currently, shared steps are located in files like `features/steps/cli_coverage_steps.py`, which contains a mix of different kinds of shared steps, making the test suite harder to navigate and maintain. ## Expected Behavior Shared Behave steps are organized into a dedicated `features/steps/shared/` directory with logically grouped, focused modules — making it easy to locate, reuse, and extend shared step definitions across the test suite. ## Proposed Solution To improve the organization and maintainability of the Behave tests: 1. Create a `features/steps/shared/` directory. 2. Move the shared steps from `features/steps/cli_coverage_steps.py` and other similar files into smaller, more focused modules within the `shared` directory. For example: - Steps related to shell commands → `features/steps/shared/shell_steps.py` - Steps related to CLI output validation → `features/steps/shared/cli_output_steps.py` - Steps related to file system operations → `features/steps/shared/fs_steps.py` ## Subtasks - [ ] Audit all existing shared step files and catalogue which steps belong to which logical group - [ ] Create the `features/steps/shared/` directory with an `__init__.py` - [ ] Create `features/steps/shared/shell_steps.py` and migrate shell-related steps - [ ] Create `features/steps/shared/cli_output_steps.py` and migrate CLI output validation steps - [ ] Create `features/steps/shared/fs_steps.py` and migrate file system operation steps - [ ] Remove or deprecate the original monolithic step files (e.g., `cli_coverage_steps.py`) once migration is complete - [ ] Verify all existing Behave feature files still resolve their step definitions correctly - [ ] Run the full Behave test suite and confirm all tests pass ## Definition of Done - [ ] The `features/steps/shared/` directory exists and contains logically grouped step modules - [ ] All shared steps previously in monolithic files are migrated to the appropriate module under `features/steps/shared/` - [ ] No step definition is duplicated or lost during migration - [ ] All existing Behave tests pass after the reorganization - [ ] A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation - [ ] The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly - [ ] The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure | Agent: ca-new-issue-creator
freemo added this to the v3.6.0 milestone 2026-04-03 18:23:17 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: Could Have — Desirable improvement but not necessary for the milestone. Include only if time permits.

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

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: Could Have — Desirable improvement but not necessary for the milestone. Include only if time permits. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
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#2444
No description provided.