create-test-case
Define a new test case in a QA Studio project by specifying title, description, priority, type, automation status, and step instructions. Simplify test case creation using natural language.
Instructions
Create a new test case in a project
Input 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:261-331 (registration)Registration of the 'create-test-case' tool via server.registerTool with name 'create-test-case'
// Register tool: create-test-case 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 }; } } ); - src/index.ts:264-300 (schema)Input schema definition using Zod: requires projectId (string), title (string), with optional description, priority (enum CRITICAL/HIGH/MEDIUM/LOW), type (enum of test types), automationStatus (enum), and steps (array of {order, action, expectedResult})
{ 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') } - src/index.ts:302-331 (handler)Handler function that destructures projectId from args, sends POST to /projects/{projectId}/test-cases API with remaining test case data, and returns success/error response
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 }; } } ); - src/index.ts:17-34 (helper)Helper function apiRequest that makes authenticated API calls using fetch with X-API-Key header and JSON parsing
async function apiRequest(endpoint: string, options: RequestInit = {}): Promise<any> { const url = `${API_URL}${endpoint}`; const response = await fetch(url, { ...options, headers: { 'Content-Type': 'application/json', 'X-API-Key': API_KEY, ...options.headers } }); if (!response.ok) { const error = await response.text(); throw new Error(`API Error (${response.status}): ${error}`); } return response.json(); }