Skip to content

Conversation

@thomhurst
Copy link
Owner

Summary

  • Exclude both Before and After hooks from headline test durationTestEnd is now set immediately after the test body finishes (before After hooks run), matching TestStart which is already set after Before hooks complete
  • Record Before/After test-level hooks as step timings via Timings.Record("BeforeTest"/"AfterTest", ...) for granular visibility in test reports
  • Guard EndTime assignments with ??= in TestRunner, TestStateManager.MarkCompleted, and TestStateManager.MarkFailed to respect the body-level TestEnd
  • Clear Timings on retry/re-execution in RetryHelper and TestCoordinator alongside existing TestStart/TestEnd resets

Closes #4711

Test plan

  • Verify build succeeds across all target frameworks
  • Run existing engine tests to check for regressions
  • Verify headline duration reflects only test body time (not Before/After hooks)
  • Verify step timings include "BeforeTest" and "AfterTest" entries
  • Verify retry and re-execution properly clear timings

🤖 Generated with Claude Code

…headline duration

Before hooks were already excluded from test duration (TestStart set after
Before hooks), but After hooks were included (TestEnd only set after After
hooks completed). This made reported test times inconsistent and inflated.

Now TestEnd is set immediately after the test body finishes (before After
hooks run), and both Before/After test-level hooks are recorded as step
timings via Timings.Record() for granular visibility. EndTime assignments
in TestRunner, TestStateManager use ??= to respect the body-level TestEnd.
Timings are cleared on retry and re-execution.

Closes #4711

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@thomhurst thomhurst merged commit 5f7f752 into main Feb 10, 2026
12 of 13 checks passed
@thomhurst thomhurst deleted the fix/consistent-test-time-tracking branch February 10, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Test time tracking is inconsistent

1 participant