What's on this page

Scenarios

The following details the API to manage Scenarios within TNC-O.

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

Create Scenario

Create a new Scenario

Request

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

Body

FieldDescriptionMandatory
nameName of the ScenarioYes
descriptionSupplied description of the ScenarioNo
projectIdUnique identifier for the behaviour test Project this Assembly Configuration belongs toYes
stagesA list of stages, each containing the steps to execute in this ScenarioYes
assemblyActorsA list of Assembly Configurations to use within the ScenarioYes

Each stages entry contains the following fields:

FieldDescriptionMandatory
nameName of the StageYes
stepsList of steps to execute in this StageYes

Each assemblyActors entry contains the following fields:

FieldDescriptionMandatory
instanceNameName to refer to this actor throughout the Scenario. If the instance is one to be instantiated, this name will be used as the instance nameYes
assemblyConfigurationIdID of the Assembly Configuration to instantiate this instance fromYes (if provided is false)
initialStateState to create the instance in (Installed, Inactive, Active)Yes (if provided is false)
uninstallOnExitEnable/disable the uninstallation of the instance after the Scenario completes successfullyYes (if provided is false)
providedDictates if the actor is an existing instance of an Assembly OR to be instantiated from an Assembly ConfigurationYes

Example:

{
​    "name": "test-scale-in",
​    "projectId": "assembly::Test::1.0",
​    "description": "description",
​    "stages": [
​      {
​        "name": "Test Stage",
​        "steps": [
​          {
​            "stepDefinitionName": "IntentEngine::CreateAssembly"
​            "properties": {
​              "additionalProp1": "string",
​              "additionalProp2": "string",
​              "additionalProp3": "string"
​            },
​          }
​        ]
​      }
​    ],
​    "assemblyActors": [
​      {
​        "assemblyConfigurationId": "7f456ac3-a523-2c1d-2cd1-42dc6124b012",
​        "initialState": "Active",
​        "instanceName": "TestInstance",
​        "provided": false,
​        "uninstallOnExit": true
​      }
​    ]
}

Response

AspectValue
Content-Typeapplication/json
Response Code201 (Created)

Headers

FieldDescription
locationEndpoint to created resource

Body

FieldDescription
idID assigned to the Scenario
nameName of the Scenario
descriptionSupplied description of the Scenario
projectIdUnique identifier for the behaviour test Project this Assembly Configuration belongs to
stagesA list of stages, each containing the steps to execute in this Scenario
assemblyActorsA list of Assembly Configurations to use within the Scenario
createdAtDate and time the Scenario instance was created
lastModifiedAtDate and time the Scenario instance was last modified

Each stages entry contains the following fields:

FieldDescription
nameName of the Stage
stepsList of steps to execute in this Stage

Each assemblyActors entry contains the following fields:

FieldDescription
instanceNameName to refer to this actor throughout the Scenario. If the instance is one to be instantiated, this name will be used as the instance name
assemblyConfigurationIdID of the Assembly Configuration to instantiate this instance from
initialStateState to create the instance in (Installed, Inactive, Active)
uninstallOnExitEnable/disable the uninstallation of the instance after the Scenario completes successfully
providedDictates if the actor is an existing instance of an Assembly OR to be instantiated from an Assembly Configuration

Example:

{
​    "id": "8e266bc5-e613-4b0d-9ae0-50db6454b026",
​    "name": "test-scale-in",
​    "projectId": "assembly::Test::1.0",
​    "description": "description",
    "createdAt": "2019-03-01T14:41:07.716Z",
​    "lastModifiedAt": "2019-03-01T14:41:07.716Z",
​    "stages": [
​      {
​        "name": "Test Stage",
​        "steps": [
​          {
​            "stepDefinitionName": "IntentEngine::CreateAssembly"
​            "properties": {
​              "additionalProp1": "string",
​              "additionalProp2": "string",
​              "additionalProp3": "string"
​            },
​          }
​        ]
​      }
​    ],
​    "assemblyActors": [
​      {
​        "assemblyConfigurationId": "7f456ac3-a523-2c1d-2cd1-42dc6124b012",
​        "initialState": "Active",
​        "instanceName": "TestInstance",
​        "provided": false,
​        "uninstallOnExit": true
​      }
​    ]
}

Update Scenario

Update a Scenario

Request

AspectValue
Endpoint URL/api/behaviour/scenarios/{scenarioId}
HTTP MethodPUT

Path Parameters

FieldDescriptionMandatory
scenarioIdID of the ScenarioYes

Body

