create-test-case
Add new test cases to QA Studio projects by specifying title, description, priority, type, automation status, and test steps for comprehensive test management.
Instructions
Create a new test case in a project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | The project ID | |
| title | Yes | Title of the test case | |
| description | No | Detailed description of the test case | |
| priority | No | Priority level | |
| type | No | Test type | |
| automationStatus | No | Automation status | |
| steps | No | Test steps |
Implementation Reference
- src/index.ts:302-333 (handler)Handler function that implements the 'create-test-case' tool logic. It destructures args to separate projectId and test case data, sends a POST request to the API endpoint `/projects/${projectId}/test-cases`, and returns a formatted success message with the created test case details or an error message.async (args) => { try { const { projectId, ...testCaseData } = args; const data = await apiRequest(`/projects/${projectId}/test-cases`, { method: 'POST', body: JSON.stringify(testCaseData) }); return { content: [ { type: 'text' as const, text: `✅ Test case created successfully!\n\nID: ${data.id}\nTitle: ${data.title}\nPriority: ${data.priority}\nType: ${data.type}` } ] }; } catch (error) { return { content: [ { type: 'text' as const, text: `Error: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } } ); // Register tool: submit-test-results
- src/index.ts:267-300 (schema)Input schema using Zod for validating the parameters required to create a test case, including projectId, title, optional fields like description, priority, type, automationStatus, and steps array.projectId: z.string().describe('The project ID'), title: z.string().describe('Title of the test case'), description: z.string().optional().describe('Detailed description of the test case'), priority: z.enum(['CRITICAL', 'HIGH', 'MEDIUM', 'LOW']).optional().describe('Priority level'), type: z .enum([ 'FUNCTIONAL', 'REGRESSION', 'SMOKE', 'INTEGRATION', 'PERFORMANCE', 'SECURITY', 'UI', 'API', 'UNIT', 'E2E' ]) .optional() .describe('Test type'), automationStatus: z .enum(['AUTOMATED', 'NOT_AUTOMATED', 'CANDIDATE']) .optional() .describe('Automation status'), steps: z .array( z.object({ order: z.number(), action: z.string(), expectedResult: z.string().optional() }) ) .optional() .describe('Test steps') }
- src/index.ts:262-334 (registration)Registration of the 'create-test-case' tool with the MCP server, specifying the tool name, description, input schema, and handler function.server.registerTool( 'create-test-case', { description: 'Create a new test case in a project', inputSchema: { projectId: z.string().describe('The project ID'), title: z.string().describe('Title of the test case'), description: z.string().optional().describe('Detailed description of the test case'), priority: z.enum(['CRITICAL', 'HIGH', 'MEDIUM', 'LOW']).optional().describe('Priority level'), type: z .enum([ 'FUNCTIONAL', 'REGRESSION', 'SMOKE', 'INTEGRATION', 'PERFORMANCE', 'SECURITY', 'UI', 'API', 'UNIT', 'E2E' ]) .optional() .describe('Test type'), automationStatus: z .enum(['AUTOMATED', 'NOT_AUTOMATED', 'CANDIDATE']) .optional() .describe('Automation status'), steps: z .array( z.object({ order: z.number(), action: z.string(), expectedResult: z.string().optional() }) ) .optional() .describe('Test steps') } }, async (args) => { try { const { projectId, ...testCaseData } = args; const data = await apiRequest(`/projects/${projectId}/test-cases`, { method: 'POST', body: JSON.stringify(testCaseData) }); return { content: [ { type: 'text' as const, text: `✅ Test case created successfully!\n\nID: ${data.id}\nTitle: ${data.title}\nPriority: ${data.priority}\nType: ${data.type}` } ] }; } catch (error) { return { content: [ { type: 'text' as const, text: `Error: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } } ); // Register tool: submit-test-results server.registerTool(