API - Test cases

Additional information

Custom fields

If you have custom fields setup for test 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 cases within a given test suite

Endpoint: <base_url>/v1/projects/{project_id}/suites/{suite_id}/steps.json

Request: GET

Formats supported: JSON

Params:

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

Response

{
  "pagination": { .... },
  "steps": [
    {
....,
"custom_fields": [
{ .... },
{ .... }
]
},
    {
....,
"custom_fields": [
{ .... },
{ .... }
]
}
  ]
}

Example ruby request

HTTParty.get('https://example.api.testlodge.com/v1/projects/1/suites/1/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
  },
  "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"
"project_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 case.

Endpoint: <base_url>/v1/projects/{project_id}/suites/{suite_id}/steps/{id}.json

Request: GET

Formats supported: JSON

Params:

  • project_id - {Integer} The associated project ID (Required)
  • suite_id - {Integer} The associated suite ID (Required)
  • id - {Integer} The 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 step (The URL's are time limited and will only be valid for a short amount of time. (roughly 30 seconds))
      • requirements - Any requirements that have been associated with the given case

Response

{ 
....,
"last_saved_by": { .... },
"custom_fields": [
{ .... },
{ .... }
],
"step_uploads": [
{ .... },
{ .... }
],
"requirements": [
{ .... },
{ .... }
]
}

Example ruby request

HTTParty.get('https://example.api.testlodge.com/v1/projects/1/suites/1/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",
"project_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"
}

 

Create

Description: Create a new test case.

Endpoint: <base_url>/v1/projects/{project_id}/suites/{suite_id}/steps.json

Request: POST

Formats supported: JSON

Params:

  • project_id - {Integer} The associated project ID (Required)
  • suite_id - {Integer} The associated suite ID (Required)
  • step:
    • title - {String} The case title (Required)
    • description - {Text} The body text (Required)
    • test_steps - {Text} The steps of the test
    • expected_result - {Text} The expected result of the test
    • custom_fields:

Response

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

Example ruby request

HTTParty.post('https://example.api.testlodge.com/v1/projects/1/suites/1/steps.json', body: { 
step: {
  title: 'Title',
   description: 'The body text',
test_steps: '1: step one. 2: step two',
expected_result: 'Does something',
custom_fields: {
field_1: 'Some further details that should be included'
}
  }
})

Example Response

Response code: 201

{
  "id":1,
"step_number":"TC01",
  "title":"Title",
"description":"The body text",
"test_steps":"1: step one. 2: step two",
"expected_result":"Does something",
"project_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"
}

 

Update

Description: Update a test case.

Endpoint: <base_url>/v1/projects/{project_id}/suites/{suite_id}/steps/{id}.json

Request: PATCH

Formats supported: JSON

Params:

  • project_id - {Integer} The associated project ID (Required)
  • suite_id - {Integer} The associated suite ID (Required)
  • id - {Integer} The case ID (Required)
  • step:
    • title - {String} The case title (Required)
    • description - {Text} The body text (Required)
    • test_steps - {Text} The steps of the test
    • expected_result - {Text} The expected result of the test
    • custom_fields:

Response

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

Example ruby request

HTTParty.patch('https://example.api.testlodge.com/v1/projects/1/suites/1/steps/1.json', body: { 
step: {
  title: 'New name'
  }
})

Example Response

Response code: 200

{
  "id":1,
"step_number":"TC01",
  "title":"New name",
"description":"The body text",
"test_steps":"1: step one. 2: step two",
"expected_result":"Does something",
"project_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"
}

 

Delete

Description: Delete a test case.

Endpoint: <base_url>/v1/projects/{project_id}/suites/{suite_id}/steps/{id}.json

Request: DELETE

Formats supported: JSON

Params:

  • project_id - {Integer} The associated project ID (Required)
  • suite_id - {Integer} The associated suite ID (Required)
  • id - {Integer} The case ID (Required)

Response

{ }

Example ruby request

HTTParty.delete('https://example.api.testlodge.com/v1/projects/1/suites/1/steps/1.json')

Example Response

Response code: 204

{ }
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Article is closed for comments.