QFJV-17669: [QTM4J] Add an optional folder parameter to test case and test cycle creation tools. - #721
Merged
Conversation
… update schema, tests, and documentation
Contributor
🎯 Coverage Target Met!📈 Coverage Metrics
📊 Test Statistics
🔍 Files Needing Coverage
📝 Report generated on Node.js v24.19.0 • View workflow • Coverage by Vitest + v8 |
Contributor
There was a problem hiding this comment.
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 Generatedas 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
create_test_caseandcreate_test_cyclenow accept an optional numericfolderId. When provided, the ID is passed directly to the API and folder resolution is skipped. When omitted, the tool defaults to theMCP Generatedfolder automatically.search_test_casesfilter field was incorrectly namedfolders(array of numbers). The backend API expectsfolderId(singularLong). Corrected tofolderId: numbermatching theTestCaseFilterRequestcontract.Changes
Source
src/qtm4j/config/constants.ts— addedDEFAULT_FOLDER_NAMES.MCP_GENERATEDconstant ("MCP Generated")src/qtm4j/schema/test-case.schema.ts— addedfolderId: number.int().positive().optional()toCreateTestCaseBodysrc/qtm4j/schema/test-cycle.schema.ts— addedfolderId: number.int().positive().optional()toCreateTestCycleBodysrc/qtm4j/tool/test-case/create-test-case.ts—activeFieldConfigpattern: skips folder resolver when user supplies numericfolderId; injectsMCP Generateddefault otherwisesrc/qtm4j/tool/test-cycle/create-test-cycle.ts— same pattern as test-casesrc/qtm4j/schema/get-test-case.schema.ts— renamedfolders: array(number)→folderId: number.int().positive()inSearchTestCaseFiltersrc/qtm4j/tool/test-case/get-test-cases.ts— updated example to usefolderId: 123Tests
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 assertionsrc/qtm4j/tool/test-cycle/create-test-cycle.test.ts— 3 new tests: same coveragesrc/qtm4j/tool/test-case/get-test-cases.test.ts— 2 new tests:folderIdfilter passthrough, rejection offolderId: 0src/common/__snapshots__/server-definitions.test.ts.snap— updated for schema changesDocumentation
docs/products/SmartBear MCP Server/qtm4j-integration.md— updated Search Test Cases (folderIdfilter), Create Test Case (addedfolderIdparam), Create Test Cycle (addedfolderIdparam, removed stale "MCP Generated automatically" note)CHANGELOG.md— added entries underUnreleasedTest plan
npx vitest run src/qtm4j)create_test_casewithfolderIdomitted → test case created inMCP Generatedfoldercreate_test_casewith numericfolderId→ test case created in specified folder, no folder resolution warningcreate_test_cyclewithfolderIdomitted → cycle created inMCP Generatedfoldercreate_test_cyclewith numericfolderId→ cycle created in specified foldersearch_test_caseswithfolderId: <id>in filter → returns only test cases in that foldersearch_test_caseswithfolderId: 0or negative → Zod validation error before API call