Executions

This chapter focuses on services for the executions.

Get execution

A GET to /executions/{id} returns the execution with the given id.

Path parameters

Table 1. /api/rest/latest/executions/{id}
Parameter Description

id

the id of the execution

HTTP request

GET /api/rest/latest/executions/56 HTTP/1.1
Accept: application/json
Host: localhost:8080

Request parameters

Parameter Description

fields

which fields of the elements should be returned (optional)

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 3141

{
  "_type" : "execution",
  "id" : 56,
  "name" : "sample test case 56",
  "execution_order" : 4,
  "execution_status" : "BLOCKED",
  "last_executed_by" : "User-5",
  "last_executed_on" : "2017-07-24T10:00:00.000+0000",
  "execution_mode" : "AUTOMATED",
  "reference" : "SAMP_EXEC_56",
  "dataset_label" : "sample dataset",
  "execution_steps" : [ {
    "_type" : "execution-step",
    "id" : 22,
    "execution_status" : "SUCCESS",
    "action" : "<p>First action</p>",
    "expected_result" : "<p>First result</p>",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/execution-steps/22"
      }
    }
  }, {
    "_type" : "execution-step",
    "id" : 23,
    "execution_status" : "BLOCKED",
    "action" : "<p>Second action</p>",
    "expected_result" : "<p>Second result</p>",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/execution-steps/23"
      }
    }
  }, {
    "_type" : "execution-step",
    "id" : 27,
    "execution_status" : "SUCCESS",
    "action" : "<p>The Action</p>",
    "expected_result" : "<p>The Result</p>",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/execution-steps/27"
      }
    }
  } ],
  "comment" : "<p>I have no comment</p>",
  "prerequisite" : "<p>Being alive.</p>",
  "description" : "<p>This is nice.</p>",
  "importance" : "LOW",
  "nature" : {
    "code" : "NAT_SECURITY_TESTING"
  },
  "type" : {
    "code" : "TYP_EVOLUTION_TESTING"
  },
  "test_case_status" : "APPROVED",
  "test_plan_item" : {
    "_type" : "iteration-test-plan-item",
    "id" : 15,
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/iteration-test-plan-items/15"
      }
    }
  },
  "automated_execution_extender" : {
    "_type" : "automated-execution-extender",
    "id" : 778,
    "result_url" : "http://1234:4567/jenkins/report",
    "result_status" : "BLOCKED",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/automated-execution-extenders/778"
      }
    }
  },
  "custom_fields" : [ {
    "code" : "CUF_TXT",
    "label" : "cuf text",
    "value" : "cuf text value"
  }, {
    "code" : "CUF_TXT_2",
    "label" : "cuf text 2",
    "value" : "cuf text value 2"
  } ],
  "test_case_custom_fields" : [ {
    "code" : "TC_CUF_TXT",
    "label" : "tc cuf text",
    "value" : "tc cuf text value"
  }, {
    "code" : "TC_CUF_TXT_2",
    "label" : "tc cuf text 2",
    "value" : "tc cuf text value 2"
  } ],
  "language" : "",
  "script_name" : "",
  "attachments" : [ ],
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/executions/56"
    },
    "project" : {
      "href" : "http://localhost:8080/api/rest/latest/projects/87"
    },
    "test_plan_item" : {
      "href" : "http://localhost:8080/api/rest/latest/iteration-test-plan-items/15"
    },
    "execution-steps" : {
      "href" : "http://localhost:8080/api/rest/latest/executions/56/execution-steps"
    },
    "attachments" : {
      "href" : "http://localhost:8080/api/rest/latest/executions/56/attachments"
    }
  }
}

Response fields

Path Type Description

_type

String

the type of the entity

id

Number

the id of the execution

name

String

the name of the execution

execution_order

Number

the order of the execution

execution_status

String

the status of the execution

last_executed_by

String

the date this execution was last executed

last_executed_on

String

the user who last executed this execution

execution_mode

String

the execution mode of the execution

reference

String

the reference of this execution

dataset_label

String

the label of the dataset used in this execution

execution_steps

Array

the steps of this execution

comment

String

the comment of this execution

prerequisite

String

the prerequisite of this execution

description

String

the description of this execution

importance

String

the importance of this execution

nature

Object

the nature of this execution

type

Object

the type of this execution

test_case_status

String

the status of the test case referenced by this execution

test_plan_item

Object

the test plan item referenced by this execution

automated_execution_extender

Object

the automated execution extender referenced by this execution (will be hidden if execution mode is manual)

custom_fields

Array

the denormalized custom fields of this execution

test_case_custom_fields

Array

the custom fields of the referenced test case

language

String

the language of this execution (when referenced test case is scripted)

script_name

String

the script name of this execution (when referenced test case is scripted)

attachments

Array

the attachments of this execution

_links

Object

related links

Relation Description

self

link to this execution

project

link to the project of this execution

test_plan_item

link to the test plan item of this execution

execution-steps

link to the execution steps of this execution

attachments

link to the attachments of this execution

Modify an execution

A PATCH to /executions/{id} modifies the execution with the given id.

Path parameters

Table 1. /api/rest/latest/executions/{id}
Parameter Description

id

the id of the execution

HTTP request

PATCH /api/rest/latest/executions/83?fields=execution_status,comment,prerequisite,%20custom_fields,%20test_case_custom_fields HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Content-Length: 451

