Assign Requirements Spec Editor TcView - sebiboga/testlink-upgraded GitHub Wiki

Assign Requirements β€” Test Specification Editor + TC Viewer (Modernized)

Path: ASIDE β†’ Test Specification β†’ Test Specification + Test Case Viewer URLs: gui/templates/testcases/testSpec.html?tproject_id=<id>[&tcase_id=<id>] and gui/templates/testcases/tcView.html?tcase_id=<id> BFF API: api/requirements/index.php (share of the requirements router): GET /assign-reqspecs?tproject_id=N, GET /assign-reqs?req_spec_id=N&tcase_id=X, POST /assign-reqs {tcase_id, req_ids[]} (β†’ requirement_mgr::assign_to_tcase()), POST /unassign-reqs {link_ids[]} (β†’ delReqVersionTCVersionLinkByID()). Session auth, JSON I/O. Replaces: the legacy per-test-case "Assign Requirements" workflow (reqTcAssign.php?edit=testcase) for the modernized Test Specification editor and the TC Viewer (the Requirements-section bulk assignReqs.html screen is unchanged). Refs: #912.


What it does

Re-adds per-test-case requirement assignment to the modern screens.

  • Test Specification (testSpec.html) β€” an Assign Requirements button sits in the test-case action bar. It opens a modal:
    • Requirement Specification combo (GET /assign-reqspecs, dotted [RS-912] - name naming).
    • Free Requirements and Assigned Requirements two-list (the same data contract as legacy processTestCase()), with live counts and empty-state notices.
    • >> Assign links each selected free requirement's latest version to the test case's latest version; << Unassign removes coverage links by link id.
    • Toast feedback on success/failure (assignDone, unassignDone, assignFailed, unassignFailed, selectOneReq, selectOneLink, ...).
  • Test Case Viewer (tcView.html) β€” a toolbar Assign Requirements button (visible only on the latest version) opens the same modal. After each live assign/unassign the main Requirements section of the page refetches action=view and re-renders without a page reload.
  • Restore an assignment β†’ count pills and lists update live; the standalone assignReqs.html screen keeps working.

Visibility gating

Condition Behaviour
project option requirementsEnabled disabled button hidden (both screens)
missing grant req_tcase_link_management button hidden (both screens)
tcView on a non-latest version button hidden (links are version-agnostic latest→latest)

The option flags are served by api/testcases/index.php via tprojectOpt(), which tolerates both object and array shapes of the stored options blob (array blobs previously made requirementsEnabled silently false).

Screenshots

Test Specification β€” Assign Requirements modal

Test Case Viewer β€” Requirements section reflects live assignments

i18n

New keys in all 10 locale bundles (en/ro/de/es/fr/it/ja/pt/ru/zh): tspec.assignRequirements, tcview.assignRequirements. The modal reuses the reqAssign.* family. Footer buttons: tspec.cancel + rpt.close.

Test cases

Suite #912 in tmp/TLU_Test_Cases.md β€” 10/10 PASS (assign/unassign round-trip, empty states, tcView live refresh, gating, Event Viewer hygiene).