# Get Scenarios by Execution ID

This endpoint retrieves all scenarios associated with a specific test execution. The user must have the `SCENARIO_VIEW`authority to access this endpoint.

***

### Endpoint Information

* **URL**: `https://testinium.io/Testinium.RestApi/api/scenarios/execution/{executionId}`
* **Method**: `GET`
* **Authentication**: Required (`Bearer Token`)

***

### Path Parameters

| Parameter     | Type   | Required | Description                                            |
| ------------- | ------ | -------- | ------------------------------------------------------ |
| `executionId` | `Long` | Yes      | The unique ID of the execution to fetch scenarios for. |

***

### Response

The response contains a list of scenarios associated with the specified execution ID.

```json
[
    {
        "id": 23057,
        "type": "SELENIUM",
        "scenario_name": "TestScenarioSample",
        "description": "This scenario was generated by Testinium and connected to TestPlanSample",
        "enabled": true,
        "deleted": false,
        "execute_mode": "AUTOMATED",
        "source_file": "features/example.feature",
        "project_id": 1424,
        "plans": [
            3276,
            3362,
            3364
        ],
        "result_summary": {
            "WAITING": 1
        },
        "parameterized": false,
        "has_parameterized_class": false,
        "created_at": "2024-12-05T16:46:47Z",
        "updated_at": "2024-12-05T16:46:47Z",
        "created_by": "mehmetaksahin",
        "updated_by": "mehmetaksahin",
        "java_test_class": "com.testinium.CucumberRunner",
        "java_test_methods": "@example",
        "test_scenario_java_parameters": [],
        "group": false
    }
]
```

### Response Fields

| Field                           | Type               | Description                                               |
| ------------------------------- | ------------------ | --------------------------------------------------------- |
| `id`                            | `Long`             | The unique ID of the test scenario.                       |
| `type`                          | `String`           | The type of the scenario (e.g., `SELENIUM`).              |
| `scenario_name`                 | `String`           | The name of the test scenario.                            |
| `description`                   | `String`           | A description of the scenario.                            |
| `enabled`                       | `Boolean`          | Indicates whether the scenario is enabled.                |
| `deleted`                       | `Boolean`          | Indicates whether the scenario has been deleted.          |
| `execute_mode`                  | `String`           | The execution mode for the scenario (e.g., `AUTOMATED`).  |
| `source_file`                   | `String`           | The file path of the source feature file.                 |
| `project_id`                    | `Long`             | The ID of the project associated with the scenario.       |
| `plans`                         | `List<Long>`       | A list of plan IDs connected to the scenario.             |
| `result_summary`                | `Map<String, Int>` | The result summary for the scenario.                      |
| `parameterized`                 | `Boolean`          | Indicates if the scenario is parameterized.               |
| `has_parameterized_class`       | `Boolean`          | Indicates if the scenario has a parameterized class.      |
| `created_at`                    | `String` (ISO8601) | The creation date of the scenario.                        |
| `updated_at`                    | `String` (ISO8601) | The last update date of the scenario.                     |
| `created_by`                    | `String`           | The username of the person who created the scenario.      |
| `updated_by`                    | `String`           | The username of the person who last updated the scenario. |
| `java_test_class`               | `String`           | The Java test class associated with the scenario.         |
| `java_test_methods`             | `String`           | The Java test methods associated with the scenario.       |
| `test_scenario_java_parameters` | `List<Object>`     | A list of Java parameters for the test scenario.          |
| `group`                         | `Boolean`          | Indicates if the scenario belongs to a group.             |

***

### Error Codes

| HTTP Code | Error Message              | Description                                                |
| --------- | -------------------------- | ---------------------------------------------------------- |
| `401`     | `ACCESS_DENIED`            | The user lacks the `SCENARIO_VIEW` authority.              |
| `404`     | `EXECUTION_NOT_FOUND`      | No execution was found for the specified ID.               |
| `500`     | `USERS_COMPANY_NOT_EXISTS` | The company associated with the user does not exist.       |
| `500`     | `SYSTEM_INTERNAL_ERROR`    | An unexpected error occurred while processing the request. |

***

### Example Request

```bash
curl --location --request GET 'https://testinium.io/Testinium.RestApi/api/scenarios/execution/{executionId}' \  
--header 'Authorization: Bearer <your_access_token>'
```