{
  "_type" : "execution",
  "custom_fields" : [ {
    "code" : "TXT_STATUS",
    "value" : "allright"
  }, {
    "code" : "TAGS_RELATED",
    "value" : [ "see this", "also that" ]
  } ],
  "test_case_custom_fields" : [ {
    "code" : "TC_TEXT",
    "value" : "I'm from the test case"
  } ],
  "execution_status" : "RUNNING",
  "comment" : "<p>the comment was modified...</p>",
  "prerequisite" : "<p>impossible modification of the prerequisite</p>"
}

Request fields

Path Type Description

_type

String

the type of the entity (mandatory)

execution_status

String

the new status of that execution

comment

String

the new comment of the execution

custom_fields

Array

an array of custom fields

custom_fields[].code

String

the code of the custom field to modify

custom_fields[].value

Varies

the value of the custom field. It should match the type of the field (text, date etc). If the field accepts only a single value the content is a string, if it accepts multiple values (eg, tags) the content is an array of strings.

test_case_custom_fields

Array

the original custom fields of the test case run by this execution

test_case_custom_fields[].code

String

the code of the test case custom field

test_case_custom_fields[].value

Varies

the value of the test case custom field. It applies the same rules than the execution custom_fields

Request parameters

Parameter Description

fields

which fields of the elements should be returned (optional)

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 1176

{
  "_type" : "execution",
  "id" : 83,
  "execution_status" : "RUNNING",
  "comment" : "<p>the comment was modified...</p>",
  "prerequisite" : "<p>... but the prerequisite was not</p>",
  "custom_fields" : [ {
    "code" : "TXT_STATUS",
    "label" : "text",
    "value" : "allright"
  }, {
    "code" : "TAGS_RELATED",
    "label" : "see also",
    "value" : [ "see this", "also that" ]
  } ],
  "test_case_custom_fields" : [ {
    "code" : "TC_TEXT",
    "label" : "test case cuf",
    "value" : "I'm from the test case"
  }, {
    "code" : "TC_LABELS",
    "label" : "labels",
    "value" : [ "was", "not", "updated" ]
  } ],
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/executions/83"
    },
    "project" : {
      "href" : "http://localhost:8080/api/rest/latest/projects/14"
    },
    "test_plan_item" : {
      "href" : "http://localhost:8080/api/rest/latest/iteration-test-plan-items/1"
    },
    "execution-steps" : {
      "href" : "http://localhost:8080/api/rest/latest/executions/83/execution-steps"
    },
    "attachments" : {
      "href" : "http://localhost:8080/api/rest/latest/executions/83/attachments"
    }
  }
}

Response fields

Path Type Description

_type

String

the type of the entity, etc

Relation Description

self

the link to this execution

project

the link to the execution project

test_plan_item

the link to the test plan item of this execution

execution-steps

the link to the execution steps

attachments

the link to the attachments

Get steps of execution

A GET to /executions/{id}/execution-steps returns all the execution steps of the execution with the given id.

Path parameters

Table 1. /api/rest/latest/executions/{id}/execution-steps
Parameter Description

id

the id of the execution

HTTP request

GET /api/rest/latest/executions/10/execution-steps?size=1&page=1 HTTP/1.1
Accept: application/json
Host: localhost:8080

Request parameters

Parameter Description

page

number of the page to retrieve (optional)

size

size of the page to retrieve (optional)

sort

which attributes of the returned entities should be sorted on (optional)

fields

which fields of the elements should be returned (optional)

include

level of depth of the content that should be returned (optional)

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 1917

{
  "_embedded" : {
    "execution-steps" : [ {
      "_type" : "execution-step",
      "id" : 10,
      "execution_status" : "SUCCESS",
      "action" : "<p>This is the first action.</p>",
      "expected_result" : "<p>This is the first result.</p>",
      "comment" : "<p>And that is the comment</p>",
      "last_executed_by" : "User-8U122",
      "last_executed_on" : "2017-07-31T10:00:00.000+0000",
      "execution_step_order" : 0,
      "referenced_test_step" : null,
      "execution" : {
        "_type" : "execution",
        "id" : 7,
        "execution_status" : "SUCCESS",
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/executions/7"
          }
        }
      },
      "custom_fields" : [ {
        "code" : "CUF_TAG",
        "label" : "Tag Cuf",
        "value" : [ "tag_1", "tag_2", "tag_3" ]
      } ],
      "test_step_custom_fields" : [ {
        "code" : "CUF_TXT",
        "label" : "Basic Text Cuf",
        "value" : "The Value"
      } ],
      "attachments" : [ ],
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/execution-steps/10"
        }
      }
    } ]
  },
  "_links" : {
    "first" : {
      "href" : "http://localhost:8080/api/rest/latest/executions/10/execution-steps?page=0&size=1"
    },
    "prev" : {
      "href" : "http://localhost:8080/api/rest/latest/executions/10/execution-steps?page=0&size=1"
    },
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/executions/10/execution-steps?page=1&size=1"
    },
    "next" : {
      "href" : "http://localhost:8080/api/rest/latest/executions/10/execution-steps?page=2&size=1"
    },
    "last" : {
      "href" : "http://localhost:8080/api/rest/latest/executions/10/execution-steps?page=2&size=1"
    }
  },
  "page" : {
    "size" : 1,
    "totalElements" : 3,
    "totalPages" : 3,
    "number" : 1
  }
}

Response fields

Path Type Description

_embedded.execution-steps

Array

the list of elements for that page

page.size

Number

the page size for that query

page.totalElements

Number

total number of elements the client is allowed to read

page.totalPages

Number

how many pages can be browsed

page.number

Number

the page number

_links

Object

related links

Relation Description

first

link to the first page (optional)

prev

link to the previous page (optional)

self

link to this page

next

link to the next page (optional)

last

link to the last page (optional)