Back to TresekoView full library

Internal automated tests and external API

When Treseko runs the test and when an external tool only reports results.

Practical guide

1 guide found

All guides

Internal automated tests and external API

When Treseko runs the test and when an external tool only reports results.

Open guide
Reading
13 min
Updated
2026-07-18
Version
1.0.6

When to use this guide

Use it before integrating automation to decide whether Treseko should execute the script or whether your current pipeline should keep running and only send results.

Expected result

The team clearly distinguishes between AUTOMATED and EXTERNAL modes, configures the correct path and avoids duplicating executions or mixing evidence.

Tresekofrozen test casepending jobevidence
pairing WKrunner tokenheartbeat
Worker
Playwright JS/TSCypress JS/TSPuppeteer JS/TSSelenium PythonSpecialized runtime

Treseko supports two paths that look similar in the final report but are different in operation. In internal mode, Treseko creates the job, a worker picks it up, executes the script and returns results. In external mode, your tool runs outside Treseko and then reports the result via API.

Use internal automation when you want to centralize scripts, variables, datasets, workers, evidence and execution from the Treseko UI. Use external API when you already have Playwright, Selenium, Cypress, Pytest or a CI/CD pipeline working and do not want to migrate execution.

Both paths feed history, metrics, reports and bugs. The key difference is who executes. If Treseko executes, the visible mode is automated. If your pipeline executes and Treseko receives the result, the visible mode is external.

To avoid confusion, external identifiers must be stable: solution_code, project_code, component_code, build_code and case_code. The visible name can change; the code should not break the integration.

Recommended flow

  1. Choose internal mode if the script lives and runs from Treseko.
  2. Choose external API if the script lives in another repository or pipeline.
  3. Create or review short codes for solution, project, component, build and test case.
  4. Create an API key from the profile of the user who will report results.
  5. Run the tests in the external framework.
  6. Send results to POST /external/executions/report.
  7. Use external_run_id to deduplicate pipeline retries.
  8. Review History, Reports and Metrics filtering by External mode.

Minimal external report

curl -X POST "$TRESEKO_API_URL/external/executions/report" \
  -H "Authorization: Bearer $TRESEKO_EXTERNAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"solution_code":"SOL-a8f31c22","project_code":"PRJ-b91e02aa","component_code":"CMP-77ac10ff","build_code":"BLD-3f91ad44","external_run_id":"playwright-main-001","overwrite":true,"cases":[{"case_code":"TC-0008","status":"PASO","observations":"Prueba ejecutada desde CI/CD."}]}'

Payload with steps

{
  "solution_code": "SOL-a8f31c22",
  "project_code": "PRJ-b91e02aa",
  "component_code": "CMP-77ac10ff",
  "build_code": "BLD-3f91ad44",
  "external_run_id": "pytest-2026-07-12-001",
  "environment": "qa",
  "overwrite": true,
  "cases": [{
    "case_code": "TC-0005",
    "status": "FALLO",
    "observations": "El boton de login no estuvo visible.",
    "duration_seconds": 18,
    "external_case_run_id": "pytest::test_login_invalid",
    "steps": [
      { "number": 1, "status": "PASO", "observations": "Se abrio login." },
      { "number": 2, "status": "FALLO", "observations": "No aparece el boton.", "evidence_url": "https://ci.example.com/artifacts/step-2.png" }
    ]
  }]
}

How to verify

  • In History, worker executions appear as automated and API-reported ones as external.
  • The API key belongs to an active user with permission to execute or report tests.
  • The specified build exists, belongs to the component and contains the reported test cases.
  • The same external_run_id does not duplicate results if overwrite=true.
  • External evidence appears as a referenced URL. Direct binary upload via external API is not yet available.

Common pitfalls

  • Creating duplicate scripts: one in Treseko and another in CI, and then not knowing which is the source of truth.
  • Using visible names instead of stable codes for project, build or component.
  • Reporting against a build that does not contain the test case.
  • Regenerating external_run_id on each retry and duplicating executions from the same pipeline.
  • Confusing external evidence by URL with artifacts uploaded and persisted inside Treseko.
api externaci cdplaywrightpytestautomation workerexternal api