Skip to content
parkd126 edited this page Dec 7, 2018 · 9 revisions

Overview

A test case in TestRail consists of a description of the test's prerequisites, a list of test steps and the expected result. A test case can ideally be verified by a single tester in a short period of time and confirms a specific functionality, documents a task or verifies a project artifact. Source

Fields

Name Type Description Request Methods
createdBy Int The ID of the user who created the test case getCase, getCases
createdOn Timestamp The date/time when the test case was created (as UNIX timestamp) getCase, getCases
estimateForecast Timespan The estimate forecast, e.g. "30s" or "1m 45s" getCase, getCases
id Int The unique ID of the test case getCase, getCases
sectionId
Int The ID of the section the test case belongs to getCase, getCases, addCase
suiteId Int The ID of the suite the test case belongs to getCase, getCases
updatedBy Int The ID of the user who last updated the test case getCase, getCases
updatedOn Timestamp The date/time when the test case was last updated (as UNIX timestamp) getCase, getCases
title String The title of the test case getCase, getCases, addCase, updateCase
templateId Int The ID of the template (field layout) the test case uses (requires TestRail 5.2 or later) getCase, getCases, addCase, updateCase
typeId Int The ID of the test case type that is linked to the test case getCase, getCases, addCase, updateCase
priorityId Int The ID of the priority that is linked to the test case getCase, getCases, addCase, updateCase
estimate Timespan The estimate, e.g. "30s" or "1m 45s" getCase, getCases, addCase, updateCase
milestoneId Int The ID of the milestone that is linked to the test case getCase, getCases, addCase, updateCase
refs String A comma-separated list of references/requirements getCase, getCases, addCase, updateCase
automationType String Custom field for synchronizing TestRail suites with Ranorex. See more getCase, getCases, addCase, updateCase
expected String The expected result after executing the test case. getCase, getCases, addCase, updateCase
preconds String The preconditions of this test case. Reference other test cases with [C#] (e.g. [C17]). getCase, getCases, addCase, updateCase
steps String The required steps to execute the test case. getCase, getCases, addCase, updateCase
stepsSeparated See more String The required steps to execute the test case. getCase, getCases, addCase, updateCase
mission String A high-level overview of what to test and which areas to cover, usually just 1-2 sentences. getCase, getCases, addCase, updateCase
goals String A detailed list of goals to cover as part of the exploratory sessions. getCase, getCases, addCase, updateCase

Methods

GET Requests:


1. getCase

Description:

Returns an existing test case.

Parameters:
Name Type Description Required
caseId Int The unique ID of the test case Yes
Returns:
Example:
val caseId = 1
val caseObject = Case().getCase(caseId)

 

2. getCases

Description:

Returns a list of test cases for a test suite or specific section in a test suite.

Parameters:
Name Type Description Required
projectId Int The ID of the project Yes
suiteId Int The ID of the test suite Yes (Optional if the project is operating in single suite mode)
sectionId Int The ID of the section No
createdAfter Timestamp Only return test cases created after this date (as UNIX timestamp). No
createdBefore Timestamp Only return test cases created before this date (as UNIX timestamp). No
createdBy List<Int> A comma-separated list of creators (user IDs) to filter by. No
milestoneId List<Int> A comma-separated list of milestone IDs to filter by (not available if the milestone field is disabled for the project). No
priorityId List<Int> A comma-separated list of priority IDs to filter by. No
templateId List<Int> A comma-separated list of template IDs to filter by (requires TestRail 5.2 or later) No
typeId List<Int> A comma-separated list of case type IDs to filter by. No
updatedAfter Timestamp Only return test cases updated after this date (as UNIX timestamp). No
updatedBefore Timestamp Only return test cases updated before this date (as UNIX timestamp). No
updatedBy List<Int> A comma-separated list of users who updated test cases to filter by. No
Returns:
Example:
val projectId = 1
val caseObject = Case().getCases(projectId)

 

POST Requests:


1. addCase

Description:

Creates a new test case.

Required Parameters:
Returns:
Example:
val caseFoo = Case(
        sectionId = 1,
        title = "My Case"
)
caseFoo.addCase()

2. updateCase

Description:

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

Required Parameters:
Returns:
Example:
val caseFoo = Case(
        id = 1,
        title = "My Updated Case"
)
caseFoo.updateCase()

3. deleteCase

Description:

Deletes an existing test case.

Required Parameters:
Example:
val caseFoo = Case(
        id = 1
)
caseFoo.deleteCase()