> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qa.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure DevOps regression testing

> Run a test plan from Azure Pipelines after a deploy.

Start from a [test plan](https://docs.qa.tech/core-concepts/test-plans.md). Azure Pipelines calls the API to run that plan. It does not choose the tests. For a review of the pull request diff, use [Azure DevOps pull request testing](https://docs.qa.tech/pr-testing/azure-devops.md).

## Set it up

**1. Create an API key**

Go to **Organization Settings → API Keys**, create a key, and copy it when
it is shown. It is not displayed again. Project-scoped keys are bound to one
project. Organization-scoped keys need `projectShortId` on API calls.

**2. Store the token in Azure Pipelines**

Add `QATECH_API_TOKEN` as a **secret** pipeline variable. Secret variables
are not exposed to scripts on their own. The step below maps the token
through `env`.

**3. Get the short IDs**

Copy `proj_…` from the project URL or Settings, and `pln_…` from the test
plan URL. See [Find the IDs you
need](https://docs.qa.tech/regression-testing/api.md#find-the-ids-you-need).

This path does not use the Azure DevOps connection or service hooks. Those are for [pull request reviews](https://docs.qa.tech/pr-testing/azure-devops.md).

## What works on Azure DevOps

| Capability | Azure DevOps |
| :- | :- |
| Review on a preview URL, before merge | Not this guide. A test plan run does not post a pull request review. |
| Review after merge, with no preview URL | Not this guide. See [Azure DevOps pull request testing](https://docs.qa.tech/pr-testing/azure-devops.md#after-merge). |
| Run a regression test plan from CI | Yes. `POST /v1/run` with the test plan short ID. You can override the URL for a preview or staging deploy. |
| Run that plan against a mobile build | Yes. Upload the build and pass `applicationBuildShortId`. See [Mobile regression testing](https://docs.qa.tech/regression-testing/agents/mobile.md). |
| Block the pipeline until the plan finishes | Yes. Poll the run and fail the job when the result is not passed. See [Blocking](https://docs.qa.tech/regression-testing/api.md#blocking). |
| Schedule | On the test plan, with **Manage Schedules**. See [Manual and scheduled runs](https://docs.qa.tech/best-practices/running-tests.md#trigger-a-run-on-a-schedule). |

## Run a test plan

`ubuntu-latest` includes `curl` and `jq`. `trigger` is `API`: the Start Run API has no Azure DevOps trigger. `branch`, `commitHash`, and `repository` still attribute the run in the dashboard.

```yaml theme={null}
- script: |
    set -euo pipefail
    jq -n \
      --arg testPlanShortId "pln_abc123" \
      --arg projectShortId "proj_abc123" \
      --arg actor "$BUILD_REQUESTEDFOR" \
      --arg branch "$BUILD_SOURCEBRANCHNAME" \
      --arg commitHash "$BUILD_SOURCEVERSION" \
      --arg repository "$REPOSITORY" \
      '{
        trigger: "API",
        testPlanShortId: $testPlanShortId,
        projectShortId: $projectShortId,
        actor: $actor,
        branch: $branch,
        commitHash: $commitHash,
        repository: $repository
      }' > qatech-request.json
    curl -sSf -X POST "https://api.qa.tech/v1/run" \
      -H "Authorization: Bearer $QATECH_API_TOKEN" \
      -H "Content-Type: application/json" \
      --data @qatech-request.json
  displayName: Run QA.tech test plan
  env:
    QATECH_API_TOKEN: $(QATECH_API_TOKEN)
    BUILD_REQUESTEDFOR: $(Build.RequestedFor)
    BUILD_SOURCEBRANCHNAME: $(Build.SourceBranchName)
    BUILD_SOURCEVERSION: $(Build.SourceVersion)
    REPOSITORY: $(System.TeamProject)/$(Build.Repository.Name)
```

Replace `pln_abc123` and `proj_abc123`. A project-scoped key can omit `projectShortId`.

To test a preview or staging URL for this run, add `applications` as on [API regression testing](https://docs.qa.tech/regression-testing/api.md#what-you-can-override-on-a-run). Pass `DEPLOY_URL` between steps the same way as a [pull request review](https://docs.qa.tech/pr-testing/azure-devops.md#start-a-review-from-azure-pipelines).

## What this does not do

* This path does not post a pull request review. Use [Azure DevOps pull request testing](https://docs.qa.tech/pr-testing/azure-devops.md) for that.
* The example starts the plan and finishes. To fail the pipeline on the result, follow [Blocking](https://docs.qa.tech/regression-testing/api.md#blocking).
* Header, basic auth, device preset, and notification overrides are on the [Start Run API](https://docs.qa.tech/api-reference/runs/start-test-run.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.