How to Integrate Apidog Automated Tests with Jenkins for CI/CD

This article primarily focuses on integrating Apidog automated testing with Jenkins, detailing the specific steps involved.

David Demir

David Demir

7 February 2025

How to Integrate Apidog Automated Tests with Jenkins for CI/CD

The main object of CI/CD (Continuous Integration/Continuous Delivery) in API testing is to automate the process of verifying that APIs are functional and prepared for production before deployment. By using continuous integration, functional tests are automatically run whenever API definitions are updated, which helps identify potential issues early on.

Apidog integrates seamlessly with several CI/CD platforms, including Jenkins, GitLab, and GitHub Actions. You can find code snippets for integration in the CI/CD module of Apidog's automated tests. Adding these snippets to your CI/CD workflow allows you to smoothly incorporate Apidog automated testing into your existing processes. This article focuses on integrating Apidog with Jenkins and provides detailed steps on how to do so.

Integrate with Jenkins - Apidog Docs
Integrate with Jenkins - Apidog Docs

Step 1: Install Jenkins

For installation instructions compatible with different operating systems, refer to the official Jenkins documentation.

Install Jenkins

Once installed, Jenkins can be accessed via its visual user interface at http://{your-public-IP}:8080.

 Jenkins visual user interface

Step 2: Configure Node.js Environment

Install the NodeJS Plugin

Install the NodeJS Plugin
Available Plugins

Configure NodeJS and Global npm Packages

Configure NodeJS and Global npm Packages

Step 3: Create a Continuous Integration Pipeline

There are two methods to build a pipeline in Jenkins to achieve continuous integration: Pipeline and Freestyle Project. Below are the details for both methods.

Option 1: Building a Pipeline

Pipeline script
pipeline {
  agent any

  tools {nodejs "nodejs18"}

  stages {
    stage('Install Apidog CLI') {
      steps {
        sh 'npm install -g apidog-cli'
      }
    }

    stage('Running Test Scenario') {
      steps {
        sh 'apidog run --access-token $APIDOG_ACCESS_TOKEN -t 605067 -e 1629989 -n 1 -r html,cli'
      }
    }
  }
}

This Pipeline script is available in the CI/CD module in Apidog Tests.

To save build time and resources, you can streamline the script by excluding the Apidog CLI installation as it's pre-configured in the Global Tools settings.

pipeline {
  agent any

  tools {nodejs "nodejs18"}

  stages {
    stage('Running Test Scenario') {
      steps {
        sh 'apidog run --access-token $APIDOG_ACCESS_TOKEN -t 605067 -e 1629989 -n 1 -r html,cli'
      }
    }
  }
}

If you're using the latest version of the CI/CD command that includes a variable in the command line, make sure to replace the placeholder APIDOG_ACCESS_TOKEN with your actual access token in your code. Alternatively, you can set up an environment variable named APIDOG_ACCESS_TOKEN in Jenkins by navigating to "Dashboard -> Manage Jenkins -> System" and entering your access token as its value. This configuration allows the system to automatically access your token during pipeline execution.

$APIDOG_ACCESS_TOKEN
Build Now

You can view the progress and results of a build in the Build History.

Build History

Option 2: Building a Freestyle Project

Freestyle project
Build Environment
Build Steps

Paste the Apidog CLI commands into the provided field and save your settings.

Paste the Apidog CLI commands
Execute the Build

Step 4: Sending Build Results to Third-Party Applications

The results of CI builds can be sent to third-party applications, such as Slack, Jenkins, Webhook and Email. To configure notifications, go to Apidog’s Project Settings -> Notifications, where you can set up the desired notification events.

Frequently Asked Questions

1. How to Upload Files During a Build?

You can upload the required files to the machine running the CLI (i.e. the host where Jenkins is running) beforehand, e.g. this image file: images.jpg, by copying down the path to it.

images.jpg

Navigate to the test step in Apidog where the endpoint needs the file upload and click the “Bulk Edit” button.

Bulk Edit

Enter the file path to the uploaded file in the "Parameter Value" field, so that it automatically retrieves the actual file during the build.

Parameter Value

In addition, you can put the path to the file in the “Initial value” of the environment variable.

Initate value

Then in “Bulk Edit”, you can refer to the file path by variable, so that you can also get the actual file by the file path when you build it.

Bulk Edit

2. How to set up a scheduled build in Jenkins?

Apidog currently supports the use of scheduled tasks. You can scheduled tasks for more information.

If you want to set up scheduled tasks in Jenkins, you can do it by configuring the “Build Triggers” of the project, and use Unix-like cron expressions to specify the time and frequency of the build.

On the Jenkins project configuration page, find the “Build Triggers” module, check the “Build periodically” option, and in the text box that appears, enter a cron expression to define the build time and frequency.

Build Triggers

Conclusion

This guide outlines how to integrate Apidog automated testing with Jenkins. Regardless of the chosen build method, ensure that the Apidog CLI is installed beforehand, either by automatic installation during the build or by pre-installation on the Jenkins host (using the command npm install -g Apidog-cli).

button

Explore more

How to Quickly Build a MCP Server for Claude Code

How to Quickly Build a MCP Server for Claude Code

The Model Context Protocol (MCP) revolutionizes how AI assistants interact with external tools and data sources. Think of MCP as a universal USB-C port for AI applications—it provides a standardized way to connect Claude Code to virtually any data source, API, or tool you can imagine. This comprehensive guide will walk you through building your own MCP server from scratch, enabling Claude Code to access custom functionality that extends its capabilities far beyond its built-in features. Whether

12 June 2025

How to Integrate Claude Code with VSCode and JetBrains?

How to Integrate Claude Code with VSCode and JetBrains?

Learn how to integrate Claude Code with VSCode and JetBrains in this technical guide. Step-by-step setup, configuration, and usage tips for developers. Boost your coding with Claude Code!

10 June 2025

How to Generate Google Veo 3 Prompt Theory Videos (Google Veo 3 Prompt Guide)

How to Generate Google Veo 3 Prompt Theory Videos (Google Veo 3 Prompt Guide)

Learn how to craft effective prompts for Google Veo 3 to generate dynamic and expressive videos.

10 June 2025

Practice API Design-first in Apidog

Discover an easier way to build and use APIs