Skip to content

Automated test results and the CLI in CI

  • Import of automated test results in JUnit XML (JUnit, TestNG, pytest, Jest, Playwright, Go…) — from the interface or from CI. A test is matched to a case by the automation key (classname.name) or by a case key in the test name (test_refund [SHOP-12]). Parameterized tests of one case add up to one result (any failure fails the case). Cases can be created automatically for tests without a match.

  • Project API tokens (Settings): only hashes are stored, a token works only on its project’s routes.

The CLI is the npm package tsmc-cli: one file without dependencies, only Node 20+ is needed. The TSMC repository is not needed:

Окно терминала
export TSMC_URL=http://tsmc.example:3000
export TSMC_TOKEN=tsmc_… # Project → Settings → API tokens (required for all CLI commands)
npx tsmc-cli junit upload build/test-results/*.xml -p SHOP -r "Nightly $BUILD" -b "$BUILD"

In the TSMC repository the same command is pnpm tsmc … (from source), in the Docker image tsmc …. Before each command the CLI asks the server for its API version (/api/health): it refuses to work with a server that is too old, and warns about a newer one and suggests updating; tsmc-cli --version shows both. The package is built by pnpm build together with the web interface, or alone with pnpm --filter @tsmc/cli build (into packages/cli/dist); in CI the package is installed from the tarball in a clean Node 20 container and uploads a report. Publishing to npm is a cli-v<version> tag (the version from packages/cli/package.json) and needs the NPM_TOKEN repository secret.

Flags: --run-id N (add to an open run), --create-missing, --suite NAME, --close, --fail-on-failed (exit code 2 when cases failed). Several files go into one run. Files a report refers to as [[ATTACHMENT|path]] in the test output (as Playwright and the JUnit Attachments plugin for Jenkins do) are uploaded as attachments to the case result: the path is looked up from the report’s folder, then from the current one. --no-attachments — do not upload. Full help: npx tsmc-cli --help.