Skip to main content

Azure DevOps

The fore ai Azure DevOps integration runs tests using the CJ Action Docker image. Any Azure Pipelines agent with Docker available can run fore ai tests.

Prerequisites

1. Docker on the agent

  • Microsoft-hosted agents (ubuntu-latest): Docker is pre-installed — no setup needed.
  • Self-hosted agents: Docker must be installed and accessible on the agent machine.

2. Add variables in Azure Pipelines

Go to Pipelines → select your pipeline → EditVariables and add the following:

Variable nameValueSecret?
CJ_SERVICE_ACCOUNT_KEYYour fore ai service account keyYes
CJ_TEST_IDID of the test to run (for single-test pipelines)No
CJ_TEST_SUITE_IDID of the test suite to run (for suite pipelines)No
note

Mark sensitive values (such as CJ_SERVICE_ACCOUNT_KEY) as secret in the Variables panel to prevent them from appearing in logs.

Run a single test

Self-hosted agent:

trigger:
- main

pool:
name: Default

steps:
- script: |
docker run --rm \
-e "INPUT_SERVICE_ACCOUNT_KEY=$(CJ_SERVICE_ACCOUNT_KEY)" \
-e "INPUT_TEST_ID=$(CJ_TEST_ID)" \
foreai/cj-action:latest
displayName: 'Run fore ai Test'
env:
CJ_SERVICE_ACCOUNT_KEY: $(CJ_SERVICE_ACCOUNT_KEY)

Microsoft-hosted agent:

trigger:
- main

pool:
vmImage: ubuntu-latest

steps:
- script: |
docker run --rm \
-e "INPUT_SERVICE_ACCOUNT_KEY=$(CJ_SERVICE_ACCOUNT_KEY)" \
-e "INPUT_TEST_ID=$(CJ_TEST_ID)" \
foreai/cj-action:latest
displayName: 'Run fore ai Test'
env:
CJ_SERVICE_ACCOUNT_KEY: $(CJ_SERVICE_ACCOUNT_KEY)
note

The env: block is required for secret variables. Azure Pipelines does not expose secret variables to scripts by default — the env: block explicitly maps them into the script's environment so Docker can pass them to the container.

Run a test suite

Self-hosted agent:

trigger:
- main

pool:
name: Default

steps:
- script: |
docker run --rm \
-e "INPUT_SERVICE_ACCOUNT_KEY=$(CJ_SERVICE_ACCOUNT_KEY)" \
-e "INPUT_TEST_SUITE_ID=$(CJ_TEST_SUITE_ID)" \
-e "INPUT_WAIT_TIMEOUT_SECONDS=360" \
-e "INPUT_WEBSITE_URL_OVERRIDE=https://staging.my-app.com" \
-e "INPUT_PARAMS_OVERRIDE={\"param1\":\"value1\",\"param2\":\"value2\"}" \
-e "INPUT_BROWSER_TYPE_OVERRIDE=chromium" \
foreai/cj-action:latest
displayName: 'Run fore ai Test Suite'
env:
CJ_SERVICE_ACCOUNT_KEY: $(CJ_SERVICE_ACCOUNT_KEY)

Microsoft-hosted agent:

trigger:
- main

pool:
vmImage: ubuntu-latest

steps:
- script: |
docker run --rm \
-e "INPUT_SERVICE_ACCOUNT_KEY=$(CJ_SERVICE_ACCOUNT_KEY)" \
-e "INPUT_TEST_SUITE_ID=$(CJ_TEST_SUITE_ID)" \
-e "INPUT_WAIT_TIMEOUT_SECONDS=360" \
-e "INPUT_WEBSITE_URL_OVERRIDE=https://staging.my-app.com" \
-e "INPUT_PARAMS_OVERRIDE={\"param1\":\"value1\",\"param2\":\"value2\"}" \
-e "INPUT_BROWSER_TYPE_OVERRIDE=chromium" \
foreai/cj-action:latest
displayName: 'Run fore ai Test Suite'
env:
CJ_SERVICE_ACCOUNT_KEY: $(CJ_SERVICE_ACCOUNT_KEY)

Available inputs

Pass each input as a Docker environment variable using -e "INPUT_<NAME>=<value>".

Environment variableRequiredDefaultDescription
INPUT_TEST_IDNo*ID of the test to run. Provide either this or INPUT_TEST_SUITE_ID.
INPUT_TEST_SUITE_IDNo*ID of the test suite to run.
INPUT_SERVICE_ACCOUNT_KEYYesYour fore ai service account key.
INPUT_WAIT_TIMEOUT_SECONDSNo300Max seconds to wait for completion. Must be between 30 and 900.
INPUT_WEBSITE_URL_OVERRIDENoOverride the base website URL used during test execution.
INPUT_PARAMS_OVERRIDENoOverride default parameter values. Must be a valid JSON string with string keys and values.
INPUT_BROWSER_TYPE_OVERRIDENochromiumBrowser engine: chromium, firefox, or webkit.
INPUT_CREATE_ISSUE_ON_FAILURENofalseIf true, creates an issue on test failure (requires additional token configuration).

* Either INPUT_TEST_ID or INPUT_TEST_SUITE_ID must be provided.