WIKI EXECUTION HISTORY - sebiboga/testlink-upgraded GitHub Wiki

Execution History (modernized screen)

Issue #542

Modernized the Execution History view — previously still the legacy lib/execute/execHistory.php popup (Smarty + ExtJS grid) opened from the Test Case Viewer and the search screens.

Root cause / scope

Issue #542 is a backlog item: the Execution History was not covered by the tcView modernization. The modern screens (tcView.html, searchView.html, searchAdvancedView.html, searchQuickView.html) still linked to the legacy ExtJS popup.

Approach

  • New REST BFF endpoint api/execute/index.php (action=history), plain PHP, session auth, JSON I/O. It mirrors legacy access rules exactly:
    • reuses testcase::getExecutionSet() filtered by the test plans the current user can access (tlUser::getAccessibleTestPlans()), with the legacy onlyActiveTestPlans semantics ('active' => NULL when unchecked — passing false triggers an SQL syntax bug in tlUser, so NULL is mandatory);
    • localized execution status via lang_get('test_status_' . code_status) (same source as legacy localize_tc_status);
    • execution-level custom fields via get_linked_cfields_at_execution(), attachments via the attachment repository, bugs via get_bugs_for_exec() (with a graceful raw fallback when no issue tracker is configured);
    • per-test-plan exec_edit_notes grants drive the edit icon.
  • New standalone Dashio screen gui/templates/execute/execHistory.html: teal header with external id badge, filter panel (build/tester/status/date range client-side + only-active-plans server-side), plain Bootstrap table with colored status badges, expandable detail rows (notes, custom fields, attachments, bugs), print preview + edit-execution actions opening the existing legacy popups.
  • All four modern entry points repointed to the new screen; the legacy popup remains untouched for legacy templates.
  • i18n: 34 new exechist.* keys added to ALL 10 locale bundles.

Alternatives rejected

  • Keeping ExtJS panel lazy-notes loading (getExecNotes.php) — notes are already in the payload; direct display is simpler and read-only.
  • DataTables for the table — detail rows are first-class content here; a plain rendered table avoids row-pairing hacks.

Verification

Regression suite 35 in tmp/TLU_Test_Cases.md: 9/9 PASS (API both plan modes, screen render, filters, reset, never-executed warning, entry points, clean Event Viewer).


SCREEN-COMPARE parity verification (row 35, Refs #1138, 2026-09-07)

Full side-by-side check against legacy lib/execute/execHistory.php using a dedicated fixture (project EH Demo: 3 test cases — one with 2 versions, one never executed; 2 active + 1 inactive plan; open + closed builds; 2 platforms; 6 executions across statuses/testers; 1 deleted-tester execution; execution-level custom field EH_exec_result; 1 attachment).

Verdict: full parity, no distinct gaps — the modern screen is a functional superset. Both generations share testcase::getExecutionSet() (identical rows) and the getAccessibleTestPlans() + onlyActiveTestPlans filter semantics; the legacy exec_edit_notes grant still drives the edit icon. Browser-verified side by side (admin + role-3 no-rights user): platform-column gating, never-executed warning, deleted-tester handling, build/tester/status/ date filters, only-active-plans server call, print → execPrint.html, edit → editExecution.html (modern), expandable details panel with execution custom fields and attachments. i18n keys valid in all 10 bundles, zero console errors, Event Viewer clean.

Fixed this run: exechist.footer still said "Editing operations open the legacy screens" although the edit button opens the modernized editExecution.html — now "Use a row's edit button to update execution notes" in all 10 locale bundles.

Row focus (TC-EH-two, executions on Plan EH-A + Plan EH-B):

Execution History normal

Expandable details showing duration, execution notes and the execution custom field

Execution History details

Build filter applied (Build EH-1 → 1 execution)

Execution History filter

Never-executed test case warning

Execution History never executed

Role-3 no-rights user: same rows, no edit button

Execution History no-rights user

Cleanup DONE (Refs #1139): the legacy lib/execute/execHistory.php (302 redirect shim), gui/templates/dashio/execute/execHistory.tpl (dead Smarty popup) and lib/execute/getExecNotes.php (notes fragment shim) are deleted — every byte the notes shim returned came from api/execnotesreadonly, and no in-repo opener pointed at the legacy controller. The removed URLs now answer 404; the modern screen and its child popups are unaffected.

After the cleanup (Executions(3) + filters):

Execution History after cleanup

Details panel — execution notes served by the modern BFF:

Execution History details after cleanup