TEST-INFRA: [ci-execution-time] Identify and optimize slow unit tests #2417

Open
opened 2026-04-03 17:40:37 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: perf/ci-execution-time-optimize-slow-unit-tests
  • Commit Message: perf(tests): identify and optimize slowest unit tests using behave-parallel performance report
  • Milestone: v3.8.0
  • Parent Epic: #1678

Background and Context

The behave-parallel tool can generate a report of the slowest tests. This report should be used to identify and optimize the slowest unit tests. This will involve running the unit tests with the appropriate options to generate the report, analyzing the report to identify the slowest tests, and then refactoring the tests to improve their performance.

This issue is a targeted follow-on to #1819 (Investigate and optimize the unit_tests session), focusing specifically on the behave-parallel performance report workflow to surface and fix the worst individual test offenders.

Expected Behavior

The unit_tests nox session runs measurably faster after the slowest individual tests are identified and refactored, without any reduction in coverage.

Acceptance Criteria

  • behave-parallel is configured to emit a performance report.
  • The top 10 slowest unit tests are identified and documented.
  • Each slow test is investigated for root cause (I/O, DB setup, fixture overhead, etc.).
  • Slow tests are refactored to improve performance without reducing coverage.
  • The nox -e unit_tests session is measurably faster as a result.
  • Coverage remains ≥ 97% after refactoring.

Subtasks

  • Configure behave-parallel to generate a performance report.
  • Analyze the report to identify the top 10 slowest unit tests.
  • For each of the slow tests, investigate the cause of the slowness.
  • Refactor the slow tests to improve their performance without reducing their coverage.
  • Verify coverage ≥ 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • The slowest unit tests are identified and optimized.
  • The unit_tests nox session is faster as a result.
  • 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**: `perf/ci-execution-time-optimize-slow-unit-tests` - **Commit Message**: `perf(tests): identify and optimize slowest unit tests using behave-parallel performance report` - **Milestone**: v3.8.0 - **Parent Epic**: #1678 ## Background and Context The `behave-parallel` tool can generate a report of the slowest tests. This report should be used to identify and optimize the slowest unit tests. This will involve running the unit tests with the appropriate options to generate the report, analyzing the report to identify the slowest tests, and then refactoring the tests to improve their performance. This issue is a targeted follow-on to #1819 (Investigate and optimize the `unit_tests` session), focusing specifically on the `behave-parallel` performance report workflow to surface and fix the worst individual test offenders. ## Expected Behavior The `unit_tests` nox session runs measurably faster after the slowest individual tests are identified and refactored, without any reduction in coverage. ## Acceptance Criteria - `behave-parallel` is configured to emit a performance report. - The top 10 slowest unit tests are identified and documented. - Each slow test is investigated for root cause (I/O, DB setup, fixture overhead, etc.). - Slow tests are refactored to improve performance without reducing coverage. - The `nox -e unit_tests` session is measurably faster as a result. - Coverage remains ≥ 97% after refactoring. ## Subtasks - [ ] Configure `behave-parallel` to generate a performance report. - [ ] Analyze the report to identify the top 10 slowest unit tests. - [ ] For each of the slow tests, investigate the cause of the slowness. - [ ] Refactor the slow tests to improve their performance without reducing their coverage. - [ ] Verify coverage ≥ 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - The slowest unit tests are identified and optimized. - The `unit_tests` nox session is faster as a result. - 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.8.0 milestone 2026-04-03 17:40:41 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Medium — Identifying and optimizing slow unit tests improves CI throughput and developer productivity.
  • Milestone: v3.8.0
  • MoSCoW: Could Have — CI optimization is desirable but not blocking any feature work. The tests pass, they're just slow.
  • Parent Epic: #1678 (CI Execution Time Optimization)

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

Issue triaged by project owner: - **State**: Verified - **Priority**: Medium — Identifying and optimizing slow unit tests improves CI throughput and developer productivity. - **Milestone**: v3.8.0 - **MoSCoW**: Could Have — CI optimization is desirable but not blocking any feature work. The tests pass, they're just slow. - **Parent Epic**: #1678 (CI Execution Time Optimization) --- **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#2417
No description provided.