TEST-INFRA: [test-data-quality] Replace Hardcoded Data in Steps with Dynamic Data Generation #5434

Open
opened 2026-04-09 06:41:20 +00:00 by HAL9000 · 0 comments
Owner

Metadata

  • Branch: test/test-data-quality-dynamic-data-generation
  • Commit Message: test(infra): replace hardcoded step data with dynamic data generation using Faker
  • Milestone: Backlog (no milestone — see backlog note below)
  • Parent Epic: #5407

Background and context

During an analysis of the test infrastructure, it was observed that many Behave step implementations use hardcoded data, such as strings, numbers, and dates. An example of this pattern can be found in features/steps/actor_service_steps.py where actor names are hardcoded in the steps (e.g., "my-actor", "another-actor").

This practice makes the tests brittle and hard to maintain:

  • Brittleness: If the validation rules for the data change, many tests will need to be updated.
  • Lack of Variety: The tests always run with the same data, which may not cover all edge cases.
  • Maintenance Overhead: If the data needs to be changed, it has to be updated in multiple places.

Expected behavior

To improve the quality and robustness of the test suite, the hardcoded data in the steps should be replaced with dynamically generated data. This can be achieved by:

  • Using a Data Generation Library: A library like Faker can be used to generate realistic and varied data.
  • Creating Test Data Factories: Test data factories can be created to centralize the creation of complex objects.
  • Using Shared Constants: For data that needs to be consistent across tests, shared constants can be used.

Subtasks

  • Identify all the step implementation files that use hardcoded data.
  • Introduce a data generation library (e.g., Faker) to the test dependencies.
  • Create test data factories for the domain models.
  • Update the step files to use the data generation library and the test data factories.
  • Ensure that all tests pass after the refactoring.

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • 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.

Duplicate Check

  • Search queries: "hardcoded data", "test data"
  • Results: 0 for all queries.
  • Reasoning: No existing issues cover the replacement of hardcoded data in steps with dynamic data generation.

Backlog note: This issue was discovered during autonomous operation
on milestone v3.7.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


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

## Metadata - **Branch**: `test/test-data-quality-dynamic-data-generation` - **Commit Message**: `test(infra): replace hardcoded step data with dynamic data generation using Faker` - **Milestone**: Backlog (no milestone — see backlog note below) - **Parent Epic**: #5407 ## Background and context During an analysis of the test infrastructure, it was observed that many Behave step implementations use hardcoded data, such as strings, numbers, and dates. An example of this pattern can be found in `features/steps/actor_service_steps.py` where actor names are hardcoded in the steps (e.g., `"my-actor"`, `"another-actor"`). This practice makes the tests brittle and hard to maintain: * **Brittleness:** If the validation rules for the data change, many tests will need to be updated. * **Lack of Variety:** The tests always run with the same data, which may not cover all edge cases. * **Maintenance Overhead:** If the data needs to be changed, it has to be updated in multiple places. ## Expected behavior To improve the quality and robustness of the test suite, the hardcoded data in the steps should be replaced with dynamically generated data. This can be achieved by: * **Using a Data Generation Library:** A library like `Faker` can be used to generate realistic and varied data. * **Creating Test Data Factories:** Test data factories can be created to centralize the creation of complex objects. * **Using Shared Constants:** For data that needs to be consistent across tests, shared constants can be used. ## Subtasks - [ ] Identify all the step implementation files that use hardcoded data. - [ ] Introduce a data generation library (e.g., `Faker`) to the test dependencies. - [ ] Create test data factories for the domain models. - [ ] Update the step files to use the data generation library and the test data factories. - [ ] Ensure that all tests pass after the refactoring. ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - 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. ### Duplicate Check - **Search queries:** "hardcoded data", "test data" - **Results:** 0 for all queries. - **Reasoning:** No existing issues cover the replacement of hardcoded data in steps with dynamic data generation. > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.7.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure | Agent: new-issue-creator
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#5434
No description provided.