Skip to content

Conversation

@MikolajMozuch-smartbear
Copy link
Contributor

Goal

This PR will provide functionality for getting a specific Test Case

Design

Changeset

Added get-test-case.ts and get-test-case.test.ts

Testing

Added unit tests
Tested the functionality using GitHub Copilot and invoking the tool

Copilot AI review requested due to automatic review settings October 29, 2025 10:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds functionality to retrieve individual test case details from Zephyr by key. The implementation follows the existing pattern established by the GetProjects tool.

  • Introduces a new GetTestCase tool that fetches test case details by key
  • Adds comprehensive schema definitions for test cases including links, labels, and custom fields
  • Includes unit tests covering success and error scenarios

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 15 comments.

File Description
src/zephyr/tool/test-case/get-test-case.ts Implements the new GetTestCase tool with input validation and API call handling
src/zephyr/common/types.ts Adds schema definitions for test cases, including supporting schemas for references, users, links, and labels
src/zephyr/client.ts Registers the new GetTestCase tool with the Zephyr client
src/tests/unit/zephyr/tool/test-case/get-test-case.test.ts Provides unit tests for the GetTestCase tool

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


export const CustomFieldsSchema = z
.record(z.any())
.describe("Custom fields with dynamic keys and values.");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can alter the description slightly, because keys are always String in this case. Only values can be of various types.

.describe("Custom fields with dynamic keys and values.");

export const TypeSchema = z.enum(["COVERAGE", "RELATES", "BLOCKS"]);
export const TestCaseLabelsSchema = z.enum([
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestCaseLabelsSchema should be z.array(z.string()), it's not an enum. It can be an array of any strings.

z.object({
description: z.string().nullable().describe("Description of the web link."),
url: z.string().url().describe("URL of the web link."),
type: z.string().describe("Type of the web link."),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also be a TypeSchema, since it's an enum

@tomlongridge tomlongridge deleted the branch main November 5, 2025 09:25
@tomlongridge tomlongridge reopened this Nov 5, 2025
@tomlongridge tomlongridge changed the base branch from next to main November 5, 2025 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants