What's on this page

Executions

This section details the APIs for executing Scenarios and viewing the results.

Associated with each definition are details of the request parameters and responses. These include the name of each field plus a brief description and whether the field is mandatory. Whether a field is required or not is based on the context of the examples. The underlying API definition may mark a field as optional, but in some contexts, the fields must be supplied.

For a 40x, 50x or any other error response please see error response codes

Execute Scenario

Execute a Scenario, creating an execution record to view the outcome.

Request

AspectValue
Endpoint URL/api/behaviour/executions
Content-Typeapplication/json
HTTP MethodPOST

Headers

FieldDescriptionMandatory
AuthorizationExecuting user’s authorization tokenYes, if TNC-O is secure otherwise; no

Body

FieldDescriptionMandatory
scenarioIdID of the Scenario to executeYes
assemblyIdID of the assembly instance, if the Scenario requires a reference to an existing AssemblyYes, if an Assembly actor in the Scenario is marked as “provided” otherwise; no. Only need one of assemblyId or assemblyName
assemblyNameName of the assembly instance, if the Scenario requires a reference to an existing AssemblyYes, if an Assembly actor in the Scenario is marked as “provided” otherwise; no. Only need one of assemblyId or assemblyName

Example:

{
​  "scenarioId": "8e266bc5-e613-4b0d-9ae0-50db6454b026"
}

Response

AspectValue
Content-Typeapplication/json
Response Code201 (Created)

Headers

FieldDescription
locationEndpoint to created resource

Remove Execution

Removes record of an Execution. This does not cancel the Execution if it is running.

Request

AspectValue
Endpoint URL/api/behaviour/executions/{executionId}
HTTP MethodDELETE

Path Parameters

FieldDescriptionMandatory
executionIdID of the ExecutionYes

Response

AspectValue
Content-Typeapplication/json
Response Code204 (No Content)

Get all Executions

Retrieve all Executions by Scenario or Project (so all Scenarios in that Project)

Request

AspectValue
Endpoint URL/api/behaviour/executions?scenarioId={scenarioId}&projectId={projectId}
HTTP MethodGET

Query Parameters

FieldDescriptionMandatory
scenarioIdID of the Scenario to retrieve all Executions ofYes (if projectId is not set)
projectIdID of the Project to retrieve all Executions from all Scenarios within itYes (if scenarioId is not set)

Response

AspectValue
Content-Typeapplication/json
Response Code200 (OK)

Body

The body will contain a single list of Execution summaries. Each entry will have the following fields:

FieldDescription
idID assigned to the Execution
nameName assigned to the Execution
scenarioIdID of the Scenario being executed
createdAtDate and time the Execution was requested
lastModifiedAtDate and time the Execution instance was last modified
startedAtDate and time the Execution begun
finishedAtDate and time the Execution completed (may be empty if the Execution is currently running)
statusCurrent execution status (PASS, IN_PROGRESS, ABORTED, FAIL, PENDING)
scenarioSummarySummary of the Scenario being executed

The scenarioSummary contains:

FieldDescription
nameName of the Scenario
descriptionDescription of the Scenario

Example:

[
  {
​    "id": "7c132ad3-f126-2c1d-7fe1-42ac6234e145",
​    "name": "EX-01-03-19-15-27-43",
​    "createdAt": "2019-03-01T15:37:43.705Z",
​    "lastModifiedAt": "2019-03-01T15:37:43.705Z",
​    "startedAt": "2019-03-01T15:37:43.705Z",
​    "finishedAt": "2019-03-01T15:37:43.705Z",
​    "scenarioId": "8e266bc5-e613-4b0d-9ae0-50db6454b026",
​    "scenarioSummary": {
​      "description": "Test scenario",
​      "name": "Test Scenario"
​    },
​    "status": "PASS"
  }
]

Get Execution

Get the current status of an Execution

Request

AspectValue
Endpoint URL/api/behaviour/executions/{executionId}
HTTP MethodGET

Path Parameters

FieldDescriptionMandatory
executionIdID of the ExecutionYes

Response

AspectValue
Content-Typeapplication/json
Response Code200 (OK)

Body

