api-testrail

1.2.3 • Public • Published

api-testrail

npm version GitHub package.json version (branch) Build Status FOSSA Status David GitHub repo size npm Known Vulnerabilities GitHub last commit GitHub pull request check state GitHub pull request check contexts GitHub language count GitHub top language Coverage Status Greenkeeper

An API wrapper for TestRail with error handling

The TestRail API is described here

Usage

Of cource, you need to setup the API wrapper :

import ApiTestRail from 'api-testrail';
 
const testrail = new ApiTestRail(
  host, 
  username,
  password
);

Cases

Returns an existing test case

testrail.getCase (caseId) {
    return /*case data*/;
}

Returns a list of test cases for a project

testrail.getCases(projectId) {
    return /*all cases' data*/;
}

Returns a list of test cases IDs for a project and case type

testrail.getCasesIDsByType (projectId, typeId) {
    return /*list of IDs*/;
}

Creates a new test case The following POST fields are supported: sectionID(required), title, prioretyID, typeID

testrail.addCase(sectionID, title = 'AutoCreatedTest', prioretyID = 2, typeID = 7) {
    return /*added case's data*/;
}

Updates an existing test case (partial updates are supported, you can update only title, priority and type)

testrail.updateCase (caseID, title = 'AutoCreatedTest', priorityID = 2, typeID = 7) {
    return /*updated case's data*/;
}

Deletes an existing test case

testrail.deleteCase (caseID) {
    return /*statusID, i.e. 200*/;
}

Case Fields

Returns a list of available test case custom fields

testrail.getCaseFields () {
    return /*case fields' list*/;
}

Case Types

Returns a list of available case types

testrail.getCaseTypes () {
    return /*case types' list*/;
}

Milestones

Returns an existing milestone

testrail.getMilestone (milestoneID) {
    return /*milestone's data*/;
}

Returns the list of milestones for a project

testrail.getMilestones (projectID) {
    return /*list of milestones' data*/;
}

Creates a new milestone The following POST fields are supported - milestone's name and description

testrail.addMilestone (projectID, name = 'Milestone', description = '') {
    return /*added milestone's data*/;
}

Updates an existing milestone (partial updates are supported, you can submit and update only - is_completed field)

testrail.updateMilestone (milestoneID, isCompleted) {
    return /*updated milestone's data*/;
}

Deletes an existing milestone

testrail.deleteMilestone (milestoneID) {
    return /*statusID, i.e. 200*/;
}

Plans

Returns an existing test plan

testrail.getPlan (planID) {
    return /*test plan's data*/;
}

Returns the list of test plans for a project

testrail.getPlans (projectID) {
    return /*list of test plans' data*/;
}

Creates a new test plan The following POST fields are supported - plan's name and description

testrail.addPlan (projectID, name = 'Plan', description = '') {
    return /*added test plan's data*/;
}

Adds new test run to a test plan The following POST fields are supported - planID(required), suiteID(required), name

testrail.addPlanEntry (planID, suiteID, runName) {
    return /*added test plan entry's data*/;
}

Updates an existing test plan Following fields are supported - plan's name and description

testrail.updatePlan (planID, name, description) {
    return /*updated test plan's data*/;
}

Closes an existing test plan and archives its test runs & results

testrail.closePlan (planID) {
    return /*closed test plan's data*/;
}

Deletes an existing test plan

testrail.deletePlan (planID) {
    return /*statusID, i.e. 200*/;
}

Configurations

Returns a list of available configurations, grouped by configuration groups

testrail.getConfigs (projectID) {
    return /*list of configs*/;
}

Creates a new configuration group

testrail.addConfigGroup (projectID, name) {
    return /*added configGroup data*/;
}

Creates a new configuration

testrail.addConfig (configGroupID, name) {
    return /*added config data*/;
}

Updates an existing configuration group

testrail.updateConfigGroup (configGroupID, name) {
    return /*updated configGroup data*/;
}

Updates an existing configuration

testrail.updateConfig (configID, name) {
    return /*updated config data*/;
}

Deletes an existing configuration group and its configurations

testrail.deleteConfigGroup (configGroupID) {
    return /*statusID, i.e. 200*/;
}

Deletes an existing configuration

testrail.deleteConfig (configID) {
    return /*statusID, i.e. 200*/;
}

Priorities

Returns a list of available priorities

testrail.getPriorities () {
    return /*list of priorities*/;
}

Projects

Returns an existing project

testrail.getProject (projectID) {
    return /*project's data*/;
}

Returns an existing projects The following filters can be applied: 1 to return completed projects only. 0 to return active projects only

testrail.getProjects (isCompleted = '') {
    return /*projects' data*/;
}

Creates a new project (admin status required) The following POST fields are supported: name, announcement, showAnnouncement, suiteMode

testrail.addProject (name, announcement = '', showAnnouncement = true, suiteMode = 1) {
    return /*added project's data*/;
}

