Hypertest Docs
HyperTestKnowledge Base
  • Quick Set-up
    • Install HyperTest
    • Deploy your application
    • Mirror Traffic
      • Using Kubernetes
      • Using Amazon ECS
      • Using Docker
      • Using Nginx
      • Using Goreplay
        • ElasticBeanStalk Script for Goreplay
      • Using Apache
      • Using IIS
      • Using Istio
      • Using Kong
      • Using HAProxy
      • Others
  • HyperTest Overview
    • Introduction
    • Architecture
  • Detailed Setup Guide
    • Detailed Setup Guide
      • Installation
        • Linux VM
        • Kubernetes Cluster
          • Hardware Requirements
          • Cluster Setup
            • EKS
              • Existing Application Load Balancer
              • Calculate Setup Cost for EKS Cluster
            • GCP
            • AKS
            • Self Managed
              • Microk8s with EKS-D
          • HyperTest Installation
      • Mirror Traffic
      • Configure HyperTest
      • Automate Starting a Test
        • CI Integration
          • GitHub Checks Integration
            • Mandatory checks
          • Gitlab Integration
          • Bitbucket Integration
          • Jenkins Pipeline
            • Jenkins Plugins for PR events
  • Upgrade HyperTest
    • Upgrade HyperTest
      • Linux VM
      • Kubernetes Cluster
  • User Guides
    • Usage Guide
      • Install and Configure HyperTest
        • Install HyperTest
        • Configure Base DNS
        • Add New Service
      • Tests Runs and Analysis
        • View Test Cases
        • Start New Test Run
        • Understand Your Test Run Analysis
        • Prioritize Your Error Types
        • Track Bugs
        • Ignore Errors/Desired Changes
        • View/Download Report
        • View Consolidated Dashboard Reports
        • Sign-off Reports
        • Reduce Execution Time
        • Deduplication Rules
      • Troubleshooting and FAQs
    • Best Practices Guide
      • Cost Optimization
    • Dashboard Tour
      • Dashboard
      • All Sessions
      • Regression Report
      • Notifications
      • First Test Run
      • Interactions
      • Custom Analysis
      • Configuration
    • User Management
      • Create Admin User
      • Roles, Groups & Users
      • Enabling User Signup
    • Other Guides
      • Basic Nginx Auth for Linux HT
  • Middleware
  • Advanced Features
    • Import test cases from Postman
  • Change Log
  • Troubleshooting
  • FAQs
    • Setup
    • General
    • Regression Report
  • Glossary
    • Session
Powered by GitBook
On this page
  • Pre-requisites:
  • Set Variables:
  • Sample files for CI/CD
  • Getting Started:
  • 1. Download HyperTest CLI
  • 2. Check if HyperTest can start a test
  • 3. Start new test run
  1. Detailed Setup Guide
  2. Detailed Setup Guide
  3. Automate Starting a Test
  4. CI Integration

Jenkins Pipeline

If you are running using Jenkins, you might have to export few variables first because they vary based on which type of pipeline and which plugin you are using.

Pre-requisites:

  • Complete integration of your SCM with HyperTest. Refer individual guides for Github, Gitlab and Bitbucket Intergration for the same.

  • Trigger your pipeline on every PR event

  • Build and deploy your test application

  • Download Hypertest CLI

  • Start a new test run from CLI

The above flow will ensure that every time a new PR is raised, tests are automatically triggred in HyperTest.

Set Variables:

Although, we automatically pick these variables, but if they are not picked up, you can manually set them before starting a test run

HT_BASE_URL=<http://hypertest-vm-ip:dashboard-port>
CI=true
HT_COMMIT_HASH=<your commit hash>
HT_BRANCH=<your source branch name of the PR>
HT_API_TOKEN=<your api token from central dashboard (required only for k8s based HT Setup)> 
HT_PR=<PR number (this is required only for gitlab & bitbucket)>

## If you are using Github SCM, please provide below variables, refer Github Checks Intergrations page for details
GITHUB_CONFIG_REPO_URL=<github_url>
GITHUB_CONFIG_INSTALLATION_ID=<installation_id>

## If you are using Gitlab SCM, please provide below variables, refer Gitlab Integration page for details
GITLAB_CONFIG_BASE_URL=<Base domain or https://gitlab.com> ## This is just the base domain and not complete URL of yuour gitlab repo
GITLAB_CONFIG_PROJECT_ID=<Gitlab_project_id> ## Project ID of your gitlab Project
GITLAB_CONFIG_ACCESS_TOKEN=<User_Access_token> ## Gitlab Access Token of User which has access to Repo - Scope -api

