execute_test
Update test execution results in JIRA Zephyr by specifying status, adding comments, and linking defects to track testing progress.
Instructions
Update test execution results
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"executionId": "<executionId>",
"status": "<status>"
},
"name": "execute_test"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| executionId | Yes | Test execution ID | |
| status | Yes | Execution status | |
| comment | No | Execution comment (optional) | |
| defects | No | Linked defect keys (optional) |
Implementation Reference
- src/tools/test-execution.ts:22-56 (handler)Main handler function that validates input and calls ZephyrClient to update test execution status, returning success/error with execution details.
export const executeTest = async (input: ExecuteTestInput) => { const validatedInput = executeTestSchema.parse(input); try { const execution = await getZephyrClient().updateTestExecution({ executionId: validatedInput.executionId, status: validatedInput.status, comment: validatedInput.comment, defects: validatedInput.defects, }); return { success: true, data: { id: execution.id, key: execution.key, cycleId: execution.cycleId, testCaseId: execution.testCaseId, status: execution.status, comment: execution.comment, executedOn: execution.executedOn, executedBy: execution.executedBy?.displayName, defects: execution.defects.map(defect => ({ key: defect.key, summary: defect.summary, })), }, }; } catch (error: any) { return { success: false, error: error.response?.data?.message || error.message, }; } }; - src/utils/validation.ts:38-43 (schema)Zod schema defining the input structure and validation for execute_test tool.
export const executeTestSchema = z.object({ executionId: z.string().min(1, 'Execution ID is required'), status: z.enum(['PASS', 'FAIL', 'WIP', 'BLOCKED']), comment: z.string().optional(), defects: z.array(z.string()).optional(), }); - src/index.ts:135-147 (registration)Tool registration in the TOOLS array, including name, description, and MCP inputSchema.
name: 'execute_test', description: 'Update test execution results', inputSchema: { type: 'object', properties: { executionId: { type: 'string', description: 'Test execution ID' }, status: { type: 'string', enum: ['PASS', 'FAIL', 'WIP', 'BLOCKED'], description: 'Execution status' }, comment: { type: 'string', description: 'Execution comment (optional)' }, defects: { type: 'array', items: { type: 'string' }, description: 'Linked defect keys (optional)' }, }, required: ['executionId', 'status'], }, }, - src/index.ts:389-399 (registration)MCP callToolRequest handler switch case that validates arguments using executeTestSchema and invokes the executeTest handler.
case 'execute_test': { const validatedArgs = validateInput<ExecuteTestInput>(executeTestSchema, args, 'execute_test'); return { content: [ { type: 'text', text: JSON.stringify(await executeTest(validatedArgs), null, 2), }, ], }; } - src/utils/validation.ts:103-103 (schema)TypeScript type inferred from executeTestSchema for type-safe input handling.
export type ExecuteTestInput = z.infer<typeof executeTestSchema>;