Skip to main content
Glama

create-test-case

Add new test cases to QA Studio projects by specifying title, description, priority, type, automation status, and test steps for comprehensive test management.

Instructions

Create a new test case in a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesThe project ID
titleYesTitle of the test case
descriptionNoDetailed description of the test case
priorityNoPriority level
typeNoTest type
automationStatusNoAutomation status
stepsNoTest steps

Implementation Reference

  • Handler function that implements the 'create-test-case' tool logic. It destructures args to separate projectId and test case data, sends a POST request to the API endpoint `/projects/${projectId}/test-cases`, and returns a formatted success message with the created test case details or an error message.
      async (args) => {
        try {
          const { projectId, ...testCaseData } = args;
    
          const data = await apiRequest(`/projects/${projectId}/test-cases`, {
            method: 'POST',
            body: JSON.stringify(testCaseData)
          });
    
          return {
            content: [
              {
                type: 'text' as const,
                text: `✅ Test case created successfully!\n\nID: ${data.id}\nTitle: ${data.title}\nPriority: ${data.priority}\nType: ${data.type}`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text' as const,
                text: `Error: ${error instanceof Error ? error.message : String(error)}`
              }
            ],
            isError: true
          };
        }
      }
    );
    
    // Register tool: submit-test-results
  • Input schema using Zod for validating the parameters required to create a test case, including projectId, title, optional fields like description, priority, type, automationStatus, and steps array.
      projectId: z.string().describe('The project ID'),
      title: z.string().describe('Title of the test case'),
      description: z.string().optional().describe('Detailed description of the test case'),
      priority: z.enum(['CRITICAL', 'HIGH', 'MEDIUM', 'LOW']).optional().describe('Priority level'),
      type: z
        .enum([
          'FUNCTIONAL',
          'REGRESSION',
          'SMOKE',
          'INTEGRATION',
          'PERFORMANCE',
          'SECURITY',
          'UI',
          'API',
          'UNIT',
          'E2E'
        ])
        .optional()
        .describe('Test type'),
      automationStatus: z
        .enum(['AUTOMATED', 'NOT_AUTOMATED', 'CANDIDATE'])
        .optional()
        .describe('Automation status'),
      steps: z
        .array(
          z.object({
            order: z.number(),
            action: z.string(),
            expectedResult: z.string().optional()
          })
        )
        .optional()
        .describe('Test steps')
    }
  • src/index.ts:262-334 (registration)
    Registration of the 'create-test-case' tool with the MCP server, specifying the tool name, description, input schema, and handler function.
    server.registerTool(
      'create-test-case',
      {
        description: 'Create a new test case in a project',
        inputSchema: {
          projectId: z.string().describe('The project ID'),
          title: z.string().describe('Title of the test case'),
          description: z.string().optional().describe('Detailed description of the test case'),
          priority: z.enum(['CRITICAL', 'HIGH', 'MEDIUM', 'LOW']).optional().describe('Priority level'),
          type: z
            .enum([
              'FUNCTIONAL',
              'REGRESSION',
              'SMOKE',
              'INTEGRATION',
              'PERFORMANCE',
              'SECURITY',
              'UI',
              'API',
              'UNIT',
              'E2E'
            ])
            .optional()
            .describe('Test type'),
          automationStatus: z
            .enum(['AUTOMATED', 'NOT_AUTOMATED', 'CANDIDATE'])
            .optional()
            .describe('Automation status'),
          steps: z
            .array(
              z.object({
                order: z.number(),
                action: z.string(),
                expectedResult: z.string().optional()
              })
            )
            .optional()
            .describe('Test steps')
        }
      },
      async (args) => {
        try {
          const { projectId, ...testCaseData } = args;
    
          const data = await apiRequest(`/projects/${projectId}/test-cases`, {
            method: 'POST',
            body: JSON.stringify(testCaseData)
          });
    
          return {
            content: [
              {
                type: 'text' as const,
                text: `✅ Test case created successfully!\n\nID: ${data.id}\nTitle: ${data.title}\nPriority: ${data.priority}\nType: ${data.type}`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text' as const,
                text: `Error: ${error instanceof Error ? error.message : String(error)}`
              }
            ],
            isError: true
          };
        }
      }
    );
    
    // Register tool: submit-test-results
    server.registerTool(

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/QAStudio-Dev/mcp-server'

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