Skip to main content
Glama

create_test_execution

Create a new test execution in Xray Cloud to run tests for a Jira project, including test cases and environments.

Instructions

Create a new test execution in Xray Cloud to run tests

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectKeyYesThe Jira project key (e.g., "PROJ")
summaryYesThe test execution summary/title
descriptionNoThe test execution description
testIssueIdsNoArray of test issue IDs to include in this execution (e.g., ["10001", "10002"])
testEnvironmentsNoArray of test environments (e.g., ["Chrome", "iOS"])

Implementation Reference

  • MCP server CallTool handler for 'create_test_execution': constructs TestExecution from params and calls XrayClient.createTestExecution
    case '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),
          },
        ],
      };
    }
  • Tool registration in tools list with input schema for parameter validation
    {
      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'],
      },
    },
  • Core XrayClient helper method implementing GraphQL mutation for creating test execution
    async 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
      };
    }
  • TypeScript interface defining input structure for createTestExecution
      summary: string;
      projectKey: string;
      testIssueIds?: string[];
      testEnvironments?: string[];
      description?: string;
    }
  • TypeScript interface for the response from createTestExecution
    export interface TestExecutionResponse {
      issueId: string;
      key: string;
      testRuns?: TestRun[];
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/c4m3lblue-star/xray-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server