FieldDescription
idID assigned to the Execution
nameName assigned to the Execution
scenarioIdID of the Scenario being executed
createdAtDate and time the Execution was requested
lastModifiedAtDate and time the Execution instance was last modified
startedAtDate and time the Execution started (may be empty if the Execution has not yet started)
finishedAtDate and time the Execution completed (may be empty if the Execution has not yet completed)
statusCurrent execution status (PASS, IN_PROGRESS, ABORTED, FAIL, PENDING)
scenarioSummarySummary of the Scenario being executed
stageReportsA list of reports for each Stage in the execution
registeredAssembliesDetails any Assemblies created or referenced as part of the Execution
registeredMetricsList of IDs for any Metrics recorded during the Execution
errorDetails of an error if one has occurred

The scenarioSummary contains:

FieldDescription
nameName of the Scenario
descriptionDescription of the Scenario

Each stageReport entry contains:

FieldDescription
nameName of the Stage
stepsList of reports for each step

Each stepReport entry contains:

FieldDescription
statusStatus of the step execution (PASS, IN_PROGRESS, ABORTED, FAIL, PENDING)
startTimeDate and time the step execution started (may be empty if the step has not yet started)
endTimeDate and time the step execution completed (may be empty if the step has not yet completed)
stepDisplayNameDisplay name of the step being executed
stepTypeType of step (PRECONDITION, ACTION, EXPECTATION)
slicesList of sentences detailing the action the steps takes
errorMessage detailing an error if one has occurred

Each registeredAssemblies entry contains:

FieldDescription
assemblyNameName of the Assembly instance
assemblyIdID of the Assembly instance
assemblyDescriptorNameName of the descriptor for this Assembly instance
installedBoolean set to true if the Assembly was installed as part of this Scenario Execution
uninstalledBoolean set to true if the Assembly was uninstalled as part of this Scenario Execution

Example:

{
  "id": "7c132ad3-f126-2c1d-7fe1-42ac6234e145",
  "name": "EX-01-03-19-15-27-43",
  "createdAt": "2019-03-01T16:03:54.278Z",
  "lastModifiedAt": "2019-03-01T16:03:54.278Z",
  "finishedAt": "2019-03-01T16:03:54.278Z",
  "startedAt": "2019-03-01T16:03:54.278Z",
  "status": "PASS"
  "error": null,
  "scenarioId": "8e266bc5-e613-4b0d-9ae0-50db6454b026",
  "scenarioSummary": {
​    "description": "Test scenario",
​    "name": "Test Scenario"
  },
  "registeredAssemblies": [
​    {
​      "assemblyDescriptorName": "TestInstance",
​      "assemblyId": "7a243de5-a324-3c1a-8af1-40ac1256a136",
​      "assemblyName": "TestInstance",
​      "installed": true,
​      "uninstalled": true
​    }
  ],
  "registeredMetrics": [
    "6f122fa4-a219-2a2f-7be5-81bd2346b010"
  ],
  "stageReports": [
​    {
​      "name": "Test Stage",
​      "status": "PASS",
​      "steps": [
​        {
​          "endTime": "2019-03-01T16:03:54.278Z",
​          "error": "string",
​          "slices": [
​            "I change the state of an assembly called TestInstance to Inactive"
​          ],
​          "startTime": "2019-03-01T16:03:54.278Z",
​          "status": "PASS",
​          "stepDisplayName": "Change Assembly State",
​          "stepType": "ACTION"
​        }
​      ]
​    }
  ]
}

Get Execution Progress Summary

Get a summarized version of the current status of an Execution

Request

AspectValue
Endpoint URL/api/behaviour/executions/{executionId}/progress
HTTP MethodGET

Path Parameters

FieldDescriptionMandatory
executionIdID of the ExecutionYes

Response

AspectValue
Content-Typeapplication/json
Response Code200 (OK)

Body

FieldDescription
idID assigned to the Execution
nameName assigned to the Execution
startedAtDate and time the Execution started (may be empty if the Execution has not yet started)
finishedAtDate and time the Execution completed (may be empty if the Execution has not yet completed)
statusCurrent execution status (PASS, IN_PROGRESS, ABORTED, FAIL, PENDING)
stageReportsA list of reports for each Stage in the execution
registeredAssembliesDetails any Assemblies created or referenced as part of the Execution
registeredMetricsList of IDs for any Metrics recorded during the Execution
errorDetails of an error if one has occurred

