Skip to content

fix: start the Robot Framework run once and key tests by id - #523

Merged
gibiw merged 3 commits into
mainfrom
fix/robot-suite-lifecycle
Nov 2, 2026
Merged

gibiw merged 3 commits into
mainfrom
fix/robot-suite-lifecycle

Conversation

@gibiw

@gibiw gibiw commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Results lost in report mode. Robot Framework calls start_suite for every suite in the hierarchy, and the listener called reporter.start_run() each time. In report mode that rmtrees the results directory, so running robot tests/ with a/one.robot + b/two.robot lost suite A's results. In testops mode it was an extra check_test_run call per suite. The run is now started, filtered by the execution plan and registered only for the root suite.
  • Wrong suite for same name+line in different files. Suite paths were keyed by f"{test.name}:{test.lineno}", so Login on line 2 of auth/login.robot and of billing/login.robot collided: one got the other's suite and signature. Keyed by test.id (s1-s2-t1) now.
  • pabot hang. Processes other than #0 waited for src.run in while True with no sleep and no timeout, spinning at 100% CPU forever if process #0 failed to create the run. They now poll every 0.5s for up to 5 minutes, then log an error.
  • Suite setup/teardown keywords. end_user_keyword with qase.params/qase.fields raised AttributeError before the first test and modified the previous, already-reported test's result in a suite teardown. It now only applies inside a test. runtime.result is deliberately not reset, so qase.attach in a suite teardown keeps working as before.

Bumps qase-robotframework to 7.0.1.

Test plan

  • New test_listener_lifecycle.py, including an end-to-end robot run in report mode with two suites that each have Login on the same line. 5 of 6 new tests fail on the old code and all pass after.
  • Full qase-robotframework suite: 65 passed.
  • Real Qase project, testops mode, Robot Framework 7.5 (two suites, same-name tests, a failing test, Suite Setup/Teardown keyword with qase.fields):
    • robot: one run with 4 results (3 passed, 1 failed). The two Login cases landed in Tests/Auth/Login and Tests/Billing/Login. The suite keyword's field did not leak into any test.
    • pabot --processes 2: one shared run with the same 4 results, matched to the same cases. Finished in about 10s with no hang.
  • Integration fixture integration/robot/expected/robot-examples.yaml extended from 4 to 15 tests. The old one only described the last suite (Steps) because the earlier suites' results were being wiped — the same bug. The 4 existing entries are unchanged, and reporters-validator passes locally.

gibiw added 3 commits October 30, 2026 19:11
start_suite runs for every suite in the hierarchy and started the run each
time; in report mode that wiped the results of the suites that had already
run. The run is now started, filtered and registered only for the root suite.

Tests were matched to their suite path by name and line number, which is
not unique across files, so a test could be reported under another file's
suite. They are now keyed by the Robot Framework test id.

pabot processes waited for the run id in a busy loop with no timeout and
hung when the first process failed to create the run; they now poll with a
timeout. Keywords tagged with qase.params or qase.fields that run in a suite
setup or teardown no longer touch the previous test's result.
The expected report listed only the four tests of the last suite, Steps,
because the listener restarted the run for each suite and report mode wiped
the results of the suites before it. With the run started once, all 15 tests
of integration/robot/tests are in the report. The existing four entries are
unchanged.
@gibiw
gibiw merged commit dc454cc into main Nov 2, 2026
40 checks passed
@gibiw
gibiw deleted the fix/robot-suite-lifecycle branch November 2, 2026 07:17
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.

2 participants