TCM Automation Docs

Quick start

Push your first result in under five minutes.

1. Mint a Personal Access Token

Log into the TCM web UI as the user the CI job will impersonate. Open Account → API Tokens, click New token, give it a name (e.g. github-actions) and an expiration window, and click Create.

One-time secret
The full token is shown once. Copy it and store it in your CI’s secret manager (e.g. GitHub Actions secrets) as TCM_TOKEN. If you lose it, revoke and create a new one.

2. Get the run ID

Your QA lead creates a Test Run in the web UI from a test plan. The URL of the run page contains a UUID — that’s your TCM_RUN_ID. Add it as a CI variable next to TCM_TOKEN.

3. Install the SDK and record a result

go get gitlab.com/admin-it-mitra/mitra-testing-essentials-sdk-go
main.go
package main

import (
    "context"
    "log"
    "os"

    tcm "gitlab.com/admin-it-mitra/mitra-testing-essentials-sdk-go"
)

func main() {
    client, err := tcm.New(os.Getenv("TCM_BASE_URL"), os.Getenv("TCM_TOKEN"))
    if err != nil { log.Fatal(err) }

    runID := os.Getenv("TCM_RUN_ID")
    execs, err := client.ListRunExecutions(context.Background(), runID)
    if err != nil { log.Fatal(err) }

    for _, e := range execs {
        passed := runMyTest(e.TestCaseTitle)
        result := tcm.ResultPassed
        if !passed { result = tcm.ResultFailed }
        client.RecordResult(context.Background(), e.ID, tcm.RecordResultInput{
            Result: result, DurationMs: 1500, WorkerID: "go-runner",
        })
    }
}

4. Verify in the UI

Open the run page in TCM. Each execution your job has reported on will show its result and duration, and the run’s pass/fail counters update in real time.