Run your suites in a pipeline with the CLI

Run a suite or a whole project from your own CI pipeline, and see the result in {{brand}}.

In short

The {{brand}} CLI, kamocore, runs a suite or a whole project from your own machine or CI pipeline. Requests leave from that machine, so private APIs work and nothing counts against your request allowance. The result shows in {{brand}} as "Reported by the CLI".

Before you start

Steps

  1. Open a suite and choose "Run in CI" in its … menu - or, on a project's requests, open the chevron beside "Run all" and choose "Run in CI…". Choose the "Environment". For a project, open "Write the pipeline yourself" to see the command and the pipeline steps.
  2. Install the CLI with the install line the panel shows. It needs .NET 10.
  3. Create an access token in "Settings", under "Access tokens", with the scopes ApiTester:read and ApiTester:write.
  4. Keep the token in a secret variable of your pipeline and hand it to the CLI as the environment variable KAMOCORE_TOKEN.
  5. Run a suite: kamocore run --suite <suiteId> --environment <name> --allow-hosts <host> --junit results.xml - or a project with --project <projectId>.
  6. Publish results.xml as your pipeline's test results. It is a JUnit file.

Result: the run shows in the suite's run history, and turns the suite and its requests green or red.

Say where the run may send

Every run names the hosts it may send to with --allow-hosts, and it sends nowhere else - no request and no secret. Without --allow-hosts the run does not start.

Secrets are yours to give

Secrets never leave {{brand}}: the CLI gets the steps without one secret in them. You give each secret to your pipeline, and the CLI reads it from an environment variable. The variable's name is the secret's name in upper case, with every character that is not a letter or a digit written as an underscore.

Before it sends anything, the CLI lists each secret it reads and each one that is missing, by name. It never shows a value.

In Azure Pipelines

  1. In "Run in CI", under "Pipeline format", choose "Azure template" or "Azure script".
  2. Copy the snippet into your pipeline's YAML file. The template form needs templates/kamocore-run.yml in your repository.
  3. Add a secret pipeline variable named kamocoreToken that holds the access token, and one for each secret the snippet lists.
  4. Run the pipeline. Its Tests tab shows every step of the suite.

For any other CI, choose "Shell": it sets the same environment variables and runs the same command.

Check every pull request

  1. On a project's requests, open the chevron beside "Run all", choose "Run in CI…" and choose the "Environment".
  2. Under "Check every pull request", choose the "Repository" your organization connected and its "Repository path". With none connected, choose where "Pipelines run on": GitHub Actions, Azure Pipelines, GitLab CI or Bitbucket Pipelines.
  3. Type "Your password" and press "Make the token and fill the file".
  4. Under "1. Add this file", press "Copy the file" and save it in your repository under the name shown.
  5. Under "2. Add one secret", add the secret it names, with the value shown, where it says. The value is shown only now. Add any other secret it lists the same way.
  6. Open a pull request: the checks run on it and fail it when a check fails.

The token has the two scopes a run needs and an end date the panel shows; {{brand}} emails you a week before it ends. Your password is asked again because the token works without you signed in.

Good to know

If something goes wrong

Related