create_test_execution
Create a new test execution in Xray Cloud to run tests, specifying project key, summary, test cases, and environments for test management and tracking.
Instructions
Create a new test execution in Xray Cloud to run tests
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | The test execution description | |
| projectKey | Yes | The Jira project key (e.g., "PROJ") | |
| summary | Yes | The test execution summary/title | |
| testEnvironments | No | Array of test environments (e.g., ["Chrome", "iOS"]) | |
| testIssueIds | No | Array of test issue IDs to include in this execution (e.g., ["10001", "10002"]) |
Implementation Reference
- src/index.ts:627-645 (handler)MCP tool handler for 'create_test_execution': parses arguments, constructs TestExecution, calls xrayClient.createTestExecution, and returns JSON responsecase 'create_test_execution': { const testExecution: TestExecution = { projectKey: args.projectKey as string, summary: args.summary as string, description: args.description as string | undefined, testIssueIds: args.testIssueIds as string[] | undefined, testEnvironments: args.testEnvironments as string[] | undefined, }; const result = await xrayClient.createTestExecution(testExecution); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:164-195 (schema)Tool schema definition and registration in the tools list, including inputSchema for create_test_execution{ name: 'create_test_execution', description: 'Create a new test execution in Xray Cloud to run tests', inputSchema: { type: 'object', properties: { projectKey: { type: 'string', description: 'The Jira project key (e.g., "PROJ")', }, summary: { type: 'string', description: 'The test execution summary/title', }, description: { type: 'string', description: 'The test execution description', }, testIssueIds: { type: 'array', items: { type: 'string' }, description: 'Array of test issue IDs to include in this execution (e.g., ["10001", "10002"])', }, testEnvironments: { type: 'array', items: { type: 'string' }, description: 'Array of test environments (e.g., ["Chrome", "iOS"])', }, }, required: ['projectKey', 'summary'], }, },
- src/xray-client.ts:401-462 (handler)Core XrayClient implementation of createTestExecution: builds GraphQL mutation to create test execution issue with test issues and environments, returns TestExecutionResponseasync createTestExecution(testExecution: TestExecution): Promise<TestExecutionResponse> { const mutation = ` mutation CreateTestExecution($jira: JSON!, $testIssueIds: [String], $testEnvironments: [String]) { createTestExecution(jira: $jira, testIssueIds: $testIssueIds, testEnvironments: $testEnvironments) { testExecution { issueId jira(fields: ["key", "summary"]) testRuns(limit: 100) { results { id status { name description } test { issueId jira(fields: ["key", "summary"]) } } } } warnings } } `; const jiraFields: any = { fields: { project: { key: testExecution.projectKey }, summary: testExecution.summary, issuetype: { name: 'Test Execution' } } }; if (testExecution.description) { jiraFields.fields.description = testExecution.description; } const variables: any = { jira: jiraFields }; if (testExecution.testIssueIds && testExecution.testIssueIds.length > 0) { variables.testIssueIds = testExecution.testIssueIds; } if (testExecution.testEnvironments && testExecution.testEnvironments.length > 0) { variables.testEnvironments = testExecution.testEnvironments; } const result = await this.graphqlRequest<{ createTestExecution: any }>(mutation, variables); return { issueId: result.createTestExecution.testExecution.issueId, key: result.createTestExecution.testExecution.jira.key, testRuns: result.createTestExecution.testExecution.testRuns.results }; }