Skip to content

feat(testmanagement): template selection + multi-select custom fields#319

Merged
gaurav-singh-9227 merged 1 commit into
mainfrom
feat/testcase-template-multiselect
Jun 15, 2026
Merged

feat(testmanagement): template selection + multi-select custom fields#319
gaurav-singh-9227 merged 1 commit into
mainfrom
feat/testcase-template-multiselect

Conversation

@gaurav-singh-9227

Copy link
Copy Markdown
Collaborator

What & why

Closes a customer blocker in the Test Management createTestCase/updateTestCase tools. Two gaps:

  1. No template selection — every test case was created with the default "Test Case Steps" template; no way to pick a custom template.
  2. custom_fields couldn't hold multiple values — the Zod schema restricted values to string | number | boolean, blocking arrays, so multi-select custom fields couldn't be set programmatically.

How the contract was determined

I probed the live TM v2 API (a project with real custom fields incl. a field_multi_dropdown) before writing code:

  • Template → API keys on the internal slug. Sending test_case_bdd was recognized (HTTP 422 "Scenario is required for BDD test cases"). A display name ("Test Case BDD") was silently ignored and fell back to test_case_steps. form-fields-v2 does not enumerate templates and there's no template-list endpoint, so resolving display→slug server-side isn't possible. Pass-through of the slug is the only viable approach.
  • Unrecognized template values fail silently (HTTP 200, falls back to default) — so we now warn when the returned template differs from the requested one.
  • template is create-only. The PATCH/update endpoint ignores it (even a valid slug didn't switch the template), so template is intentionally not added to updateTestCase.
  • Multi-select works on create and update when keyed by field name with an array: { "Field Name": ["opt1","opt2"] }. Keying by field id or a CSV string is silently dropped.

Changes

  • create-testcase.ts: optional template param (slug, pass-through) + a mismatch warning when the API silently falls back; custom_fields widened to accept arrays (multi-select). New exported CustomFieldValue type + customFieldValueSchema.
  • update-testcase.ts: custom_fields widened to accept arrays. No template (API ignores it on update).
  • testmanagement.test.ts: +4 tests — slug pass-through, the silent-fallback warning, and array custom_fields on both create and update. (apiClient mock gained patch.)

Testing

npm run build passes locally — lint, format, 186 tests (4 new), and tsc all green.

Known limitation

Switching an existing test case's template via updateTestCase is not supported by the TM API — it ignores the template field on PATCH. Template can only be set at creation; supporting post-creation switching would need a TM backend change.

🤖 Generated with Claude Code

…tom fields

createTestCase gains an optional `template` (internal slug, e.g. test_case_steps
or test_case_bdd) passed through to the TM v2 create endpoint, with a warning when
the API silently falls back to the default for an unrecognized value. Display names
are not accepted and the form-fields endpoint does not enumerate templates, so slug
pass-through is the only viable approach. template is create-only -- the PATCH/update
endpoint ignores it -- so it is not added to updateTestCase.

custom_fields on both create and update now accept array values, enabling
multi-select custom fields (keyed by field name).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gaurav-singh-9227 gaurav-singh-9227 merged commit 8b45669 into main Jun 15, 2026
5 checks passed
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