Skip to content

Import automated test results

The web client supports importing JUnit XML, TRX and NUnit 3 XML. It maps automated test results to ordinary planned test case variants. Manual and imported results appear together in existing test-run and release reports, while the import origin remains identifiable.

Prepare

Create the required test cases, variants and test run first. A dedicated run for an automated build makes mapping easier and protects manual work. You need the normal read and result-editing permissions for the selected run and its variants.

File import processes only the selected XML result file. The separate Jenkins entry can start configured jobs and fetch results; see below. The format is detected from its content; TRX files may use the .trx extension. Existing Windows scripts and MCP result actions remain available.

Preview and import

When you open Automated results or Jenkins builds from the run list, type part of the run name in Test run. Select the run and choose Open.

  1. Open the target run and its automated-results entry in the web client.
  2. Choose the result file and enter a meaningful source and a build identifier. Do not upload credentials or confidential logs.
  3. Explicitly map each external test you want to import to a planned variant and an appropriate result definition in the project. Similar titles are not automatically treated as identical.
  4. Review the preview. Unmapped, skipped and blocked rows are not successful tests.
  5. Confirm the import and inspect every row's outcome. A partial failure may mean that some other rows have already been imported.

Files are limited to 2 MiB and 1000 test cases. Duplicate external identities, contradictory statuses, invalid durations and XML with external entities are rejected. A skipped external test does not create an executed or successful result. Quick-test rows are not supported by this import.

Supported formats and limits

  • JUnit XML: including exports from pytest, PHPUnit and Playwright. Generated examples from these three reporters are covered by permanent regression tests. JUnit is an exchange format here, not a restriction to Java or unit tests.
  • TRX: Visual Studio reports using the TeamTest 2010 XML namespace. Passed maps to success; Failed, Error and Timeout map to failure; NotExecuted maps to skipped. Nested data rows (InnerResults) are not supported yet.
  • NUnit 3 XML: NUnit reports rooted at test-run. Parameterized cases remain separate by their full names. Passed, Failed and Skipped are supported.

Inconclusive, aborted or unsupported states are rejected. Recognized retry/flaky markers, duplicate identities and contradictory success evidence never silently become success. If a reporter exports only the final result without retry evidence, earlier failures cannot be reconstructed. Attachments, console output and execution environments are not imported automatically; bounded failure diagnostics become the result description. The source report does not replace a completeness check of the test scope.

Protect existing work

Permissions, run state, prerequisites and target results are checked again before import. Completed runs and results already edited manually are not overwritten. Notes, duration and attachments also count as existing work. Required additional fields and test case dependencies retain their normal validation.

Repeating the same import identifier with identical content and mapping does not create duplicate results. Reusing an identifier with changed content, or encountering results changed in the meantime, produces a conflict. Inspect affected rows instead of treating a failed import as fully completed.

After a partial failure, create a new preview with the same import identifier and mapping to retry. Confirming the same preview again returns its existing receipt.

Origin and limitations

Source, build identifier, importer and import time describe recording the result. They do not prove who actually ran the automated test or when it ran. Unknown execution time remains unknown. An imported result also does not automatically prove which version of the test specification the external test exercised.

Therefore, release comparison and risk assessment can still show evidence gaps. A successful imported result alone replaces neither complete test scope nor human acceptance. After a manual edit, the original import origin is not evidence for the current result content.

Windows and MCP

Windows reads ordinary results and provides a web link at the relevant test run. The shared web launch passes the authenticated Windows session; sign-in is required only if that handoff fails. The import interface itself is in the web client.

MCP uses the same checks through ztm_automation_import_read, ztm_automation_import_preview and ztm_automation_import_commit. Ordinary project permissions apply; committing additionally requires the project.automation-import.commit write capability. MCP also retains its existing 1 MiB limit for the entire JSON request body, including XML and JSON escaping; use the web interface for larger files up to 2 MiB. Consult the connected server's tool descriptions and retain import identifiers for safe retries.

Operate Jenkins from the web client

File upload and the push pipeline described below are available alongside direct Jenkins integration.

Server administrators configure Jenkins connections: base URL, job path, fixed artifact path, Jenkins user, API token and approved project GUIDs. Project administration alone does not permit changing destinations or credentials. Tokens are protected on the server and never displayed again; an empty token field preserves the stored token. Back up server data together with its Data Protection keys.

