Skip to content

QFJV-17669: [QTM4J] Add an optional folder parameter to test case and test cycle creation tools. - #721

Merged
jaydeep-kumbhani-sb merged 3 commits into
mainfrom
QTM4J_QFJV-17669
Sep 28, 2026
Merged

jaydeep-kumbhani-sb merged 3 commits into
mainfrom
QTM4J_QFJV-17669

Conversation

@Vivek-Zadafiya

@Vivek-Zadafiya Vivek-Zadafiya commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • [QTM4J] Feature: create_test_case and create_test_cycle now accept an optional numeric folderId. When provided, the ID is passed directly to the API and folder resolution is skipped. When omitted, the tool defaults to the MCP Generated folder automatically.
  • [QTM4J] Bug fix: search_test_cases filter field was incorrectly named folders (array of numbers). The backend API expects folderId (singular Long). Corrected to folderId: number matching the TestCaseFilterRequest contract.

Changes

Source

  • src/qtm4j/config/constants.ts — added DEFAULT_FOLDER_NAMES.MCP_GENERATED constant ("MCP Generated")
  • src/qtm4j/schema/test-case.schema.ts — added folderId: number.int().positive().optional() to CreateTestCaseBody
  • src/qtm4j/schema/test-cycle.schema.ts — added folderId: number.int().positive().optional() to CreateTestCycleBody
  • src/qtm4j/tool/test-case/create-test-case.ts — activeFieldConfig pattern: skips folder resolver when user supplies numeric folderId; injects MCP Generated default otherwise
  • src/qtm4j/tool/test-cycle/create-test-cycle.ts — same pattern as test-case
  • src/qtm4j/schema/get-test-case.schema.ts — renamed folders: array(number) → folderId: number.int().positive() in SearchTestCaseFilter
  • src/qtm4j/tool/test-case/get-test-cases.ts — updated example to use folderId: 123

Tests

  • src/qtm4j/tool/test-case/create-test-case.test.ts — 3 new tests: numeric folderId passthrough, default injection, rejection of non-positive value; fixed off-by-one in resolver call count assertion
  • src/qtm4j/tool/test-cycle/create-test-cycle.test.ts — 3 new tests: same coverage
  • src/qtm4j/tool/test-case/get-test-cases.test.ts — 2 new tests: folderId filter passthrough, rejection of folderId: 0
  • src/common/__snapshots__/server-definitions.test.ts.snap — updated for schema changes

Documentation

  • docs/products/SmartBear MCP Server/qtm4j-integration.md — updated Search Test Cases (folderId filter), Create Test Case (added folderId param), Create Test Cycle (added folderId param, removed stale "MCP Generated automatically" note)
  • CHANGELOG.md — added entries under Unreleased

Test plan

  • All 918 QTM4J unit tests pass (npx vitest run src/qtm4j)
  • create_test_case with folderId omitted → test case created in MCP Generated folder
  • create_test_case with numeric folderId → test case created in specified folder, no folder resolution warning
  • create_test_cycle with folderId omitted → cycle created in MCP Generated folder
  • create_test_cycle with numeric folderId → cycle created in specified folder
  • search_test_cases with folderId: <id> in filter → returns only test cases in that folder
  • search_test_cases with folderId: 0 or negative → Zod validation error before API call

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Coverage Target Met!

📈 Coverage Metrics

Metric Coverage Target Status
Lines 94.3% 75% ✅
Functions 93.1% 75% ✅
Branches 89.2% 80% ✅
Statements 94.3% 75% ✅

📊 Test Statistics

  • Total Lines: 45,278 / 48,023
  • Total Functions: 866 / 930
  • Total Branches: 2867 / 3214
  • Total Statements: 45278 / 48023

🔍 Files Needing Coverage

File Coverage
docs/scripts/publish-portal-content.ts 0.0%
docs/scripts/validate-manifests.ts 0.0%
src/qmetry/client/testsuite.ts 9.2%
src/qmetry/client/issues.ts 28.0%
src/qmetry/client/date-utils.ts 43.6%

📝 Report generated on Node.js v24.19.0 • View workflow • Coverage by Vitest + v8

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved blocking issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Adds optional folderId support for QTM4J test case/cycle creation and corrects test-case folder filtering.

Changes:

  • Supports explicit folder IDs with MCP Generated as the default.
  • Corrects the search filter to use singular folderId.
  • Updates schemas, tests, snapshots, documentation, and changelog.
File Description
src/​qtm4j/​tool/​test-cycle/​create-test-cycle.ts Handles explicit and default folders.
src/​qtm4j/​tool/​test-cycle/​create-test-cycle.test.ts Tests folder behavior and validation.
src/​qtm4j/​tool/​test-case/​get-test-cases.ts Updates the folder-filter example.
src/​qtm4j/​tool/​test-case/​get-test-cases.test.ts Tests folder filtering.
src/​qtm4j/​tool/​test-case/​create-test-case.ts Handles explicit and default folders.
src/​qtm4j/​tool/​test-case/​create-test-case.test.ts Tests folder behavior and validation.
src/​qtm4j/​schema/​test-cycle.schema.ts Validates optional folder IDs.
src/​qtm4j/​schema/​test-case.schema.ts Validates optional folder IDs.
src/​qtm4j/​schema/​get-test-case.schema.ts Corrects the folder filter field.
src/​qtm4j/​config/​constants.ts Adds the default folder constant.
src/​common/​__snapshots__/​server-definitions.test.ts.snap Updates generated definitions.
docs/​products/​SmartBear MCP Server/​qtm4j-integration.md Documents folder parameters.
CHANGELOG.md Records the feature and bug fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Vivek-Zadafiya
Vivek-Zadafiya marked this pull request as ready for review September 25, 2026 11:06
@Vivek-Zadafiya
Vivek-Zadafiya requested review from a team as code owners September 25, 2026 11:06

@jaydeep-kumbhani-sb jaydeep-kumbhani-sb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

@jaydeep-kumbhani-sb
jaydeep-kumbhani-sb merged commit 1dd8f31 into main Sep 28, 2026
49 checks passed
@jaydeep-kumbhani-sb
jaydeep-kumbhani-sb deleted the QTM4J_QFJV-17669 branch September 28, 2026 13:26
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.

3 participants