Articles in this section

API - Test run cases

Additional information

Custom fields

If you have custom fields setup for test run cases within the given project, the custom field data is exposed here. It is recommend that you take a look at the custom field resource documentation which will explain the format and how to match the values to the field names / ID's.

List

Description: Provides a paginated list of all test run cases within a given test run

Endpoint: <base_url>/projects/{project_id}/runs/{run_id}/executed_steps.json

Request: GET

Formats supported: JSON

Params:

  • project_id - {Integer} The associated project ID (Required)
  • run_id - {Integer} The associated run ID (Required)
  • page - {Integer} of the page (Default: 1)

Response

{
  "pagination": { .... },
  "executed_steps": [
    {
....,
"stored_custom_fields": [
{ .... },
{ .... }
],
"custom_fields": [
{ .... },
{ .... }
]
},
{
....,
"stored_custom_fields": [
{ .... },
{ .... }
],
"custom_fields": [
{ .... },
{ .... }
]
}
]
}

Example ruby request

HTTParty.get('https://api.testlodge.com/v1/account/1/projects/1/runs/1/executed_steps.json')

Example Response

Response code: 200

{
  "pagination": {
    "total_entries":2,
    "total_pages":1,
    "current_page":1,
    "next_page":null,
    "previous_page":null,
    "per_page":20
  },
  "executed_steps":[{
    "id":1,
"step_number":"TC01",
    "title":"step title",
"description":"Sample body content",
"test_steps":"1: step one. 2: step two",
"expected_result":"Does something",
"stored_custom_fields": [{
"name":"Platform",
"value":"OSX"
}],
"actual_result":"not shown",
"passed":0,
"issue_tracker_ticket_number":"1678",
"position":1,
"run_id":1,
"run_suite_id":1,
"last_saved_by_id":2,
"custom_fields": [{
"id":1,
"name":"Further details",
"value":"Some further details that should be included"
}],
    "created_at":"2014-02-26T14:33:58Z",
    "updated_at":"2014-02-26T14:33:58Z"
  },
  { .... }]
}

 

Show

Description: Get the details for a test run case.

Endpoint: <base_url>/projects/{project_id}/runs/{run_id}/executed_steps/{id}.json

Request: GET

Formats supported: JSON

