@dlenroc/testrail ·
Installation
npm install @dlenroc/testrail --save
Example
const api = new TestRail({
host: 'https://{organization}.testrail.net',
username: '{username}',
password: '{token/password}',
});
const projects = await api.getProjects();
console.log(projects);
APIs
Attachments
addAttachmentToCase(caseId: number, payload: AddAttachment): Promise<CreatedAttachment>
addAttachmentToPlan(planId: number, payload: AddAttachment): Promise<CreatedAttachment>
addAttachmentToPlanEntry(planId: number, entryId: string, payload: AddAttachment): Promise<CreatedAttachment>
addAttachmentToResult(resultId: number, payload: AddAttachment): Promise<CreatedAttachment>
addAttachmentToRun(runId: number, payload: AddAttachment): Promise<CreatedAttachment>
getAttachmentsForCase(caseId: number, filters?: Pagination): Promise<AttachmentForCase[]>
getAttachmentsForPlan(planId: number, filters?: Pagination): Promise<AttachmentForPlan[]>
getAttachmentsForPlanEntry(planId: number, entryId: string): Promise<AttachmentForPlanEntry[]>
getAttachmentsForRun(runId: number, filters?: Pagination): Promise<AttachmentForRun[]>
getAttachmentsForTest(testId: number): Promise<AttachmentForTest[]>
getAttachment(attachmentId: string): Promise<Blob>
deleteAttachment(attachmentId: string): Promise<void>
BDDs
getBdd(caseId: number): Promise<Blob>
addBdd(sectionId: number, payload: AddAttachment): Promise<Case>
Cases
getCase(caseId: number): Promise<Case>
getCases(projectId: number, filters?: CaseFilters): Promise<Case[]>
getHistoryForCase(caseId: number, filters?: Pagination): Promise<CaseHistory[]>
addCase(sectionId: number, payload: AddCase): Promise<Case>
copyCasesToSection(sectionId: number, payload: CopyCasesToSection): Promise<void>
updateCase(caseId: number, payload: UpdateCase): Promise<Case>
updateCases(suiteId: number, payload: UpdateCases): Promise<void>
moveCasesToSection(sectionId: number, payload: MoveCasesToSection): Promise<void>
deleteCase(caseId: number): Promise<void>
deleteCases(suiteId: number, payload: DeleteCases): Promise<void>
Case Fields
getCaseFields(): Promise<CaseField[]>
addCaseField(payload: AddCaseField): Promise<CaseField>
Case Types
getCaseTypes(): Promise<CaseType[]>
Configurations
getConfigs(projectId: number): Promise<Config[]>
addConfigGroup(projectId: number, payload: AddConfigGroup): Promise<Config>
addConfig(configGroupId: number, payload: AddConfig): Promise<ConfigItem>
updateConfigGroup(configGroupId: number, payload: UpdateConfigGroup): Promise<Config>
updateConfig(configId: number, payload: UpdateConfig): Promise<ConfigItem>
deleteConfigGroup(configGroupId: number): Promise<void>
deleteConfig(configId: number): Promise<void>
Datasets
getDataset(datasetId: number): Promise<Dataset>
getDatasets(projectId: number, filters?: Pagination): Promise<Dataset[]>
addDataset(projectId: number, payload: AddDataset): Promise<Group>
updateDataset(datasetId: number, payload: AddDataset): Promise<Group>
deleteDataset(datasetId: number): Promise<void>
Groups
getGroup(groupId: number): Promise<Group>
getGroups(filters?: Pagination): Promise<Group[]>
addGroup(payload: AddGroup): Promise<Group>
updateGroup(groupId: number, payload: AddGroup): Promise<Group>
deleteGroup(groupId: number): Promise<void>
Milestones
getMilestone(milestoneId: number): Promise<Milestone>
getMilestones(projectId: number, filters?: MilestoneFilters): Promise<Milestone[]>
addMilestone(projectId: number, payload: AddMilestone): Promise<Milestone>
updateMilestone(milestoneId: number, payload: UpdateMilestone): Promise<Milestone>
deleteMilestone(milestoneId: number): Promise<void>
Roles
getRoles(filters?: Pagination): Promise<Role[]>
Plans
getPlan(planId: number): Promise<Plan>
getPlans(projectId: number, filters?: PlanFilters): Promise<PlanItem[]>
addPlan(projectId: number, payload: AddPlan): Promise<Plan>
addPlanEntry(planId: number, payload: AddPlanEntry): Promise<PlanEntry>
addRunToPlanEntry(planId: number, entryId: string, payload: AddRunToPlanEntry): Promise<PlanEntry>
updatePlan(planId: number, payload: UpdatePlan): Promise<Plan>
updatePlanEntry(planId: number, entryId: string, payload: UpdatePlanEntry): Promise<PlanEntry>
updateRunInPlanEntry(runId: number, payload: UpdateRunInPlanEntry): Promise<PlanEntry>
closePlan(planId: number): Promise<Plan>
deletePlan(planId: number): Promise<void>
deletePlanEntry(planId: number, entryId: string): Promise<void>
deleteRunFromPlanEntry(runId: number): Promise<void>
Priorities
getPriorities(): Promise<Priority[]>
Projects
getProject(projectId: number): Promise<Project>
getProjects(filters?: ProjectFilters): Promise<Project[]>
addProject(payload: AddProject): Promise<Project>
updateProject(projectId: number, payload: UpdateProject): Promise<Project>
deleteProject(projectId: number): Promise<void>
Reports
getReports(projectId: number): Promise<Report[]>
runReport(reportTemplateId: number): Promise<ReportUrls>
Results
getResults(testId: number, filters?: ResultFilters): Promise<Result[]>
getResultsForCase(runId: number, caseId: number, filters?: ResultFilters): Promise<Result[]>
getResultsForRun(runId: number, filters?: ResultForRunFilters): Promise<Result[]>
addResult(testId: number, payload: AddResult): Promise<Result>
addResultForCase(runId: number, caseId: number, payload: AddResult): Promise<Result>
addResults(runId: number, payload: AddResults): Promise<Result[]>
addResultsForCases(runId: number, payload: AddResultsForCases): Promise<Result[]>
Result Fields
getResultFields(): Promise<ResultField[]>
Runs
getRun(runId: number): Promise<Run>
getRuns(projectId: number, filters?: RunFilters): Promise<Run[]>
addRun(projectId: number, payload: AddRun): Promise<Run>
updateRun(runId: number, payload: UpdateRun): Promise<Run>
closeRun(runId: number): Promise<Run>
deleteRun(runId: number): Promise<void>
Sections
getSection(sectionId: number): Promise<Section>
getSections(projectId: number, filters?: SectionFilters): Promise<Section[]>
addSection(projectId: number, payload: AddSection): Promise<Section>
moveSection(sectionId: number, payload: MoveSection): Promise<Section>
updateSection(sectionId: number, payload: UpdateSection): Promise<Section>
deleteSection(sectionId: number): Promise<void>
Shared steps
getSharedStep(stepId: number): Promise<SharedStep>
getSharedSteps(projectId: number, filters?: SharedStepFilters): Promise<SharedStep[]>
getSharedStepHistory(stepId: number, filters?: Pagination): Promise<SharedStepHistory[]> {
addSharedStep(projectId: number, payload: AddSharedStep): Promise<SharedStep>
updateSharedStep(stepId: number, payload: UpdateSharedStep): Promise<SharedStep>
deleteSharedStep(stepId: number, payload?: DeleteSharedStep): Promise<void>
Statuses
getStatuses(): Promise<Status[]>
getCaseStatuses(filters?: Pagination): Promise<CaseStatus[]>
Suites
getSuite(suiteId: number): Promise<Suite>
getSuites(projectId: number): Promise<Suite[]>
addSuite(projectId: number, payload: AddSuite): Promise<Suite>
updateSuite(suiteId: number, payload: UpdateSuite): Promise<Suite>
deleteSuite(suiteId: number): Promise<void>
Templates
getTemplates(projectId: number): Promise<Template[]>
Tests
getTest(testId: number): Promise<Test>
getTests(runId: number, filters?: TestFilters): Promise<Test[]>
Users
getUser(userId: number): Promise<User>
getCurrentUser(): Promise<User>
getUserByEmail(email: string): Promise<User>
getUsers(filters?: UserFilters): Promise<User[]>
addUser(payload: AddUser): Promise<User>
updateUser(userId: number, payload: AddUser): Promise<User>
Variables
getVariables(projectId: number, filters?: Pagination): Promise<Variable[]>
addVariable(projectId: number, payload: AddVariable): Promise<Variable>
updateVariable(variableId: number, payload: AddVariable): Promise<Variable>
deleteVariable(variableId: number): Promise<void>