Use a dedicated Jenkins user with the required job/build/artifact rights and an API token, not a password. Base URLs may include a Jenkins context path. Job paths use job/name or job/folder/job/name. Path segments support ASCII letters, digits, dots, underscores and hyphens. Spaces, encoded characters and parent-directory traversal are rejected. Redirects are not followed. HTTP is supported for explicitly administered intranet endpoints; use HTTPS otherwise.

  1. Open automated result import for the target run, then Jenkins builds.
  2. Choose an approved connection and explicitly confirm Start build. Starting does not import results.
  3. Refresh the status and retain the status link with its operation ID. If the outcome is Start unconfirmed — no retry, inspect Jenkins first: a build may already be running. The same operation never sends another start request. Another start is a new deliberate action.
  4. Under Fetch and preview results, enter the exact number of a completed build. Moving aliases such as lastSuccessfulBuild are not accepted.
  5. Review explicit test mappings and confirm import, as with file upload. Preview and commit use the unchanged fetched artifact even if Jenkins later replaces it.

Artifacts are limited to 2 MiB and protected for at most 15 minutes; expired bytes are periodically removed. Discard also removes the staged bytes. An import ID cannot silently acquire different content. After a server restart, the same import ID can produce a new preview from its stored bytes within that window. After expiration, explicitly fetch again with a new ID. After committing, you can reload the receipt page even for a partial import. It shows the last committed outcome. Skipped and unmapped tests do not create a result. A manual entry is reported as a conflict and is preserved. The API key used for the import can read the receipt again via MCP or REST using ztm_ci_receipt with {"importId":"<UUID>"}. The receipt remains readable after the artifact expires. Connection changes and revoked project approval block old previews. Normal run/result permissions and demo restrictions also apply.

MCP and REST access

All eight operations share the web service. REST uses POST /api/v1/operations/ztm_ci_<operation>, with a bearer key and X-ZTM-Project-UniqueId; MCP uses the same tool name. The filtered /api/v1/openapi.json contract describes inputs and outputs.

Operation Purpose Write capability
connections Read approved connections for a run None
status Read a stored operation None
start Start using a stable operationId project.ci.start
refresh Fetch and persist Jenkins status project.ci.refresh
preview Fetch explicit buildNumber under stable importId project.ci.preview
repreview Recheck explicit mappings project.ci.repreview
commit Commit the preview project.ci.commit
discard Discard staged bytes project.ci.discard

Writes require global project-write enablement and the matching capability. Start and commit also require confirmed: true after a deliberate decision. Operations and previews bind to project, user and API key or web session. Server-admin connection configuration is intentionally excluded from project MCP/REST: project-write access must not authorize network destinations or secret changes. Windows retains its existing import paths; the new Jenkins controls are in the web client.

REST and Jenkins

The REST API exposes the same three operations at POST /api/v1/operations/ztm_automation_import_read, ztm_automation_import_preview and ztm_automation_import_commit. Send the API key as a Bearer token and the project identifier in X-ZTM-Project-UniqueId. REST also limits the entire JSON request body to 1 MiB. Normal result-editing permissions and the explicitly granted project.automation-import.commit write capability remain required.

An adaptable Jenkins example with a Python script and local HTTP tests is included in the source package at ZetaTestMain/Source/docs/examples/jenkins-automation-import. It requires a trusted Linux agent with Python 3.11 or later and follows your existing report-producing test stage. Store the key as a Jenkins Secret text credential. Keys, XML contents and preview tokens must stay out of console logs; protect workspace and preview/outcome artifact access.

  1. Prepare the project, editable run and explicit mappings. read with {"testRunId":123} returns eligible targets and result definitions. A preview with empty mappings can discover external test identifiers; similar titles do not replace mappings.
  2. preview accepts a UUID importId, testRunId, xml, source, buildId and mappings. Each mapping contains externalCaseId, plannedVariantId and resultDefinitionId. The example stops before writing if any non-skipped row is unmapped or blocked.
  3. Review every external test, status, target variant and result definition in the Jenkins preview artifact, as well as build and run identity. Only then approve the Jenkins input step. Preview tokens expire after 15 minutes; the example limits approval and commit to ten minutes.
  4. commit accepts only {"previewToken":"<token of the approved preview>"}. Its response includes Complete and individual Rows. The example accepts only fully confirmed rows with Imported, AlreadyImported or preserved Skipped status. Skipped tests remain unexecuted; a successful import does not mean the tests passed.

Responses are direct JSON objects. Existing import responses use names such as Token, ExpiresUtc, Rows and Code, while inputs use the lower camel case shown above. HTTP 200 alone does not establish a complete import: partial failures may leave other rows saved. The example fails on these outcomes, conflicts, expired previews and transport errors, without automatically retrying writes.

To retry the same external build, retain its exact original build identifier, file, mappings, server address, project and run. The example derives the same import identifier from that identity. After partial failure, obtain a new preview, review and approve again. After a commit timeout, inspect import history and saved results first, because the import may already have completed. New test executions need a new build identifier. Local HTTP tests replace neither validation of the adapted pipeline in your own Jenkins nor a synthetic import into a dedicated test project.

At a test run, Open CI results on the web also opens the CI/Jenkins page with that run selected. Opening the page neither starts a job nor imports results. This entry uses the same automatic sign-in handoff.