diagram-sankeyCI/CD Integration: Automate Testing in Your Development Pipelines

CI/CD Integration is available only for Pro users and Enterprise Teams

These instructions detail how to integrate Ratl into your CI/CD pipeline using public APIs across Jenkins, GitHub Actions, Azure DevOps (ADO) Pipelines, and GitLab.

Prerequisites

  1. API Key (refer the guide here):

    • Go to Settings > API Keys.

    • Click Create API Key.

    • Copy the generated API key for use in the CI/CD pipeline.

  2. IDs:

    • Simply navigate to the listing page of the specific tests, where you can copy the required IDs directly.

Jenkins Integration

Web Test

pipeline {
    agent any

    stages {
        // Case 1: Base URL
        stage('Start Web Automation - Base URL') {
            steps {
                script {
                    sh '''
                    curl --location 'https://api.studio.ratl.ai/public/api/v1/webshot/start' \
                    --header 'Content-Type: application/json' \
                    --header 'api-key: <YOUR_API_KEY>' \
                    --data '{
                        "workspace_id":"<WORKSPACE_ID>",
                        "base_url": "<BASE_URL>",
                        "channel_id": "<CHANNEL_ID>"
                    }'
                    '''
                }
            }
        }

        // Case 2: Single webshot_id
        stage('Start Web Automation - Single ID') {
            steps {
                script {
                    sh '''
                    curl --location 'https://api.studio.ratl.ai/public/api/v1/webshot/start' \
                    --header 'Content-Type: application/json' \
                    --header 'api-key: <YOUR_API_KEY>' \
                    --data '{
                        "webshot_id": "<WEBSHOT_ID>",
                        "workspace_id":"<WORKSPACE_ID>",
                        "channel_id": "<CHANNEL_ID>"
                    }'
                    '''
                }
            }
        }

        // Case 3: Multiple webshot_ids
        stage('Start Web Automation - Multiple IDs') {
            steps {
                script {
                    sh '''
                    curl --location 'https://api.studio.ratl.ai/public/api/v1/webshot/start' \
                    --header 'Content-Type: application/json' \
                    --header 'api-key: <YOUR_API_KEY>' \
                    --data '{
                        "workspace_id":"<WORKSPACE_ID>",
                        "webshot_ids":["<WEBSHOT_ID_1>", "<WEBSHOT_ID_2>"],
                        "channel_id": "<CHANNEL_ID>"
                    }'
                    '''
                }
            }
        }

        // Case 4: All webshots in workspace
        stage('Start Web Automation - Workspace All') {
            steps {
                script {
                    sh '''
                    curl --location 'https://api.studio.ratl.ai/public/api/v1/webshot/start' \
                    --header 'Content-Type: application/json' \
                    --header 'api-key: <YOUR_API_KEY>' \ 
                    --data '{
                        "workspace_id":"<WORKSPACE_ID>",
                        "channel_id": "<CHANNEL_ID>"
                    }'
                    '''
                }
            }
        }
    }
}

Azure DevOps (ADO) Pipelines Integration

Web Test

GitHub Actions Integration

Web Test

GitLab CI/CD Integration

Web Test

Instructions

  • Insert API Key: Replace <YOUR_API_KEY> with your actual API key in all scripts.

  • Replace <WORKSPACE_ID> , <WEBSHOT_ID> and <CHANNEL_ID> with appropriate values

  • Run the pipeline to start the web automation tests.

Note: These scripts use jq to parse JSON responses, so ensure jq is installed on the agents. Adjust the sleep duration as needed based on your test's expected duration.

Last updated