create_test_cycle
Create a new test execution cycle in JIRA Zephyr to organize and track testing activities for specific project versions.
Instructions
Create a new test execution cycle
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Test cycle name | |
| description | No | Test cycle description (optional) | |
| projectKey | Yes | JIRA project key | |
| versionId | Yes | JIRA version ID | |
| environment | No | Test environment (optional) | |
| startDate | No | Planned start date (ISO format, optional) | |
| endDate | No | Planned end date (ISO format, optional) |
Implementation Reference
- src/tools/test-cycles.ts:18-55 (handler)The main handler function for the create_test_cycle tool. Validates input using Zod schema, calls ZephyrClient.createTestCycle, formats response or error.export const createTestCycle = async (input: CreateTestCycleInput) => { const validatedInput = createTestCycleSchema.parse(input); try { const testCycle = await getZephyrClient().createTestCycle({ name: validatedInput.name, description: validatedInput.description, projectKey: validatedInput.projectKey, versionId: validatedInput.versionId, environment: validatedInput.environment, startDate: validatedInput.startDate, endDate: validatedInput.endDate, }); return { success: true, data: { id: testCycle.id, key: testCycle.key, name: testCycle.name, description: testCycle.description, projectId: testCycle.projectId, versionId: testCycle.versionId, environment: testCycle.environment, status: testCycle.status, plannedStartDate: testCycle.plannedStartDate, plannedEndDate: testCycle.plannedEndDate, createdOn: testCycle.createdOn, executionSummary: testCycle.executionSummary, }, }; } catch (error: any) { return { success: false, error: error.response?.data?.message || error.message, }; } };
- src/utils/validation.ts:11-19 (schema)Zod schema defining the input validation for create_test_cycle tool, including required fields like name, projectKey, versionId.export const createTestCycleSchema = z.object({ name: z.string().min(1, 'Name is required'), description: z.string().optional(), projectKey: z.string().min(1, 'Project key is required'), versionId: z.string().min(1, 'Version ID is required'), environment: z.string().optional(), startDate: z.string().optional(), endDate: z.string().optional(), });
- src/index.ts:105-120 (registration)Registration of the create_test_cycle tool in the MCP server's TOOLS array, specifying name, description, and input schema.name: 'create_test_cycle', description: 'Create a new test execution cycle', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Test cycle name' }, description: { type: 'string', description: 'Test cycle description (optional)' }, projectKey: { type: 'string', description: 'JIRA project key' }, versionId: { type: 'string', description: 'JIRA version ID' }, environment: { type: 'string', description: 'Test environment (optional)' }, startDate: { type: 'string', description: 'Planned start date (ISO format, optional)' }, endDate: { type: 'string', description: 'Planned end date (ISO format, optional)' }, }, required: ['name', 'projectKey', 'versionId'], }, },
- src/index.ts:365-375 (registration)Dispatch handler in CallToolRequestSchema that validates args and invokes createTestCycle for the create_test_cycle tool.case 'create_test_cycle': { const validatedArgs = validateInput<CreateTestCycleInput>(createTestCycleSchema, args, 'create_test_cycle'); return { content: [ { type: 'text', text: JSON.stringify(await createTestCycle(validatedArgs), null, 2), }, ], }; }
- src/clients/zephyr-client.ts:59-80 (helper)ZephyrClient helper method that makes the actual API POST request to create a test cycle in Zephyr Scale.async createTestCycle(data: { name: string; description?: string; projectKey: string; versionId: string; environment?: string; startDate?: string; endDate?: string; }): Promise<ZephyrTestCycle> { const payload = { name: data.name, description: data.description, projectKey: data.projectKey, versionId: data.versionId, environment: data.environment, plannedStartDate: data.startDate, plannedEndDate: data.endDate, }; const response = await this.client.post('/testcycles', payload); return response.data; }