FieldDescriptionMandatory
nameName of the ScenarioYes
descriptionSupplied description of the ScenarioYes
projectIdUnique identifier for the behaviour test Project this Assembly Configuration belongs toYes
stagesA list of stages, each containing the steps to execute in this ScenarioYes
assemblyActorsA list of Assembly Configurations to use within the ScenarioYes

Each stages entry contains the following fields:

FieldDescriptionMandatory
nameName of the StageYes
stepsList of steps to execute in this StageYes

Each assemblyActors entry contains the following fields:

FieldDescriptionMandatory
instanceNameName to refer to this actor throughout the Scenario. If the instance is one to be instantiated, this name will be used as the instance nameYes
assemblyConfigurationIdID of the Assembly Configuration to instantiate this instance fromYes (if provided is false)
initialStateState to create the instance in (Installed, Inactive, Active)Yes (if provided is false)
uninstallOnExitEnable/disable the uninstallation of the instance after the Scenario completes successfullyYes (if provided is false)
providedDictates if the actor is an existing instance of an Assembly OR to be instantiated from an Assembly ConfigurationYes

Example:

{
​    "name": "test-scale-in",
​    "projectId": "assembly::Test::1.0",
​    "description": "description",
​    "stages": [
​      {
​        "name": "Test Stage",
​        "steps": [
​          {
​            "stepDefinitionName": "IntentEngine::CreateAssembly"
​            "properties": {
​              "additionalProp1": "string",
​              "additionalProp2": "string",
​              "additionalProp3": "string"
​            },
​          }
​        ]
​      }
​    ],
​    "assemblyActors": [
​      {
​        "assemblyConfigurationId": "7f456ac3-a523-2c1d-2cd1-42dc6124b012",
​        "initialState": "Active",
​        "instanceName": "TestInstance",
​        "provided": false,
​        "uninstallOnExit": true
​      }
​    ]
}

Response

AspectValue
Content-Typeapplication/json
Response Code200 (OK)

Body

FieldDescription
idID assigned to the Scenario
nameName of the Scenario
descriptionSupplied description of the Scenario
projectIdUnique identifier for the behaviour test Project this Assembly Configuration belongs to
stagesA list of stages, each containing the steps to execute in this Scenario
assemblyActorsA list of Assembly Configurations to use within the Scenario
createdAtDate and time the Scenario instance was created
lastModifiedAtDate and time the Scenario instance was last modified

Each stages entry contains the following fields:

FieldDescription
nameName of the Stage
stepsList of steps to execute in this Stage

Each assemblyActors entry contains the following fields:

FieldDescription
instanceNameName to refer to this actor throughout the Scenario. If the instance is one to be instantiated, this name will be used as the instance name
assemblyConfigurationIdID of the Assembly Configuration to instantiate this instance from
initialStateState to create the instance in (Installed, Inactive, Active)
uninstallOnExitEnable/disable the uninstallation of the instance after the Scenario completes successfully
providedDictates if the actor is an existing instance of an Assembly OR to be instantiated from an Assembly Configuration

Example:

{
​    "id": "8e266bc5-e613-4b0d-9ae0-50db6454b026",
​    "name": "test-scale-in",
​    "projectId": "assembly::Test::1.0",
​    "description": "description",
    "createdAt": "2019-03-01T14:41:07.716Z",
​    "lastModifiedAt": "2019-03-01T14:41:07.716Z",
​    "stages": [
​      {
​        "name": "Test Stage",
​        "steps": [
​          {
​            "stepDefinitionName": "IntentEngine::CreateAssembly"
​            "properties": {
​              "additionalProp1": "string",
​              "additionalProp2": "string",
​              "additionalProp3": "string"
​            },
​          }
​        ]
​      }
​    ],
​    "assemblyActors": [
​      {
​        "assemblyConfigurationId": "7f456ac3-a523-2c1d-2cd1-42dc6124b012",
​        "initialState": "Active",
​        "instanceName": "TestInstance",
​        "provided": false,
​        "uninstallOnExit": true
​      }
​    ]
}

Remove Scenario

Remove a Scenario (and all it’s executions)

Request

AspectValue
Endpoint URL/api/behaviour/scenarios/{scenarioId}
HTTP MethodDELETE

Path Parameters

FieldDescriptionMandatory
scenarioIdID of the ScenarioYes

Response

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

Get all Scenarios

Retrieve all Scenarios in a behaviour testing Project (descriptor)

Request

AspectValue
Endpoint URL/api/behaviour/scenarios?projectId={projectId}
HTTP MethodGET

Query Parameters

FieldDescriptionMandatory
projectIdID of the behaviour testing project (usually the descriptor name)Yes

Response

AspectValue
Content-Typeapplication/json
Response Code200 (OK)

Body

The body will contain a single list of Scenarios. Each Scenario will have the following fields:

FieldDescription
idID assigned to the Scenario
nameName of the Scenario
descriptionSupplied description of the Scenario
projectIdUnique identifier for the behaviour test Project this Assembly Configuration belongs to
stagesA list of stages, each containing the steps to execute in this Scenario
assemblyActorsA list of Assembly Configurations to use within the Scenario
createdAtDate and time the Scenario instance was created
lastModifiedAtDate and time the Scenario instance was last modified

Each stages entry contains the following fields:

FieldDescription
nameName of the Stage
stepsList of steps to execute in this Stage

Each assemblyActors entry contains the following fields:

FieldDescription
instanceNameName to refer to this actor throughout the Scenario. If the instance is one to be instantiated, this name will be used as the instance name
assemblyConfigurationIdID of the Assembly Configuration to instantiate this instance from
initialStateState to create the instance in (Installed, Inactive, Active)
uninstallOnExitEnable/disable the uninstallation of the instance after the Scenario completes successfully
providedDictates if the actor is an existing instance of an Assembly OR to be instantiated from an Assembly Configuration

Example:

[
  {
  ​    "id": "8e266bc5-e613-4b0d-9ae0-50db6454b026",
  ​    "name": "test-scale-in",
  ​    "projectId": "assembly::Test::1.0",
  ​    "description": "description",
      "createdAt": "2019-03-01T14:41:07.716Z",
  ​    "lastModifiedAt": "2019-03-01T14:41:07.716Z",
  ​    "stages": [
  ​      {
  ​        "name": "Test Stage",
  ​        "steps": [
  ​          {
  ​            "stepDefinitionName": "IntentEngine::CreateAssembly"
  ​            "properties": {
  ​              "additionalProp1": "string",
  ​              "additionalProp2": "string",
  ​              "additionalProp3": "string"
  ​            },
  ​          }
  ​        ]
  ​      }
  ​    ],
  ​    "assemblyActors": [
  ​      {
  ​        "assemblyConfigurationId": "7f456ac3-a523-2c1d-2cd1-42dc6124b012",
  ​        "initialState": "Active",
  ​        "instanceName": "TestInstance",
  ​        "provided": false,
  ​        "uninstallOnExit": true
  ​      }
  ​    ]
  },
  ...
]

Get Scenario

Retrieve a single Scenario by ID

Request

AspectValue
Endpoint URL/api/behaviour/scenarios/{scenarioId}
HTTP MethodGET

Path Parameters

FieldDescriptionMandatory
scenarioIdID of the ScenarioYes

Response

AspectValue
Content-Typeapplication/json
Response Code200 (OK)

Body

FieldDescription
idID assigned to the Scenario
nameName of the Scenario
descriptionSupplied description of the Scenario
projectIdUnique identifier for the behaviour test Project this Assembly Configuration belongs to
stagesA list of stages, each containing the steps to execute in this Scenario
assemblyActorsA list of Assembly Configurations to use within the Scenario
createdAtDate and time the Scenario instance was created
lastModifiedAtDate and time the Scenario instance was last modified

Each stages entry contains the following fields:

FieldDescription
nameName of the Stage
stepsList of steps to execute in this Stage

Each assemblyActors entry contains the following fields:

FieldDescription
instanceNameName to refer to this actor throughout the Scenario. If the instance is one to be instantiated, this name will be used as the instance name
assemblyConfigurationIdID of the Assembly Configuration to instantiate this instance from
initialStateState to create the instance in (Installed, Inactive, Active)
uninstallOnExitEnable/disable the uninstallation of the instance after the Scenario completes successfully
providedDictates if the actor is an existing instance of an Assembly OR to be instantiated from an Assembly Configuration

Example:

{
​    "id": "8e266bc5-e613-4b0d-9ae0-50db6454b026",
​    "name": "test-scale-in",
​    "projectId": "assembly::Test::1.0",
​    "description": "description",
    "createdAt": "2019-03-01T14:41:07.716Z",
​    "lastModifiedAt": "2019-03-01T14:41:07.716Z",
​    "stages": [
​      {
​        "name": "Test Stage",
​        "steps": [
​          {
​            "stepDefinitionName": "IntentEngine::CreateAssembly"
​            "properties": {
​              "additionalProp1": "string",
​              "additionalProp2": "string",
​              "additionalProp3": "string"
​            },
​          }
​        ]
​      }
​    ],
​    "assemblyActors": [
​      {
​        "assemblyConfigurationId": "7f456ac3-a523-2c1d-2cd1-42dc6124b012",
​        "initialState": "Active",
​        "instanceName": "TestInstance",
​        "provided": false,
​        "uninstallOnExit": true
​      }
​    ]
}