Params:

  • project_id - {Integer} The associated project ID (Required)
  • run_id - {Integer} The associated run ID (Required)
  • id - {Integer} The test run case ID (Required)
  • include - {Array of Strings} The additional options to include in the response
    • Options:
      • step_uploads - Any files that have been uploaded and associated with the test case (The URL's are time limited and will only be valid for a short amount of time. (roughly 30 seconds))
      • executed_step_uploads - Any files that have been uploaded and associated with the test run case (The URL's are time limited and will only be valid for a short amount of time. (roughly 30 seconds))
      • executed_requirements - Any requirements that have been associated with the given test run case

Response

{ 
....,
"last_saved_by": { .... },
"stored_custom_fields": [
{ .... },
{ .... }
],
"custom_fields": [
{ .... },
{ .... }
],
"step_uploads": [
{ .... },
{ .... }
],
"executed_step_uploads": [
{ .... },
{ .... }
],
"executed_requirements": [
{ .... },
{ .... }
]
}

Example ruby request

HTTParty.get('https://api.testlodge.com/v1/account/1/projects/1/runs/1/executed_steps/1.json', query: { include: ['step_uploads'] })

Example Response

Response code: 200

{
  "id":1,
"step_number":"TC01",
  "title":"step title",
"description":"Sample body content",
"test_steps":"1: step one. 2: step two",
"expected_result":"Does something",
"stored_custom_fields": [{
"name":"Platform",
"value":"OSX"
}],
"actual_result":"not shown",
"passed":0,
"issue_tracker_ticket_number":"1678",
"position":1,
"run_id":1,
"run_suite_id":1,
"last_saved_by_id":2,
"last_saved_by": {
"id":2,
"firstname":"Jon",
"lastname":"Cole",
"email":"jon@example.com",
"created_at":"2014-02-26T14:33:58Z",
"updated_at":"2014-02-26T14:33:58Z"
},
"step_uploads": [{
"id":1,
"file_name":"image.jpg",
"content_type": "image/jpeg",
"paths": {
"original": {
"name":"original",
"geometry": null,
"url":"http://s3.amazonaws.com/path/to/image"
},
"thumbnail": {
"name":"thumbnail",
"geometry":"100x100#",
"url":"http://s3.amazonaws.com/path/to/image"
}
}
}],
"custom_fields": [{
"id":1,
"name":"Further details",
"value":"Some further details that should be included"
}],
"created_at":"2014-02-26T14:33:58Z",
  "updated_at":"2014-02-26T14:33:58Z"
}

 

Update

Description: Update a test run case.

Endpoint: <base_url>/projects/{project_id}/runs/{run_id}/executed_steps/{id}.json

Request: PATCH

Formats supported: JSON

Params:

  • project_id - {Integer} The associated project ID (Required)
  • run_id - {Integer} The associated run ID (Required)
  • id - {Integer} The test run case ID (Required)
  • executed_step:
    • actual_result - {Text} Details of what the actual result was
    • passed - {Integer} The result of the test
      • 0 - Failed
      • 1 - Passed
      • 2 - Skipped
      • options:
    • create_issue_tracker_ticket - {Integer} If there is a issue tracker integrated with the project, should a ticket be created if the test has failed
      • 0 - No
      • 1 - Yes
      • options:
    • custom_fields:

Response

{ 
....,
"stored_custom_fields": [
{ .... },
{ .... }
],
"last_saved_by": { .... },
"custom_fields": [
{ .... },
{ .... }
]
}

Example ruby request

HTTParty.patch('https://api.testlodge.com/v1/account/1/projects/1/runs/1/executed_steps/1.json', body: { 
executed_step: {
  actual_result: 'Does not show',
passed: 0,
create_issue_tracker_ticket: 1,
    custom_fields: {
      field_1: 'Some further details that should be included'
    }

  }
})

Example Response

Response code: 200

{
  "id":1,
"step_number":"TC01",
  "title":"step title",
"description":"Sample body content",
"test_steps":"1: step one. 2: step two",
"expected_result":"Does something",
"stored_custom_fields": [{
"name":"Platform",
"value":"OSX"
}],
"actual_result":"Does not show",
"passed":0,
"issue_tracker_ticket_number":"1678",
"position":1,
"run_id":1,
"run_suite_id":1,
"last_saved_by_id":2,
"last_saved_by": {
"id":2,
"firstname":"Jon",
"lastname":"Cole",
"email":"jon@example.com",
"created_at":"2014-02-26T14:33:58Z",
"updated_at":"2014-02-26T14:33:58Z"
},
"custom_fields": [{
"id":1,
"name":"Further details",
"value":"Some further details that should be included"
}],
"created_at":"2014-02-26T14:33:58Z",
  "updated_at":"2014-02-26T14:33:58Z"
}

 

Bulk Update

Description: Update the results of multiple tests cases.

  • Maximum of 250 cases per request.
  • After the request is complete, processing and updating the test cases happen in the background. Therefore it may take a couple of minutes for the changes to be shown in TestLodge. If there are any issues saving an update to an individual test run case, you will not be notified of this, and TestLodge will move on to try and save the next case.

Endpoint: <base_url>/projects/{project_id}/runs/{run_id}/executed_steps/bulk_update.json

Request: PATCH

Formats supported: JSON

Params:

  • project_id - {Integer} The associated project ID (Required)
  • run_id - {Integer} The associated run ID (Required)
  • executed_steps:
    • id - {Integer} The test run case ID (Required)
      • actual_result - {Text} Details of what the actual result was
      • passed - {Integer} The result of the test
        • options:
          • 0 - Failed
          • 1 - Passed
          • 2 - Skipped
      • create_issue_tracker_ticket - {Integer} If there is a issue tracker integrated with the project, should a ticket be created if the test has failed
        • options:
          • 0 - No
          • 1 - Yes

Response

{ 
"response": "",
"message": ""
}

Example ruby request

HTTParty.patch('https://api.testlodge.com/v1/account/1/projects/1/runs/1/executed_steps/bulk_update.json', body: { 
executed_steps: {
1000: {
actual_result: 'Does not show',
passed: 0,
create_issue_tracker_ticket: 1,
},
1001: {
passed: 1,
}

  }
})

Example curl request

curl -X "PATCH" "https://api.testlodge.com/v1/account/1/projects/1/runs/1/executed_steps/bulk_update.json" \
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
-u 'user@email.com:api_key' \
--data-urlencode "executed_steps[1000][actual_result]=Does not show" \
--data-urlencode "executed_steps[1000][passed]=0" \
--data-urlencode "executed_steps[1000][create_issue_tracker_ticket]=1" \
--data-urlencode "executed_steps[1001][passed]=1"

Example Response

Response code: 200

{ 
"response": "Processing",
"message": "Bulk update processing, please allow a few minutes for changes to be shown in TestLodge"
}
Was this article helpful?
0 out of 0 found this helpful