Repository navigation
Task Issue 916 TestSpec Add To Test Plan
Issue: #916 Status: IMPLEMENTED (2026-09-16)
Legacy Test Cases (lib/testcases/tcEdit.php:80 doAction=doAdd2testplan →
lib/testcases/testcaseCommands.class.php:476 doAdd2testplan, plus the
tcAssign2Tplan.php popup) let a user add a test case version to a Test
Plan directly from the test-case editor, choosing the target test plan; the
TC then appears in that plan's tree.
The modern testSpec.html editor dropped this capability: no add-to-test-plan
action and the modern BFF (api/testcases/index.php) had no such endpoint
(confirmed via git history — both landed in commit 8ff73e50c, 01:22Z).
-
doAdd2testplanreadsrequest['add2tplanid']=tplan_id → array(platform_id), buildsitem2link(tcversion,platform,items) and callstestplan::link_tcversions(tplan_id, item2link, user_id)per checked (plan, platform) pair. - Button visible only with
testplan_planningright + project having test plans. - Already-linked (plan, platform) pairs are read-only in the grid.
Backend api/testcases/index.php
-
GET ?action=add_plan_options(line 1598) — owning-project resolution,testplan_planninggate, tcversion identity, plan×platform grid viaaddToplanGrid()(line 1138, legacy decision logic port). -
POST ?action=add_to_plan(line 1921) —testplan_planninggate, tcversion-belonging validation, (plan, tcversion, platform) dedup,testplan::link_tcversionsper checked pair.
Frontend gui/templates/testcases/testSpec.html
-
Add to Test Plan action in the TC view panel (line 858), gated by
grants['testplan_planning']&&ctx.hasTestPlans. - Modal
#addToPlanModal(line 260): Ver. / Test Plans / Platform grid, per-pair checkboxes, already-linked rows checked+disabled with "(Already linked)", submit disabled until a free pair is picked. - JS
openAddToPlan/renderAddToPlanModal/submitAddToPlan(lines 458–539). - i18n
tspec.*keys in all 10 locale bundles.
Add to Test Plan button in the TC view panel:

Add to Test Plan modal with the (plan, platform) grid:

Fixtures via modern UI: project TP916, platforms Linux/Windows, plans Release 1.0/Release 2.0 (both platforms assigned), suite Login Suite, TC TC Login Valid (tcase 5, tcversion 6).
- Button visible on the TC panel.
- Modal lists 4 (plan, platform) pairs + identity
TP916-1:TC Login Valid. - Add Release 1.0 × Linux + Release 2.0 × Windows → toast
"Test case added to test plan(s) (2)";
testplan_tcversionsrows(2,6,1)and(3,6,2); auditaudit_tc_added_to_testplanfor both plans. - Reopen: linked pairs checked + disabled + "(Already linked)".
- Dedup proven: re-adding
(3,1)+(2,1)→added:1(duplicate skipped). - Plan tree:
planUpdateTC.htmlfor Release 1.0 shows suite → TC; plan management Test Cases: 1 for both plans. - Error paths 400/404 correct; no console errors; no new Event Viewer Error/Warning entries.
Test suite: Task — Issue #916 in tmp/TLU_Test_Cases.md.