Executions

This chapter focuses on services for the executions.

Updates from version 1.2.0:

  • There are 3 types of execution: standard, scripted and keyword.

  • The "script" property is from now available only for scripted execution.

  • There is no longer "language" property in execution. The language for scripted execution is always GHERKIN while there is no defined language for standard and keyword 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-Length: 3100
Content-Type: application/json;charset=UTF-8

{
  "_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"
  } ],
  "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

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

Create execution for iteration test plan item

A POST to /iteration-test-plan-items/{id}/executions creates a new execution for the iteration test plan item with the given id.

Path parameters

Table 1. /api/rest/latest/iteration-test-plan-items/{id}/executions
Parameter Description

id

the id of the test plan element

HTTP request

POST /api/rest/latest/iteration-test-plan-items/265/executions HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: localhost:8080

Request parameters

Parameter Description

fields

which fields of the elements should be returned (optional)

HTTP response

HTTP/1.1 201 Created
Content-Type: application/json;charset=UTF-8
Content-Length: 2206

{
  "_type" : "execution",
  "id" : 25,
  "name" : "Christmas turkey test flight",
  "execution_order" : 0,
  "execution_status" : "READY",
  "last_executed_by" : null,
  "last_executed_on" : null,
  "execution_mode" : "MANUAL",
  "reference" : "CHR-T024",
  "dataset_label" : "",
  "execution_steps" : [ {
    "_type" : "execution-step",
    "id" : 50,
    "execution_status" : "READY",
    "action" : "<p>arm the slingshot</p>",
    "expected_result" : "<p>slingshot is armed</p>",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/execution-steps/50"
      }
    }
  }, {
    "_type" : "execution-step",
    "id" : 51,
    "execution_status" : "READY",
    "action" : "<p>install the turkey</p>",
    "expected_result" : "<p>the turkey groans and is in place</p>",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/execution-steps/51"
      }
    }
  }, {
    "_type" : "execution-step",
    "id" : 52,
    "execution_status" : "READY",
    "action" : "<p>release the slingshot</p>",
    "expected_result" : "<p>the turkey groans, at a distance though</p>",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/execution-steps/52"
      }
    }
  } ],
  "comment" : null,
  "prerequisite" : "",
  "description" : "<p>Will test the aerodynamic profile of a sample turkey</p>",
  "importance" : "LOW",
  "nature" : {
    "code" : "NAT_PERFORMANCE_TESTING"
  },
  "type" : {
    "code" : "TYP_COMPLIANCE_TESTING"
  },
  "test_case_status" : "WORK_IN_PROGRESS",
  "custom_fields" : [ ],
  "test_case_custom_fields" : [ ],
  "attachments" : [ ],
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/executions/25"
    },
    "project" : {
      "href" : "http://localhost:8080/api/rest/latest/projects/15"
    },
    "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/25/execution-steps"
    },
    "attachments" : {
      "href" : "http://localhost:8080/api/rest/latest/executions/25/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 test plan item of this execution

execution-steps

the link to the execution steps

attachments

the attachments to the test plan element

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
Accept: application/json
Content-Length: 451
Content-Type: application/json
Host: localhost:8080

{
  "_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-Length: 1176
Content-Type: application/json;charset=UTF-8

{
  "_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

Delete an execution

A DELETE to /executions/{id} delete one execution with the given id.

Path parameters

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

id

the list of ids of the execution

HTTP request

DELETE /api/rest/latest/executions/44 HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: localhost:8080

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)

HTTP response

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

{
  "_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)

Attach issue to an execution

A POST to /executions/{id}/issues attach an issue to an execution with given id. The identifier of the remote issue must be specified; however the bugtracker on which it is hosted is implied by the configuration of the Squash-TM project of the execution.

The actual format of the remote identifier depends on the type of bugtracker you are referencing. For example for issues hosted on Mantis the remote identifier is the ID, while for JIRA the remote identifier is the issue key. You can verify which format is expected in Squash-TM by testing first with the UI, eg in the table of known issues of an iteration.

Note that you cannot declare a new issue this way - post it straight to the bugtracker instead !

Path parameters

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

idExecution

the id of the execution

HTTP request

POST /api/rest/latest/executions/15/issues HTTP/1.1
Accept: application/json
Content-Length: 51
Content-Type: application/json
Host: localhost:8080

{
  "_type" : "issue",
  "remoteIssueId" : "9999"
}

Request fields

Path Type Description

_type

String

the type of the entity

remoteIssueId

String

the identifier of the issue

HTTP response

HTTP/1.1 201 Created
Content-Type: application/json;charset=UTF-8
Content-Length: 354

{
  "_type" : "issue",
  "id" : 30,
  "remoteIssueId" : "9999",
  "execution" : {
    "_type" : "execution",
    "id" : 15,
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/executions/15"
      }
    }
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/issues/30"
    }
  }
}