Create a Scenario
/runtime/scenario
Request
There are no request parameters for this operation.
Back to TopResponse
201 Response
Examples
The following example shows how to create a new scenario by submitting a POST request on the REST resource using cURL. For more information about cURL, see "Use cURL".
The -d option specifies the file to attach as the request body.
curl -X POST "hostname:port/runtime/scenario" -H "accept: */*" -H "Content-Type: application/json" -d @file.json
where:
- file.json is the JSON file the scenario details to create.
Example of Request Body
The following is an example of the contents of file.json sent as the request body:
{
"name": "Subscriber Creation and Purchase Event",
"description": "Subscriber Creation and Purchase Event",
"type": null,
"namespace": null,
"tags": null,
"id": "1",
"mode": null,
"priority": 0,
"testScenarioResult": null,
"loadedFromConfig": false,
"cases": [
{
"name": "Create a todo list and view them",
"description": null,
"type": null,
"namespace": null,
"tags": null,
"id": "1",
"mode": null,
"priority": 0,
"hasChildren": false,
"parent": null,
"persona": null,
"hasCondition": false,
"conditions": null,
"testCaseResult": null,
"child": false,
"cases": [],
"steps": [
{
"name": "Given delete all todo tasks, for cleanup before running automation.",
"description": null,
"type": null,
"namespace": null,
"tags": null,
"id": "1",
"action": {
"path": "todo/delete/delete-all-todo-tasks",
"name": "Delete all todo tasks",
"description": "Delete all todo tasks",
"tags": [
"todo",
"delete",
"all"
],
"bdd": "delete all todo tasks",
"product": "todo",
"actionType": "REST",
"location": "",
"resource": "todo",
"method": "DELETE",
"queryParameters": null,
"request": null,
"requestType": null,
"requestVariables": null,
"responseVariables": null,
"expectedStatusCode": 202,
"requestString": null
},
"actionPath": null,
"behaviour": null,
"validations": [],
"dataVariables": [
{
"property": "id",
"value": "all",
"runtimeValue": null
}
],
"saveVariables": [],
"reference": null,
"conditions": [],
"repeatTimes": null,
"repeatUntil": null,
"repeatWhile": null,
"runtimeInfo": {
"runtimeURL": null,
"runtimeStatusCode": 0,
"expectedStatusCode": 0,
"request": null,
"response": null,
"status": "NOT_EXECUTED"
},
"stepResult": null,
"actionType": "REST",
"statusValidation": null
},
{
"name": "When add todo task, for buying hardware",
"description": null,
"type": null,
"namespace": null,
"tags": null,
"id": "2",
"action": {
"path": "TodoApp/add-todo-tasks/add-one-todo-task",
"name": "Add one todo task",
"description": "Add one todo task",
"tags": [
"todo",
"read"
],
"bdd": "add todo task",
"product": "todo",
"actionType": "REST",
"location": "",
"resource": "todo",
"method": "POST",
"queryParameters": null,
"request": "add-one-todo-task.request.json",
"requestType": "FILE",
"requestVariables": null,
"responseVariables": null,
"expectedStatusCode": 200,
"requestString": "{\r\n \"name\" : \"Generate Automation Tasks\",\r\n \"description\" : \"Generate Automation Tasks\"\r\n}\r\n"
},
"actionPath": null,
"behaviour": null,
"validations": [
{
"property": "$status",
"propertyValue": null,
"value": "200",
"runtimeValue": null,
"result": false
}
],
"dataVariables": [
{
"property": "name",
"value": "Generate Automation Tasks",
"runtimeValue": null
},
{
"property": "description",
"value": "Generate Automation Tasks",
"runtimeValue": null
}
],
"saveVariables": [
{
"variable": "firstTask.id",
"value": "id",
"runtimeValue": null
},
{
"variable": "firstTask.name",
"value": "name",
"runtimeValue": null
},
{
"variable": "firstTask.description",
"value": "description",
"runtimeValue": null
}
],
"reference": null,
"conditions": [],
"repeatTimes": null,
"repeatUntil": null,
"repeatWhile": null,
"runtimeInfo": {
"runtimeURL": null,
"runtimeStatusCode": 0,
"expectedStatusCode": 0,
"request": null,
"response": null,
"status": "NOT_EXECUTED"
},
"stepResult": null,
"actionType": "REST",
"statusValidation": null
},
{
"name": "Then read todo task, by id",
"description": null,
"type": null,
"namespace": null,
"tags": null,
"id": "3",
"action": {
"path": "TodoApp/read-todo-tasks/read-todo-task-by-id",
"name": "Read todo task by id",
"description": "Read todo task by id",
"tags": [
"todo",
"read"
],
"bdd": "read todo task",
"product": "todo",
"actionType": "REST",
"location": "",
"resource": "todo",
"method": "GET",
"queryParameters": null,
"request": null,
"requestType": null,
"requestVariables": null,
"responseVariables": null,
"expectedStatusCode": 200,
"requestString": null
},
"actionPath": null,
"behaviour": null,
"validations": [
{
"property": "$status",
"propertyValue": null,
"value": "200",
"runtimeValue": null,
"result": false
},
{
"property": "name",
"propertyValue": null,
"value": "Automation Test",
"runtimeValue": null,
"result": false
},
{
"property": "description",
"propertyValue": null,
"value": "Generate Automation Tasks",
"runtimeValue": null,
"result": false
},
{
"property": "status",
"propertyValue": null,
"value": "TODO",
"runtimeValue": null,
"result": false
}
],
"dataVariables": [
{
"property": "id",
"value": "1",
"runtimeValue": null
}
],
"saveVariables": [],
"reference": null,
"conditions": [],
"repeatTimes": null,
"repeatUntil": null,
"repeatWhile": null,
"runtimeInfo": {
"runtimeURL": null,
"runtimeStatusCode": 0,
"expectedStatusCode": 0,
"request": null,
"response": null,
"status": "NOT_EXECUTED"
},
"stepResult": null,
"actionType": "REST",
"statusValidation": null
}
]
}
]
}
Example of Response Body
If successful, the response code 201 is returned along with a header. For example:
{
"_id": 80
}
If the request fails, the response includes the appropriate HTTP code. For a 4xx/5xx code, the message body also contains a ProblemDetails structure with the cause attribute set to the appropriate application error.