UNPKG

testrail-modern-client

Version:
101 lines (100 loc) 4.72 kB
import { AddTestCase, CaseHistory, TestCase, TestCaseFilters, UpdateTestCase } from '../models/cases'; import { BaseService } from './base'; /** * Service for managing test cases in TestRail */ export declare class CaseService extends BaseService { /** * Returns a list of test cases for a project or specific test suite * @param projectId - The ID of the project * @param filters - Optional filters to apply * @returns List of test cases * @throws {Error} 400 - Invalid or unknown test case * @throws {Error} 403 - No access to the project */ list(projectId: number, filters?: TestCaseFilters): Promise<TestCase[]>; /** * Returns an existing test case * @param caseId - The ID of the test case * @returns The test case * @throws {Error} 400 - Invalid or unknown test case * @throws {Error} 403 - No access to the project */ get(caseId: number): Promise<TestCase>; /** * Creates a new test case * @param sectionId - The ID of the section the test case should be added to * @param testCase - The test case to create * @returns The created test case * @throws {Error} 400 - Invalid or unknown test case * @throws {Error} 403 - No access to the project */ add(sectionId: number, testCase: AddTestCase): Promise<TestCase>; /** * Updates an existing test case (partial updates are supported) * @param caseId - The ID of the test case * @param testCase - The test case fields to update * @returns The updated test case * @throws {Error} 400 - Invalid or unknown test case * @throws {Error} 403 - No access to the project */ update(caseId: number, testCase: UpdateTestCase): Promise<TestCase>; /** * Updates multiple test cases with the same values * @param suiteId - The ID of the test suite (optional if the project is operating in single suite mode) * @param caseIds - The IDs of the test cases to update * @param updates - The fields to update for all test cases * @returns The updated test cases * @throws {Error} 400 - Invalid or unknown test case * @throws {Error} 403 - No access to the project */ updateBulk(suiteId: number, caseIds: number[], updates: UpdateTestCase): Promise<TestCase[]>; /** * Copies test cases to another suite/section * @param sectionId - The ID of the section to copy the cases to * @param caseIds - The IDs of the test cases to copy * @throws {Error} 400 - Invalid or unknown test case * @throws {Error} 403 - No access to the project */ copyToSection(sectionId: number, caseIds: number[]): Promise<void>; /** * Moves test cases to another suite/section * @param sectionId - The ID of the section to move the cases to * @param suiteId - The ID of the suite to move the cases to * @param caseIds - The IDs of the test cases to move * @throws {Error} 400 - Invalid or unknown test case * @throws {Error} 403 - No access to the project */ moveToSection(sectionId: number, suiteId: number, caseIds: number[]): Promise<void>; /** * Deletes an existing test case * @param caseId - The ID of the test case * @param soft - If true, returns information about what would be deleted without actually deleting * @throws {Error} 400 - Invalid or unknown test case * @throws {Error} 403 - No access to the project * @remarks Deleting a test case cannot be undone and also permanently deletes all test results in active test runs */ delete(caseId: number, soft?: boolean): Promise<void>; /** * Deletes multiple test cases * @param suiteId - The ID of the test suite (optional if the project is operating in single suite mode) * @param projectId - The ID of the project * @param caseIds - The IDs of the test cases to delete * @param soft - If true, returns information about what would be deleted without actually deleting * @throws {Error} 400 - Invalid or unknown test case * @throws {Error} 403 - No access to the project * @remarks Deleting test cases cannot be undone and also permanently deletes all test results in active test runs */ deleteBulk(suiteId: number, projectId: number, caseIds: number[], soft?: boolean): Promise<void>; /** * Returns the edit history for a test case * @param caseId - The ID of the test case * @returns List of history entries * @throws {Error} 400 - Invalid or unknown test case * @throws {Error} 403 - No access to the project * @since TestRail 6.5.4 */ getHistory(caseId: number): Promise<{ history: CaseHistory[]; }>; }