Resource: Script Assignment Runs ( /api/scriptassignment/{id}/runs )

Runs collection resource associated with a script assignment, can be used to retrieve a list of existing runs or to create a new run.

This resource supports the following methods: GET, POST

Methods

GET


Retrieves all (or a subset) of script runs for a script assignment.

This method supports the OData parameters $filter, $top, $take, $orderby and $inlinecount. See OData Topic for more details.

Required Permissions

  • TestManagement/ManageExecutions/View

Supported Expansions

For more details on expansions, please see the Expand help topic.

Status Codes

These are the expected status codes returned by the service. In addition, some other status codes may be returned if either an internal error occurs or there is an authentication issue (such as an expired OAuth token).

StatusDescription
200 - OKReturned if the request was completed successfully.
403 - ForbiddenReturned if you do not have permission to view this script assignment's runs.
404 - NotFoundReturned if the script assignment does not exist.

Example - GET all runs

Retrieves all the script runs associated with the script assignment.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
{id}2264a622-2869-4ef8-8183-a0040106ca9dThe unique identifier (GUID) of the script assignment to fetch runs for

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Items": [
    {
      "Id": "eb6b327c-df59-4f26-aa8d-a089009f0d1b",
      "ScriptId": "3503ada7-6f77-46ba-a083-a84747d53b2c",
      "ScriptVersion": 1,
      "AssignmentId": "2264a622-2869-4ef8-8183-a0040106ca9d",
      "CreatedAt": "2012-02-02T15:05:06Z",
      "LastUpdatedAt": "2012-02-02T15:05:06Z",
      "CreatedById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
      "CreatedBy": "joeb",
      "RunById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
      "RunBy": "joeb",
      "LastUpdatedById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
      "LastUpdatedBy": "joeb",
      "Status": "In Progress",
      "Expands": [
        "Assignment",
        "StepResults"
      ],
      "Self": "http://localhost/api/scriptrun/eb6b327c-df59-4f26-aa8d-a089009f0d1b"
    },
    {
      "Id": "eb6b327c-df59-4f26-aa8d-a089009f0d1b",
      "ActualDuration": "5 minutes",
      "ScriptId": "3503ada7-6f77-46ba-a083-a84747d53b2c",
      "ScriptVersion": 1,
      "AssignmentId": "2264a622-2869-4ef8-8183-a0040106ca9d",
      "CreatedAt": "2012-01-01T14:04:05Z",
      "LastUpdatedAt": "2012-01-01T14:04:05Z",
      "CreatedById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
      "CreatedBy": "joeb",
      "RunById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
      "RunBy": "joeb",
      "LastUpdatedById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
      "LastUpdatedBy": "joeb",
      "Status": "Failed",
      "Expands": [
        "Assignment",
        "StepResults"
      ],
      "Self": "http://localhost/api/scriptrun/eb6b327c-df59-4f26-aa8d-a089009f0d1b"
    }
  ]
}

Status Code

200 - OK

Example - GET runs filtered by date

Retrieves the runs filtered by year.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
{id}2264a622-2869-4ef8-8183-a0040106ca9dThe unique identifier (GUID) of the script assignment to fetch runs for.
$filteryear(CreatedAt) eq 2011Return all runs where the CreatedAt year is 2011.

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Items": [
    {
      "Id": "eb6b327c-df59-4f26-aa8d-a089009f0d1b",
      "ActualDuration": "5 minutes",
      "ScriptId": "3503ada7-6f77-46ba-a083-a84747d53b2c",
      "ScriptVersion": 1,
      "AssignmentId": "2264a622-2869-4ef8-8183-a0040106ca9d",
      "CreatedAt": "2011-01-01T14:04:05Z",
      "LastUpdatedAt": "2011-01-01T14:04:05Z",
      "CreatedById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
      "CreatedBy": "joeb",
      "RunById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
      "RunBy": "joeb",
      "LastUpdatedById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
      "LastUpdatedBy": "joeb",
      "Status": "Failed",
      "Expands": [
        "Assignment",
        "StepResults"
      ],
      "Self": "http://localhost/api/scriptrun/eb6b327c-df59-4f26-aa8d-a089009f0d1b"
    }
  ]
}

Status Code

200 - OK

POST


Create a new run, or retrieves the existing incomplete run.

Required Permissions

  • TestManagement/ManageExecutions/ExecuteAllTests
  • TestManagement/ManageExecutions/ExecuteOnlyMyTests

Supported Expansions

For more details on expansions, please see the Expand help topic.

Status Codes

These are the expected status codes returned by the service. In addition, some other status codes may be returned if either an internal error occurs or there is an authentication issue (such as an expired OAuth token).

StatusDescription
200 - OKReturned if the existing run was returned.
201 - CreatedReturned if a new run was created.
403 - ForbiddenReturned if you do not have permission to create a new run.
404 - NotFoundReturned if the script assignment does not exist.

Example - POST with no body

In this example the state of the current run is complete, so when posting with no body we end up creating a new run.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
{id}2264a622-2869-4ef8-8183-a0040106ca9dThe unique identifier (GUID) of the script assignment to add a new run to.

