# Test Suite

DevDynamics provides seamless integration for test automation suites, allowing engineering teams to send detailed test run data to the platform. This integration enables teams to gain actionable insights into test performance, identify bottlenecks, and track quality trends across projects.

### Integration Overview

To integrate your test automation suite with DevDynamics, you need to send test run data via the provided API endpoint. The payload includes details such as test suite name, environment, test run status, and individual test case results.

### Firewall Configuration <a href="#firewall-configuration" id="firewall-configuration"></a>

To enable connection to DevDynamics, permit outbound traffic for:

* **IP Address**: `3.131.112.244`

### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

* Get your OrgID and API key from <https://app.devdynamics.ai/settings/organisation>.

### Endpoint

**URL**:\
`https://api.devdynamics.ai/api/v1/test-runs/<your-devdynamics-orgId>/notify`

Replace `<your-devdynamics-orgId>` with your orgId.

**Method**:\
`POST`

### Headers

* `Content-Type`: `application/json`
* `X-api-key`: Your unique API key for authentication.
* `X-event`: `test`

### Sample Payload

Here is an example payload for notifying DevDynamics of a completed test run. This payload represents an **End-to-End Test Suite** executed on a **production** environment for a **critical release**.

```
curl --location --request POST 'https://api.devdynamics.ai/api/v1/test-runs/<your-devdynamics-orgId>/notify' \
--header 'Content-Type: application/json' \
--header 'X-api-key: your-api-key' \
--header 'X-event: test' \
--data-raw '{
    "id": "test-run-789",
    "projectId": "project-123",
    "name": "E2E Test Suite",
    "source": "github-actions",
    "assignee": "jane.doe",
    "type": "end-to-end",
    "status": "completed",
    "environment": "production",
    "prId": "PR-1024",
    "commit": "zxy987poi654",
    "repository": "github.com/org/example-repo",
    "artifact": "release-v2.3.1.tar.gz",
    "externalUrl": "https://github-actions.example.com/run/456",
    "branch": "main",
    "tag": "v2.3.1",
    "totalTests": 250,
    "passedTests": 245,
    "failedTests": 4,
    "skippedTests": 1,
    "startedAt": "2024-04-15T12:00:00Z",
    "completedAt": "2024-04-15T12:45:00Z",
    "tests": [
      {
        "testId": "test-101",
        "testName": "should_successfully_login_user",
        "type": "e2e",
        "status": "passed",
        "startedAt": "2024-04-15T12:00:05Z",
        "completedAt": "2024-04-15T12:00:10Z"
      },
      {
        "testId": "test-102",
        "testName": "should_handle_payment_gateway_error",
        "type": "e2e",
        "status": "failed",
        "startedAt": "2024-04-15T12:00:12Z",
        "completedAt": "2024-04-15T12:00:18Z"
      },
      {
        "testId": "test-103",
        "testName": "should_allow_admin_to_update_user_role",
        "type": "e2e",
        "status": "passed",
        "startedAt": "2024-04-15T12:00:20Z",
        "completedAt": "2024-04-15T12:00:25Z"
      },
      {
        "testId": "test-104",
        "testName": "should_redirect_unauthenticated_users_to_login",
        "type": "e2e",
        "status": "skipped",
        "startedAt": "2024-04-15T12:00:30Z",
        "completedAt": "2024-04-15T12:00:30Z"
      }
    ]
}'

```

### &#x20;Field Descriptions <a href="#curl-request" id="curl-request"></a>

| **Field**      | **Description**                                                                             |
| -------------- | ------------------------------------------------------------------------------------------- |
| `id`           | Mandatory field. Unique identifier for the test run.                                        |
| `projectId`    | Mandatory field. Unique identifier of the test suite project.                               |
| `name`         | Mandatory field. Name of the test suite.                                                    |
| `source`       | Mandatory field. Source of the test run (e.g., Jenkins, GitHub Actions, etc.).              |
| `assignee`     | Name of the person responsible for the test suite.                                          |
| `type`         | Mandatory field. Type of test suite (e.g., integration, e2e, unit, etc.).                   |
| `status`       | Mandatory field. Status of the test run (e.g., `in-progress`, `completed`, `failed`).       |
| `environment`  | Mandatory field. Environment where the test suite was executed (e.g., staging, production). |
| `prId`         | Associated Pull Request ID (if applicable).                                                 |
| `commit`       | Mandatory field. Git commit hash associated with the test run.                              |
| `repository`   | Repository name .                                                                           |
| `artifact`     | Artifact generated from the test run  (if applicable).                                      |
| `externalUrl`  | URL for accessing the test run logs in the source tool.                                     |
| `branch`       | Branch of the repository tested.                                                            |
| `tag`          | Associated release tag.                                                                     |
| `totalTests`   | Mandatory field. Total number of tests executed.                                            |
| `passedTests`  | Mandatory field. Number of tests that passed.                                               |
| `failedTests`  | Mandatory field. Number of tests that failed.                                               |
| `skippedTests` | Mandatory field. Number of tests that were skipped.                                         |
| `startedAt`    | Mandatory field. Timestamp when the test run started.                                       |
| `completedAt`  | Mandatory field. Timestamp when the test run completed.                                     |
| `tests`        | Mandatory field. Array of individual test results with details.                             |

***

### Notes

* Ensure your `X-api-key` is securely stored and not exposed in public repositories.
* Test results will be available in your DevDynamics dashboard for further analysis.

###
