Background
This article explains how Qualibrate scenarios can be triggered from external tool such as CI/CD servers, in order to automate the process of test execution in the context of DevOps.
The below example is using GitLab CI/CD capabilities, but this is not limited to only GitLab. Similar approaches can be used on other CI/CD solutions such as Azure DevOps, Jenkins, Atlassian Bamboo, CircleCI, etc.
Architecture
There are 3 primary components on this integration:
GitLab: Responsible to job orchestration (Pipelines).
Qualibrate CI Utility: Qualibrate’s official command line interface (CLI) utility responsible to abstracting test execution instructions into simple commands that can be triggered in a CI/CD pipeline
Qualibrate Cloud Service: Responsible for receiving execution jobs and reporting back results to the Qualibrate CLI. All target test scenarios are stored in Qualibrate, and are organized into projects.
The follow schematic visualizes how the 3 components are interacting with each other:
Pipeline configuration file
GitLab CI/CD pipelines are configured using a YAML file called .gitlab-ci.yml
within each project. For more detailed information about how to configure GiiLab CI/CD pipelines, visit GitLab’s official Pipeline Configuration Reference documentation.
Example
The following is a .gitlab-ci.yml
example which already contains some Qualibrate-specific commands:
# Linux Ubuntu official image download from Docker repository image: ubuntu:latest # Setup for Qualibrate-specific global variables (target adapter, command type and project id) variables: GIT_STRATEGY: none ADAPTER_ID: "WIN-R4VQP0JPDBF-Administrator" COMMAND_TYPE: "scenario" PROJECT_ID: "5e5786c8c9e77c0001dc4aa8" before_script: # Install `wget` to properly download binary from url - apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/* # Download `qualibrate-cli` binary from url - wget -q https://assets.qualibrate.com/downloads/qualibrate-cli # Make `qualibrate-cli` executable (required for unix environments) - chmod +x qualibrate-cli execute: only: - master script: # This is where the scenarios in scope are defined. Each command line represents a stand-alone execution, and it’s # processed synchronously (each run will be processed until the end and will continue for the next one. # If any of the runs returned a “failed”, the run stops, and the entire job will also fail. - ./qualibrate-cli exec -i "5ede3cd446e0fb0001bf1b47" -a $ADAPTER_ID -t $COMMAND_TYPE -k $API_KEY_PRD -p $PROJECT_ID - ./qualibrate-cli exec -i "5ec3dee5c9e77c000104ffe5" -a $ADAPTER_ID -t $COMMAND_TYPE -k $API_KEY_PRD -p $PROJECT_ID
Qualibrate CLI Command Reference
Global Reference
PS C:\CLI> .\qualibrate-cli.exe --help Usage: qualibrate-cli [command] Available Commands: exec command line option to perform execution of Flow OR Scenario help Help about any command Flags: -h, --help help for qualibrate-cli -s, --stage Target stage environment Use "qualibrate-cli [command] --help" for more information about a command.
Execution command reference
To run scenarios, the qualibrate-cli.exe exec
command is used. The following is the help reference for that command:
PS C:\CLI> .\qualibrate-cli.exe exec --help Usage: qualibrate-cli exec [flags] Flags: -a, --adapter string adapter id -h, --help help for exec -i, --id string id of the target flow or scenario -k, --key string api key to access platform -p, --project string project id -t, --target string value can be 'flow' or 'scenario' Global Flags: -s, --stage Target stage environment
How to get the Qualibrate IDs?
The CLI requires 2 important variables to trigger executions from 3rd party tools; project id
and scenario id
.
To get these values, navigate to the target scenarios that will be executed. Both id values can be found in the browser URL as follows:
Comments
0 comments
Please sign in to leave a comment.