`map` expansion between AutomationTestCase and AutomationTestRun returns 500 (API_INTERNAL_ERROR)

Hi Testiny team,

We’re building a Power Automate integration that needs failing test case details for a given automation test run (project_id 1), via POST /api/v1/atm-testcase/find with a map expansion to AutomationTestRun (per the quickstart docs’ DataReadParams.map pattern, which is fully worked out for manual TestCase/TestRun but not for the automation entities).

Every request that includes a map between atm_testcase and atm_testrun fails with a 500, regardless of shape. Querying either entity alone (no map) works fine. Variants tried, all against /api/v1/atm-testcase/find (and the reverse, /api/v1/atm-testrun/find, mapping the other direction): object-form map with filter; array-form map with filter; array-form map in the reversed direction; array-form map using an ids key instead of filter; a bare map with entities only and no restriction at all; and entities passed as a single string naming only the target entity.

Every one of these returns the same response:

json
{
  "type": "ApiError",
  "code": "API_INTERNAL_ERROR",
  "message": "Read operation failed because of an internal error",
  "reqid": "..."
}
```

Two request IDs from these attempts, for your server-side logs: R2h42nOHDYbvF23i and WqETSPUSWMNmxHLn.

Could you confirm:
- Is a map expansion between AutomationTestCase and AutomationTestRun currently supported?
- If so, what's the correct request shape? Our account may be hitting a genuine bug rather than a syntax issue, given even the simplest possible form (bare map, no filter) 500s.
- If it's not supported yet, what's the recommended way to fetch per-test-case pass/fail/result status for an automation test run via the REST API?

Happy to share the full flow/account details privately if useful. Thanks!

3 Answers

3

Hello Calen,

Thank you for your report.

There is no direct mapping/reference between AutomationTestCase and AutomationTestRun. Instead, those are linked via AutomationResult.

Our error message is less than helpful so we will fix this to return the correct 400 invalid-request error code.

You can expand through the result with entity (singular), which follows a direct link between entities. This works on your original endpoint:

POST /api/v1/atm-testcase/find
{
  "map": { "entity": "atm_result", "filter": { "atm_testrun_id": <run id> } }
}

Starting from the run works too:

POST /api/v1/atm-testrun/find
{
  "ids": [<run id>],
  "map": { "entity": "atm_result", "map": { "entity": "atm_testcase" } }
}

The recommended way to get per-testcase status for a run is to use the dedicated results endpoint - this is what the Testiny UI uses and it also returns your custom automation field values:

POST /api/v1/automation/find
{
  "projectId": 1,
  "filter": { "atm_testrun_id": <run id> },
  "includeTcs": true
}

Regards,
Michael
Testiny Team

Hi Michael,

Thanks for the fast and thorough answer — that clears it up completely. Makes sense that it needed to route through AutomationResult rather than a direct link.

I’ll switch our Power Automate flow over to the /api/v1/automation/find endpoint you recommended, since the includeTcs option sounds like exactly what we need for per-test-case status in one call. Will report back here if anything unexpected comes up, but this should unblock us.

Appreciate the help, and good to hear the 500 → 400 error code fix is in the works too.

Thanks,

Calen

We improved the error message and status with the latest release Testiny v1.42.0.

Best regards,
Alex