Skip to content
parkd126 edited this page Dec 26, 2018 · 5 revisions

Overview

The data type for the result of a test execution.

Fields

Name Type Description Request Methods
createdBy Int The ID of the user who created the test result getResults, getResultsForCase, getResultsForRun
createdOn Timestamp The date/time when the test result was created (as UNIX timestamp) getResults, getResultsForCase, getResultsForRun
id Int The unique ID of the test result getResults, getResultsForCase, getResultsForRun
testId Int The ID of the test this test result belongs to getResults, getResultsForCase, getResultsForRun, addResults
caseId Int The ID of the case this test result belongs to getResultsForCase, addResultForCase, addResultsForCases
statusId Int The status of the test result, e.g. passed or failed getResults, getResultsForCase, getResultsForRun, addResult, addResultForCase, addResults, addResultsForCases
comment String The comment or error message of the test result getResults, getResultsForCase, getResultsForRun, addResult, addResultForCase, addResults, addResultsForCases
version String The (build) version the test was executed against getResults, getResultsForCase, getResultsForRun, addResult, addResultForCase, addResults, addResultsForCases
elapsed Timespan The amount of time it took to execute the test (e.g. "1m" or "2m 30s") getResults, getResultsForCase, getResultsForRun, addResult, addResultForCase, addResults, addResultsForCases
defects String A comma-separated list of defects linked to the test result getResults, getResultsForCase, getResultsForRun, addResult, addResultForCase, addResults, addResultsForCases
assignedToId Int The ID of the assignee (user) of the test result getResults, getResultsForCase, getResultsForRun, addResult, addResultForCase, addResults, addResultsForCases
customStepResults String An array of objects specifying the step results. getResults, getResultsForCase, getResultsForRun, addResult, addResultForCase, addResults, addResultsForCases

Methods

GET Requests:


1. getResults

Description:

Returns a list of test results for a test.

Parameters:
Name Type Description Required
testId Int The ID of the test Yes
limit Int Limit the result to limit test results. No
offset Int Use offset to skip records. No
statusId List<Int> A comma-separated list of status IDs to filter by. No
Returns:
Example:
val someResultsList = Result().getResults(testId = 1)

 

2. getResultsForCase

Description:

Returns a list of test results for a test run and case combination.

Parameters:
Name Type Description Required
runId Int The ID of the test run Yes
caseId Int The ID of the test case Yes
limit Int Limit the result to limit test results. No
offset Int Use offset to skip records. No
statusId List<Int> A comma-separated list of status IDs to filter by. No
Returns:
Example:
val someResultsList = Result().getResultsForCase(runId = 1, caseId = 1)

 

3. getResultsForRun

Description:

Returns a list of test results for a test run.

Requires TestRail 4.0 or later.

Parameters:
Name Type Description Required
runId Int The ID of the test run Yes
createdAfter Timestamp Only return test results created after this date (as UNIX timestamp). No
createdBefore Timestamp Only return test results created before this date (as UNIX timestamp). No
createdBy List<Int> A comma-separated list of creators (user IDs) to filter by. No
limit Int Limit the result to limit test results. No
offset Int Use offset to skip records. No
statusId List<Int> A comma-separated list of status IDs to filter by. No
Returns:
Example:
val someResultsList = Result().getResultsForRun(runId = 1)

 

POST Requests:


1. addResult

Description:

Adds a new test result, comment or assigns a test. It's recommended to use add results instead if you plan to add results for multiple tests.

Required Parameters:
Returns:
Example:
val someResult = Result(testId = 1, statusId = 1)
someResult.addResult()

 

2. addResultForCase

Description:

Adds a new test result, comment or assigns a test (for a test run and case combination). It's recommended to use add results for cases instead if you plan to add results for multiple test cases.

Required Parameters:
Returns:
Example:
val someResult = Result(caseId = 1, statusId = 1)
someResult.addResultForCase(runId = 1)

 

3. addResults

Description:

Adds one or more new test results, comments or assigns one or more tests. Ideal for test automation to bulk-add multiple test results in one step.

Requires TestRail 3.1 or later.

Required Parameters:
Returns:
Example:
val someResultsList = Result().addResults(runId = 1, Results(
        listOf(
            Result(testId = 1, statusId = 1)
        )
    )
)

 

4. addResultsForCases

Description:

Adds one or more new test results, comments or assigns one or more tests (using the case IDs). Ideal for test automation to bulk-add multiple test results in one step.

Requires TestRail 3.1 or later.

Required Parameters:
Returns:
Example:
val someResultsList = Result().addResultsForCases(runId = 1, Results(
        listOf(
            Result(caseId = 1, statusId = 1)
        )
    )
)