level 09 / azure-and-gcp

Azure & GCP Essentials

Azure DevOps Pipelines and Google Cloud Platform services for test automation infrastructure.

Azure for Test Engineers

ServiceAWS EquivalentTest use case
Azure PipelinesGitHub ActionsCI/CD for tests
Azure Container Instances (ACI)FargateRun Playwright containers
Azure Blob StorageS3Store test reports and artifacts
Azure Key VaultSecrets ManagerTest credentials
Azure Container Registry (ACR)ECRStore Playwright Docker images
Azure Monitor / App InsightsCloudWatchTest run observability

Azure Pipelines for Playwright

# azure-pipelines.yml
trigger:
  branches:
    include: [main]

pool:
  vmImage: ubuntu-latest

variables:
  - group: test-credentials    # Variable Group in Azure DevOps Library
  - name: BASE_URL
    value: 'https://staging.example.com'

steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '20.x'

  - script: npm ci
    displayName: 'Install dependencies'

  - script: npx playwright install --with-deps chromium
    displayName: 'Install Playwright'

  - script: npx playwright test --reporter=junit,html
    displayName: 'Run tests'
    env:
      API_KEY: $(ApiKey)       # from Variable Group (secret)

  - task: PublishTestResults@2
    condition: always()
    inputs:
      testResultsFormat: JUnit
      testResultsFiles: 'test-results/results.xml'
      testRunTitle: 'Playwright'

  - task: PublishPipelineArtifact@1
    condition: always()
    inputs:
      targetPath: playwright-report
      artifact: playwright-report
      publishLocation: pipeline

Azure Blob Storage for Reports

# Upload via Azure CLI
az storage blob upload-batch \
  --account-name myteststore \
  --destination reports/run-$(Build.BuildId) \
  --source playwright-report/ \
  --auth-mode login
# Azure Pipelines task
- task: AzureCLI@2
  condition: always()
  inputs:
    azureSubscription: 'TestServiceConnection'
    scriptType: bash
    scriptLocation: inlineScript
    inlineScript: |
      az storage blob upload-batch \
        --account-name $(StorageAccount) \
        --destination reports/$(Build.BuildId) \
        --source playwright-report/

GCP for Test Engineers

ServiceAWS EquivalentTest use case
Cloud BuildGitHub ActionsCI/CD for tests
Cloud RunFargateServerless test containers
Cloud Storage (GCS)S3Test report storage
Secret ManagerSecrets ManagerTest credentials
Artifact RegistryECRContainer image storage
Cloud LoggingCloudWatch LogsTest run logs

Cloud Build for Playwright

# cloudbuild.yaml
steps:
  - name: 'gcr.io/cloud-builders/npm'
    args: ['ci']

  - name: 'mcr.microsoft.com/playwright:v1.45.0-jammy'
    entrypoint: 'npx'
    args: ['playwright', 'test', '--reporter=junit,html']
    env:
      - 'BASE_URL=${_BASE_URL}'
      - 'CI=true'
    secretEnv: ['API_KEY']

  - name: 'gcr.io/cloud-builders/gsutil'
    args: ['-m', 'cp', '-r', 'playwright-report/', 'gs://${_REPORT_BUCKET}/runs/$BUILD_ID/']

availableSecrets:
  secretManager:
    - versionName: projects/$PROJECT_ID/secrets/api-key/versions/latest
      env: API_KEY

substitutions:
  _BASE_URL: 'https://staging.example.com'
  _REPORT_BUCKET: 'my-test-reports'

Cloud Run for On-Demand Tests

# Deploy test image to Cloud Run
gcloud run deploy playwright-tests \
  --image gcr.io/my-project/pw-tests:latest \
  --region us-central1 \
  --set-env-vars BASE_URL=https://staging.example.com \
  --set-secrets API_KEY=api-key:latest \
  --no-allow-unauthenticated \
  --max-instances 10

# Trigger a test run
gcloud run jobs execute playwright-tests --region us-central1

Cross-Cloud Comparison

AWSAzureGCP
Serverless containersECS FargateACICloud Run
CI/CDCodePipelinePipelinesCloud Build
Report storageS3Blob StorageGCS
SecretsSecrets ManagerKey VaultSecret Manager
IAM conceptIAM RolesService PrincipalsService Accounts