add-test-cases
Add test cases as test runs into a qTest Test Execution suite within a test cycle for streamlined execution management.
Instructions
Test Execution — add test cases as test runs into a qTest Test Execution suite (inside a test cycle)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | ||
| suiteId | Yes | ID of the test execution suite to add runs into | |
| testCases | Yes | Test cases to add as test runs |
Implementation Reference
- Core handler that executes the tool logic: loops over test cases and POSTs each as a test run to qTest, counting successes.
export async function addTestCases(args: AddTestCasesArgs): Promise<AddTestCasesResult> { const { projectId, suiteId, testCases } = args let added = 0 for (const tc of testCases) { try { await qtestFetch( config, projectId, `/test-runs?parentId=${suiteId}&parentType=test-suite`, 'POST', { name: tc.name, test_case: { id: tc.id } } ) added++ } catch { // continue on individual failure — count only successes } } return { added } } - Input type (AddTestCasesArgs) and output type (AddTestCasesResult) definitions.
export interface AddTestCasesArgs { projectId: string suiteId: number testCases: Array<{ id: number; name: string }> } export interface AddTestCasesResult { added: number } - src/server.ts:98-118 (registration)Registration of the 'add-test-cases' tool on the MCP server with description, inputSchema (Zod), and handler callback.
server.registerTool( 'add-test-cases', { description: 'Test Execution — add test cases as test runs into a qTest Test Execution suite (inside a test cycle)', inputSchema: { projectId: z.string(), suiteId: z .number() .int() .describe('ID of the test execution suite to add runs into'), testCases: z .array(z.object({ id: z.number().int(), name: z.string() })) .describe('Test cases to add as test runs'), }, }, async ({ projectId, suiteId, testCases }) => { const result = await addTestCases({ projectId, suiteId, testCases }) return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }] } } ) - Imports for config and qtestFetch helper used in the handler.
import { config } from '@/config.js'