fix: compute robotframework step duration from total elapsed time#491
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
listener.__parse_stepswas settingstep.execution.durationtoresult.body[i].elapsed_time.microseconds— the residual-microseconds field of atimedelta(0..999999), not the total length.StepExecution.durationis 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).int(elapsed_time.total_seconds() * 1000)so the value reflects real elapsed milliseconds.qase-robotframeworkto6.0.1.Test plan
__parse_stepscovering 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).examples/single/robot/tests/simple.robot:duration=2281— rendered as 2.281 s (actual elapsed was 2.3 ms).duration=1(1 ms — matches actual elapsed).