## If you are using BitBucket SCM, please provide below variables, refer BitBucket Intergrations page for details
BITBUCKET_CONFIG_WORKSPACE=<bitbucket-workspace>
BITBUCKET_CONFIG_REPO_SLUG=<bitbucket repo name>
BITBUCKET_CONFIG_USER_NAME=<bitbucket user-name>
BITBUCKET_CONFIG_APP_PASSWORD=<bitbucket app-password>

Depending on from where Jenkins is picking up code and what plugin and type of pipeline you are using Jenkins might be using different variable to store these values.

Below we have list of variables where Jenkins mainly expose it

  1. Branch name: GIT_BRANCH/ BRANCH_NAME/ CHANGE_BRANCH

  2. Last commit: GIT_COMMIT

  3. PR number: CHANGE_ID/ ghprbPullId

Sample files for CI/CD

A sample CI file for Jenkins is available below:

Jenkinsfile
#!/usr/bin/env groovy

// This is a basic workflow to help you get started with Jenkins Pipeline

// This pipeline should ony be triggered when you raise a PR/make changes to it

pipeline {
    agent any
    
    // Setting a few env for HyperTest Cli
    environment {
       HT_BASE_URL='http://<hypertest-vm-ip>:<dashboard-port>'
       HT_COMMIT_HASH="${sh (returnStdout: true, script: 'echo ${GIT_COMMIT}').trim()}"
       HT_BRANCH="${sh (returnStdout: true, script: 'echo ${GIT_BRANCH}').trim()}"
       HT_API_TOKEN='<ht-api-token (this is only required for k8s based HT setup)>'
       HT_PR='<PR number(required only for gitlab and bitbucket)>'
       // If you are using Github SCM, please provide below variables, refer Github Checks Intergrations page for details
       GITHUB_CONFIG_REPO_URL=<github_url>
       GITHUB_CONFIG_INSTALLATION_ID=<installation_id>

       // If you are using Gitlab SCM, please provide below variables, refer Gitlab Integration page for details
       // GITLAB_CONFIG_BASE_URL=<Base domain or https://gitlab.com> ## This is just the base domain and not complete URL of yuour gitlab repo
       // GITLAB_CONFIG_PROJECT_ID=<Gitlab_project_id> ## Project ID of your gitlab Project
       // GITLAB_CONFIG_ACCESS_TOKEN=<User_Access_token> ## Gitlab Access Token of User which has access to Repo - Scope -api

       // If you are using BitBucket SCM, please provide below variables, refer BitBucket Intergrations page for details
       // BITBUCKET_CONFIG_WORKSPACE=<bitbucket-workspace>
       // BITBUCKET_CONFIG_REPO_SLUG=<bitbucket repo name>
       // BITBUCKET_CONFIG_USER_NAME=<bitbucket user-name>
       // BITBUCKET_CONFIG_APP_PASSWORD=<bitbucket app-password>
    }

    stages {
    
        // Steps to build your application
        stage('Build') { 
            steps {
                sh 'echo "steps to build"'
            }
        }
      
        // Steps to deploy your application
        stage('Deploy') {
            steps {
                sh 'echo "steps to deploy"'
            }
        }
        
          // Steps to test your application
        stage('Deploy') {
            steps {
                sh 'echo "steps to test"'
            }
        }
        
        // Steps to start a new test run
        stage('Start new test run') {
        
            steps { 
                sh 'echo "This job downloads HyperTest Cli and start a new test"'               
                sh 'printenv|sort'
                sh 'wget -O ht-cli.tar.xz https://hypertest-binaries-1.s3.ap-south-1.amazonaws.com/ht-cli/ht-cli-latest.tar.xz'
                sh 'tar xvf ht-cli.tar.xz'
                sh './hypertest can-run-test'
                sh './hypertest start-new-test'
            }
        }
    }
}

Getting Started:

1. Download HyperTest CLI

wget -O ht-cli.tar.xz https://hypertest-binaries-1.s3.ap-south-1.amazonaws.com/ht-cli/ht-cli-latest.tar.xz -nv'
tar xvf ht-cli.tar.xz

2. Check if HyperTest can start a test

./hypertest can-run-test

3. Start new test run

./hypertest start-new-test
PreviousBitbucket IntegrationNextJenkins Plugins for PR events

Last updated 1 year ago