Response Headers

KeyValueDescription
Locationhttp://localhost/api/scriptrun/eb6b327c-df59-4f26-aa8d-a089009f0d1b
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Id": "eb6b327c-df59-4f26-aa8d-a089009f0d1b",
  "ScriptId": "3503ada7-6f77-46ba-a083-a84747d53b2c",
  "ScriptVersion": 2,
  "AssignmentId": "2264a622-2869-4ef8-8183-a0040106ca9d",
  "CreatedAt": "2012-01-01T14:04:05Z",
  "LastUpdatedAt": "2012-01-01T14:04:05Z",
  "CreatedById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
  "CreatedBy": "joeb",
  "RunById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
  "RunBy": "joeb",
  "LastUpdatedById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
  "LastUpdatedBy": "joeb",
  "Status": "In Progress",
  "Expands": [
    "Assignment",
    "StepResults"
  ],
  "Self": "http://localhost/api/scriptrun/eb6b327c-df59-4f26-aa8d-a089009f0d1b"
}

Status Code

201 - Created

Example - POST with body

In this example the state of the current run is complete, so when posting we end up creating a new run. This example also shows using a request body to specify the tester for the new run, and an expand of StepResults.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
{id}2264a622-2869-4ef8-8183-a0040106ca9dThe unique identifier (GUID) of the script assignment to add a new run to.
$expandStepResultsExpand the StepResults collection in the response (shows the unique identifiers of each step).

Request Body

{
  "TesterId": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
  "WidgetValues": null,
  "FieldValues": null
}

Response Headers

KeyValueDescription
Locationhttp://localhost/api/scriptrun/eb6b327c-df59-4f26-aa8d-a089009f0d1b
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Id": "eb6b327c-df59-4f26-aa8d-a089009f0d1b",
  "ScriptId": "3503ada7-6f77-46ba-a083-a84747d53b2c",
  "ScriptVersion": 2,
  "AssignmentId": "2264a622-2869-4ef8-8183-a0040106ca9d",
  "CreatedAt": "2012-01-01T14:04:05Z",
  "LastUpdatedAt": "2012-01-01T14:04:05Z",
  "CreatedById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
  "CreatedBy": "joeb",
  "RunById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
  "RunBy": "joeb",
  "LastUpdatedById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
  "LastUpdatedBy": "joeb",
  "Status": "In Progress",
  "Expands": [
    "Assignment",
    "StepResults"
  ],
  "StepResults": [
    {
      "RunId": "00000000-0000-0000-0000-000000000000",
      "Id": "68efb707-e4d1-4616-af1c-54cb519de480",
      "Description": "Do this",
      "Data": null,
      "Notes": null,
      "ExpectedResult": "Expect that",
      "ActualResult": null,
      "Outcome": "NotRun",
      "HasIncidents": false,
      "HasAttachments": false,
      "Self": "http://localhost/api/stepresult/68efb707-e4d1-4616-af1c-54cb519de480"
    },
    {
      "RunId": "00000000-0000-0000-0000-000000000000",
      "Id": "8423fe61-bcf3-466c-841c-9ac19b6a4a4b",
      "Description": "And then Do this",
      "Data": null,
      "Notes": null,
      "ExpectedResult": "And then Expect that",
      "ActualResult": null,
      "Outcome": "NotRun",
      "HasIncidents": false,
      "HasAttachments": false,
      "Self": "http://localhost/api/stepresult/8423fe61-bcf3-466c-841c-9ac19b6a4a4b"
    }
  ],
  "Self": "http://localhost/api/scriptrun/eb6b327c-df59-4f26-aa8d-a089009f0d1b"
}

Status Code

201 - Created

Example - POST with no body (when current run in-progress)

In this example the state of the current run is in progress, so when posting with no body we end up getting back the current run (signified by the Status of 'OK' instead of 'Created').

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
{id}2264a622-2869-4ef8-8183-a0040106ca9dThe unique identifier (GUID) of the script assignment to add a new run to.

Response Headers

KeyValueDescription
Locationhttp://localhost/api/scriptrun/eb6b327c-df59-4f26-aa8d-a089009f0d1b
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Id": "eb6b327c-df59-4f26-aa8d-a089009f0d1b",
  "ScriptId": "3503ada7-6f77-46ba-a083-a84747d53b2c",
  "ScriptVersion": 2,
  "AssignmentId": "2264a622-2869-4ef8-8183-a0040106ca9d",
  "CreatedAt": "2012-01-01T14:04:05Z",
  "LastUpdatedAt": "2012-01-01T14:04:05Z",
  "CreatedById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
  "CreatedBy": "joeb",
  "RunById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
  "RunBy": "joeb",
  "LastUpdatedById": "e7157154-5f93-4ec4-bde3-0a3e5c66b04a",
  "LastUpdatedBy": "joeb",
  "Status": "In Progress",
  "Expands": [
    "Assignment",
    "StepResults"
  ],
  "Self": "http://localhost/api/scriptrun/eb6b327c-df59-4f26-aa8d-a089009f0d1b"
}

Status Code

200 - OK

  • No labels