Updates an existing project (admin status required) Only the following updates are supported - is_completed (true, false)

testrail.updateProject (projectID, isCompleted) {
    return /*updated project's data*/;
}

Deletes an existing project (admin status required)

testrail.deleteProject (projectID) {
    return /*statusID, i.e. 200*/;
}

Results

Returns a list of test results for a test

testrail.getResults (testID) {
    return /*list of test results for a test*/;
}

Returns a list of test results for a test run (except untested tests)

testrail.getResultsForRun (runID) {
    return /*list of test results for a test run*/;
}

Returns a status of case

testrail.getResultForCase (runID, caseID) {
    return /*status_id of test case*/;
}

Adds a new test result and/or comment for a test

testrail.addResult (testID, statusID, comment = ' ') {
    return /*added result's data */;
}

Adds a new test result or comment for a case

testrail.addResultForCase (runID, caseID, statusID, comment = '') {
    return /*added result's data */;
}

Result Fields

Returns a list of available test result custom fields

testrail.getResultFields () {
    return /*list of test result fields*/;
}

Runs

Returns an existing test run

testrail.getRun (runID) {
    return /*run's data*/;
}

Returns a list of test runs for a project. Only returns those test runs that are not part of a test plan The following filters can be applied: 1: 1 to return completed projects only. 0 to return active projects only 2: limit, 3: milestoneID, 4: suiteID

testrail.getRuns (projectID, isCompleted = '',limit = '', milestoneID = '', suiteID = '') {
    return /*list of runs' data*/;
}

Creates a new test run

testrail.addRun (projectID, suiteID = 1) {
    return /*added run's data*/;
}

Creates a new test run for specific case type and returns run ID

testrail.addRunWithType (projectID, typeID, suiteID = 1) {
    return /*added run's id*/;
}

Updates an existing test run (partial updates are supported: runName and description)

testrail.updateRun (runID, name, description) {
    return /*updated run's data*/;
}

Closes an existing test run and archives its tests & results

testrail.closeRun (runID) {
    return /*closed run's data*/;
}

Deletes an existing test run

testrail.deleteRun (runID) {
    return /*statusID, i.e. 200*/;
}

Sections

Returns an existing section

testrail.getSection (sectionID) {
    return /*section's data*/;
}

Returns a list of sections for a project and test suite The ID of the test suite (optional if the project is operating in single suite mode, default is 1)

testrail.getSections (projectID, suiteID = 1) {
    return /*lits of section's data*/;
}

Creates a new section The ID of the test suite is optional (default is 1) if the project is operating in single suite mode, required otherwise)

testrail.addSection (projectID, name, suiteID = 1, description) {
    return /*added section's data*/;
}

Updates an existing section (partial updates are supported, i.e. you can submit and update specific fields only)

testrail.updateSection (sectionID, name, description) {
    return /*updated section's data*/;
}

Deletes an existing section

testrail.deleteSection (sectionID) {
    return /*statusID, i.e. 200*/;
}

Statuses

Returns a list of available test statuses

testrail.getStatuses () {
    return /*statuses list*/;
}

Suites

Returns an existing test suite

testrail.getSuite (suiteID) {
    return /*suite's data*/;
}

Returns a list of test suites for a project

testrail.getSuites (projectID) {
    return /*list of test suite's*/;
}

Creates a new test suite

testrail.addSuite (projectID, name, description) {
    return /*added test suite's data*/;
}

Updates an existing test suite

testrail.updateSuite (suiteID, name, description) {
    return /*updated test suite's data*/;
}

Deletes an existing test suite

testrail.deleteSuite (suiteID) {
    return /*statusID, i.e. 200*/;
}

Templates

Returns a list of available templates

testrail.getTemplates (projectID) {
    return /*list of templates*/;
}

Tests

Returns an existing test

testrail.getTest (testID) {
    return /*test's data*/;
}

Return all tests for a test run Optional: Also a comma-separated list of status IDs to filter by

testrail.getTests (runId, typeID = [1,2,3,4,5]) {
    return /*tests data*/;
}

Users

Returns an existing user

testrail.getUser (userID) {
    return /*user's data*/;
}

Returns a list of users

testrail.getUsers () {
    return /*list of users*/;
}

Returns an existing user by his/her email address

testrail.getUserByEmail (email) {
    return /*user's data*/;
}

FYI

STATUS_IDs

Passed - 1
Blocked - 2
Untested - 3
Retested - 4
Failed - 5

TYPE_IDs

Acceptance - 1
Accessibility - 2
Automated - 3
Compatibility - 4
Destructive - 5
Functional - 6
Other (Default) - 7
Performance - 8
Regression - 9
Security - 10
Smoke & Sanity - 11
Usability - 12

Readme

Keywords

Package Sidebar

Install

npm i api-testrail

Weekly Downloads

11

Version

1.2.3

License

ISC

Unpacked Size

63 kB

Total Files

21

Last publish

Collaborators

  • stepanchaparyan