Skip to content

fix: compute robotframework step duration from total elapsed time#491

Merged
gibiw merged 2 commits into
mainfrom
fix/robotframework-step-duration
May 25, 2026
Merged

fix: compute robotframework step duration from total elapsed time#491
gibiw merged 2 commits into
mainfrom
fix/robotframework-step-duration

Conversation

@gibiw
Copy link
Copy Markdown
Contributor

@gibiw gibiw commented May 25, 2026

Summary

  • listener.__parse_steps was setting step.execution.duration to result.body[i].elapsed_time.microseconds — the residual-microseconds field of a timedelta (0..999999), not the total length.
  • Combined with the contract that StepExecution.duration is stored as milliseconds (qase-python-commons/src/qase/commons/models/step.py:121), this inflated every sub-second step by ~1000x. A 2.3 ms step appeared as 2.3 s; a 0.5 s step as 500 s; a 2.5 s step as 500 s (only the residual µs slot).
  • Fix: int(elapsed_time.total_seconds() * 1000) so the value reflects real elapsed milliseconds.
  • Bumps qase-robotframework to 6.0.1.

Test plan

  • Added unit tests for __parse_steps covering ms conversion at sub-millisecond, sub-second and multi-second durations plus a start/end time round-trip.
  • pytest tests/tests_qaseio_robotframework/test_listener.py -v → 18 passed locally (Python 3.12).
  • End-to-end verified against TestOps project DEVX with examples/single/robot/tests/simple.robot:
    • Before fix (run #872): "Open Login Page" step shows duration=2281 — rendered as 2.281 s (actual elapsed was 2.3 ms).
    • After fix (run #873): same step duration=1 (1 ms — matches actual elapsed).
  • CI green on all supported Python versions.

gibiw added 2 commits May 25, 2026 17:39
listener.__parse_steps was reading the .microseconds field of the
elapsed_time timedelta — the residual-microseconds slot (0..999999) —
and writing it to step.execution.duration. Because the model contract
stores durations as milliseconds, this inflated every sub-second
step's duration by ~1000x: a 2.3 ms step appeared as 2.3 s, a 0.5 s
step as 500 s.

Compute duration via int(elapsed_time.total_seconds() * 1000) so it
reflects the real elapsed milliseconds.

Add unit tests covering the ms conversion across sub-millisecond,
sub-second and multi-second durations.
@gibiw gibiw merged commit b0fc205 into main May 25, 2026
37 checks passed
@gibiw gibiw deleted the fix/robotframework-step-duration branch May 25, 2026 14:47
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.

1 participant