Each stageReport entry contains:

FieldDescription
nameName of the Stage
stepsList of reports for each step

Each stepReport entry contains:

FieldDescription
statusStatus of the step execution (PASS, IN_PROGRESS, ABORTED, FAIL, PENDING)
startTimeDate and time the step execution started (may be empty if the step has not yet started)
endTimeDate and time the step execution completed (may be empty if the step has not yet completed)
stepDisplayNameDisplay name of the step being executed
stepTypeType of step (PRECONDITION, ACTION, EXPECTATION)
slicesList of sentences detailing the action the steps takes
errorMessage detailing an error if one has occurred

Each registeredAssemblies entry contains:

FieldDescription
assemblyNameName of the Assembly instance
assemblyIdID of the Assembly instance
assemblyDescriptorNameName of the descriptor for this Assembly instance
installedBoolean set to true if the Assembly was installed as part of this Scenario Execution
uninstalledBoolean set to true if the Assembly was uninstalled as part of this Scenario Execution

Get all Execution Metrics

Get all of the Metrics recorded during an Execution of a Scenario. Metrics are only recorded if a step has been executed which starts recording.

Request

AspectValue
Endpoint URL/api/behaviour/executions/{executionId}/metrics
HTTP MethodGET

Path Parameters

FieldDescriptionMandatory
executionIdID of the ExecutionYes

Response

AspectValue
Content-Typeapplication/json
Response Code200 (OK)

Body

A list of a Metrics, each entry containing:

FieldDescription
idID of the Metric (unique within the context of the Execution)
nameName of the Metric
executionIdID of the Execution this Metric belongs to
metricThresholdsList of any thresholds set on this Metric. Only included if a step defining a Metric has been executed in a Scenario
dataKey/value pairs of any values recorded, keyed by their timestamp

Example:

[
  {
​    "data": {
      "1572260858613": "5",
      "1572260865985": "7"
​    },
​    "executionId": "7c132ad3-f126-2c1d-7fe1-42ac6234e145",
​    "id": "6f122fa4-a219-2a2f-7be5-81bd2346b010",
​    "metricThresholds": [
​      {
​        "endTime": 1572260865985,
​        "startTime": 1572260858613,
​        "type": "less than",
​        "value": 10
​      }
​    ],
​    "name": "Example Metric"
  }
]

Get Execution Metric

Get a single Metrics recorded during an Execution of a Scenario. Metrics are only recorded if a step has been executed which starts recording.

Request

AspectValue
Endpoint URL/api/behaviour/executions/{executionId}/metrics/{metricId}
HTTP MethodGET

Path Parameters

FieldDescriptionMandatory
executionIdID of the ExecutionYes
metricIdID of the MetricYes

Response

AspectValue
Content-Typeapplication/json
Response Code200 (OK)

Body

FieldDescription
idID of the Metric (unique within the context of the Execution)
nameName of the Metric
executionIdID of the Execution this Metric belongs to
metricThresholdsList of any thresholds set on this Metric. Only included if a step defining a Metric has been executed in a Scenario
dataKey/value pairs of any values recorded, keyed by their timestamp

Example:

{
​    "data": {
    "1572260858613": "5",
    "1572260865985": "7"
​    },
​    "executionId": "7c132ad3-f126-2c1d-7fe1-42ac6234e145",
​    "id": "6f122fa4-a219-2a2f-7be5-81bd2346b010",
​    "metricThresholds": [
​      {
​        "endTime": 1572260865985,
​        "startTime": 1572260858613,
​        "type": "less than",
​        "value": 10
​      }
​    ],
​    "name": "Example Metric"
}

Cancel Execution

Cancel a currently running Execution. Any steps currently executing may still complete but future steps will be cancelled.

Request

AspectValue
Endpoint URL/api/behaviour/executions/{executionId}/cancel
HTTP MethodPOST

Path Parameters

FieldDescriptionMandatory
executionIdID of the ExecutionYes

Response

AspectValue
Content-Typeapplication/json
Response Code202 (Accepted)

Body

FieldDescription
successTrue, if the Execution was cancelled. Will return false only if the Execution had already completed, so could not be cancelled