api-testrail

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 ;
}
Returns a list of test cases for a project
testrail.getCases(projectId) {
return ;
}
Returns a list of test cases IDs for a project and case type
testrail.getCasesIDsByType (projectId, typeId) {
return ;
}
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 ;
}
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 ;
}
Deletes an existing test case
testrail.deleteCase (caseID) {
return ;
}
Case Fields
Returns a list of available test case custom fields
testrail.getCaseFields () {
return ;
}
Case Types
Returns a list of available case types
testrail.getCaseTypes () {
return ;
}
Milestones
Returns an existing milestone
testrail.getMilestone (milestoneID) {
return ;
}
Returns the list of milestones for a project
testrail.getMilestones (projectID) {
return ;
}
Creates a new milestone
The following POST fields are supported - milestone's name and description
testrail.addMilestone (projectID, name = 'Milestone', description = '') {
return ;
}
Updates an existing milestone (partial updates are supported, you can submit and update only - is_completed field)
testrail.updateMilestone (milestoneID, isCompleted) {
return ;
}
Deletes an existing milestone
testrail.deleteMilestone (milestoneID) {
return ;
}
Plans
Returns an existing test plan
testrail.getPlan (planID) {
return ;
}
Returns the list of test plans for a project
testrail.getPlans (projectID) {
return ;
}
Creates a new test plan
The following POST fields are supported - plan's name and description
testrail.addPlan (projectID, name = 'Plan', description = '') {
return ;
}
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 ;
}
Updates an existing test plan
Following fields are supported - plan's name and description
testrail.updatePlan (planID, name, description) {
return ;
}
Closes an existing test plan and archives its test runs & results
testrail.closePlan (planID) {
return ;
}
Deletes an existing test plan
testrail.deletePlan (planID) {
return ;
}
Configurations
Returns a list of available configurations, grouped by configuration groups
testrail.getConfigs (projectID) {
return ;
}
Creates a new configuration group
testrail.addConfigGroup (projectID, name) {
return ;
}
Creates a new configuration
testrail.addConfig (configGroupID, name) {
return ;
}
Updates an existing configuration group
testrail.updateConfigGroup (configGroupID, name) {
return ;
}
Updates an existing configuration
testrail.updateConfig (configID, name) {
return ;
}
Deletes an existing configuration group and its configurations
testrail.deleteConfigGroup (configGroupID) {
return ;
}
Deletes an existing configuration
testrail.deleteConfig (configID) {
return ;
}
Priorities
Returns a list of available priorities
testrail.getPriorities () {
return ;
}
Projects
Returns an existing project
testrail.getProject (projectID) {
return ;
}
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 ;
}
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 ;
}
Updates an existing project (admin status required)
Only the following updates are supported - is_completed (true, false)
testrail.updateProject (projectID, isCompleted) {
return ;
}
Deletes an existing project (admin status required)
testrail.deleteProject (projectID) {
return ;
}
Results
Returns a list of test results for a test
testrail.getResults (testID) {
return ;
}
Returns a list of test results for a test run (except untested tests)
testrail.getResultsForRun (runID) {
return ;
}
Returns a status of case
testrail.getResultForCase (runID, caseID) {
return ;
}
Adds a new test result and/or comment for a test
testrail.addResult (testID, statusID, comment = ' ') {
return ;
}
Adds a new test result or comment for a case
testrail.addResultForCase (runID, caseID, statusID, comment = '') {
return ;
}
Result Fields
Returns a list of available test result custom fields
testrail.getResultFields () {
return ;
}
Runs
Returns an existing test run
testrail.getRun (runID) {
return ;
}
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 ;
}
Creates a new test run
testrail.addRun (projectID, suiteID = 1) {
return ;
}
Creates a new test run for specific case type and returns run ID
testrail.addRunWithType (projectID, typeID, suiteID = 1) {
return ;
}
Updates an existing test run (partial updates are supported: runName and description)
testrail.updateRun (runID, name, description) {
return ;
}
Closes an existing test run and archives its tests & results
testrail.closeRun (runID) {
return ;
}
Deletes an existing test run
testrail.deleteRun (runID) {
return ;
}
Sections
Returns an existing section
testrail.getSection (sectionID) {
return ;
}
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 ;
}
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 ;
}
Updates an existing section (partial updates are supported, i.e. you can submit and update specific fields only)
testrail.updateSection (sectionID, name, description) {
return ;
}
Deletes an existing section
testrail.deleteSection (sectionID) {
return ;
}
Statuses
Returns a list of available test statuses
testrail.getStatuses () {
return ;
}
Suites
Returns an existing test suite
testrail.getSuite (suiteID) {
return ;
}
Returns a list of test suites for a project
testrail.getSuites (projectID) {
return ;
}
Creates a new test suite
testrail.addSuite (projectID, name, description) {
return ;
}
Updates an existing test suite
testrail.updateSuite (suiteID, name, description) {
return ;
}
Deletes an existing test suite
testrail.deleteSuite (suiteID) {
return ;
}
Templates
Returns a list of available templates
testrail.getTemplates (projectID) {
return ;
}
Tests
Returns an existing test
testrail.getTest (testID) {
return ;
}
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 ;
}
Users
Returns an existing user
testrail.getUser (userID) {
return ;
}
Returns a list of users
testrail.getUsers () {
return ;
}
Returns an existing user by his/her email address
testrail.getUserByEmail (email) {
return ;
}
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