Add video and screenshot attachments support to Automation API (CREATE method)

Hello Testiny team,

We’re using the Testiny Automation API (POST /v1/automation) to create test runs from our Playwright automation framework. Currently, we can successfully create test runs with test results, but we need the ability to attach videos and screenshots directly during the creation process, especially for failed tests.

Current Implementation:

We’re using the Automation API with the following payload structure:

{

“projectId”: 123,

“source”: “playwright-smoke-tests”,

“runTitlePattern”: “Automation Test Run US-Staging 2025-01-15”,

“runGroupBy”: ,

“results”: [

{

  "ts": 1705315200000,

  "title": "@testiny:857 | @smoke Verify Login Works",

  "key": "TC-857",

  "path": \["Smoke Tests", "Verify Home Elements"\],

  "duration": 15,

  "status": "failed",

  "error": "Element not found: button\[data-testid='login'\]",

  "detailMessage": "Element not found: button\[data-testid='login'\]",

  "attachments": \[\],  // Currently empty - we need to add videos/screenshots here

  "fields": \[857, "@testiny:857 | @smoke Verify Login Works"\],

  "steps": \[

    { "id": "step1", "title": "Navigate to login page" },

    { "id": "step2", "title": "Enter credentials" },

    { "id": "step3", "title": "Click login button" }

  \]

}

],

“fieldNames”: [“test_case_id”, “test_title”],

“noFieldCreate”: false,

“noSourceCreate”: false,

“useServerTime”: false

}

Current Workaround:

Right now, we have to:

  1. Create the test run via Automation API (with empty attachments: )

  2. Extract the created test run ID from the response

  3. Make separate API calls to POST /v1/testrun/upload-attachment/{testrunId}/{testcaseId} for each attachment

This requires multiple API calls and adds complexity to our automation framework.

What We Need:

We would like to be able to include attachments (videos and screenshots) directly in the Automation API payload. For example:

{

“results”: [

{

  "ts": 1705315200000,

  "title": "@testiny:857 | @smoke Verify Login Works",

  "status": "failed",

  "attachments": \[

    {

      "type": "video",

      "filename": "test-video.mp4",

      "content": "base64-encoded-video-data",

      "mime_type": "video/mp4",

      "title": "Test execution video"

    },

    {

      "type": "screenshot",

      "filename": "error-screenshot.png",

      "content": "base64-encoded-image-data",

      "mime_type": "image/png",

      "title": "Error screenshot"

    }

  \]

}

]

}

Questions:

  1. Is there a way to include attachments (videos/screenshots) directly in the Automation API payload when creating test runs?

  2. If not, is this feature planned for future releases?

  3. What would be the recommended format for attachments in the Automation API? (base64 encoding, file URLs, multipart form-data, etc.)

  4. Are there any size limits for attachments when using the Automation API?

Use Case:

We run hundreds of automated tests daily, and for failed tests, we need to attach execution videos and error screenshots. Currently, this requires a two-step process (create run, then upload attachments), which is inefficient and adds latency.

Note: We’re aware that the REST API endpoint /v1/testrun/upload-attachment/{testrunId}/{testcaseId} works well for UPDATE mode, but we need this functionality in CREATE mode (Automation API) as well.

Thank you for your time and consideration!

Best regards,

Petro Kudriashov

Hi Petro,

We currently do not support uploading attachments inline directly via the automation ingest endpoint, mostly because of size considerations. We might support something like this in the future with streaming multipart uploads, but providing the files and metadata can be a bit fiddly on the client side.

If you are using JS/TS with Playwright Test you can try to use our Playwright Reporter (from @testiny/automation), which uploads results and attachments in the background while the tests are running: Testiny Playwright Docs.

When using the API directly, I think there might be a misunderstanding how uploading attachments works with Automation API. (note that the /testrun/upload-attachment/{testrunId} endpoint is for manual test cases not for automation results)

  1. In the /automation api request you provide the attachments array (as in your example) with file (the filename, will be present in the response), type (the mime-type of the file content), and an optional title and a generic optional but unique refId (will also be present in the response)
"attachments": [
  {
    "file": "test-video.mp4",
    "type": "video/mp4",
    "title": "Test execution video",
    "refId": "12345"
  },
  ...
]

  1. You need to look at the preparedAttachments array in the response. Each contains a blobId plus the file name you provided in the request and an optional refId (chosen by yourself if needed as reference) – this should be used to lookup your local files by either file name or refId
  2. Upload each of those files directly to /api/v1/blob/upload/<blobid> with no special encoding (just the binary data in the request body), the attachment will then be available in the automation view for that specific automated test case
  3. You can upload these files concurrently to keep total upload times down, but I would recommended limiting this to ~10 in parallel because of rate limits (In case of a 429 error, back off (Retry-After) and retry)
  4. We currently do not support multipart uploads but might so in the future. From what we have seen performance benefits over concurrent uploads are low.
  5. Attachment size limits (per attachment and total) depends on your plan but is usually 50 or 100MB

Regards,
Michael