get_project_test_cases
Retrieve all test cases for a Jira project to manage testing workflows and track test coverage in Xray Cloud.
Instructions
Get all test cases for a specific project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectKey | Yes | The Jira project key (e.g., "PROJ") | |
| maxResults | No | Maximum number of results to return |
Implementation Reference
- src/index.ts:144-162 (registration)Registration of the 'get_project_test_cases' tool including its name, description, and input schema definition.{ name: 'get_project_test_cases', description: 'Get all test cases for a specific project', inputSchema: { type: 'object', properties: { projectKey: { type: 'string', description: 'The Jira project key (e.g., "PROJ")', }, maxResults: { type: 'number', description: 'Maximum number of results to return', default: 50, }, }, required: ['projectKey'], }, },
- src/index.ts:611-624 (handler)The handler logic for executing the 'get_project_test_cases' tool, which extracts arguments and calls the XrayClient.getTestCasesByProject method, returning the JSON-formatted result.case 'get_project_test_cases': { const result = await xrayClient.getTestCasesByProject( args.projectKey as string, args.maxResults as number | undefined ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/xray-client.ts:357-360 (helper)Helper method in XrayClient that constructs JQL for project test cases and delegates to searchTestCases.async getTestCasesByProject(projectKey: string, maxResults: number = 50): Promise<any> { const jql = `project = '${projectKey}'`; return this.searchTestCases(jql, maxResults); }
- src/xray-client.ts:365-392 (helper)Core helper method that executes GraphQL query to search and retrieve test cases using JQL, providing detailed test case information.async searchTestCases(jql: string, maxResults: number = 50): Promise<any> { const query = ` query SearchTests($jql: String!, $limit: Int!) { getTests(jql: $jql, limit: $limit) { total start limit results { issueId projectId jira(fields: ["key", "summary", "description", "priority", "status", "labels"]) testType { name kind } } } } `; const variables = { jql, limit: maxResults }; const result = await this.graphqlRequest<{ getTests: any }>(query, variables); return result.getTests; }