API Academy
๐ŸŒ English
  • ๐ŸŒ English
  • ๐ŸŒ ็น้ซ”ไธญๆ–‡
HomePetstore APIExplore more APIs
HomePetstore APIExplore more APIs
๐ŸŒ English
  • ๐ŸŒ English
  • ๐ŸŒ ็น้ซ”ไธญๆ–‡
๐ŸŒ English
  • ๐ŸŒ English
  • ๐ŸŒ ็น้ซ”ไธญๆ–‡
  1. Testing APIs
  • Introduction
  • Table of Contents
  • API Academy
    • Get Started
      • What is an API?
      • How Does an API Work?
      • How to Call an API?
      • How to Read an API Documentation?
      • Chapter Summary
      • Get realtime weather
    • API Fundamentals
      • API Funtamentals: Overview
      • Method & Path
      • Parameters
      • Request Body
      • Responses
      • API Specification & OAS
      • Chapter Summary
    • Working with APIs
      • Working with APIs: Overview
      • Making Requests from Spec
      • Environments and Variables
      • Chaining Multiple Endpoints
      • Handling Authentication
      • Handling API Signatures
      • Introduction to Scripts
      • Chapter Summary
    • Mocking APIs
      • Mocking APIs: Overview
      • Smart Mock
      • Mock Expectations
      • Cloud Mock
      • Mock Scripts
      • Chapter Summary
    • Designing APIs
      • Designing APIs: Overview
      • Introduction to API Design
      • Creating Your First API Project
      • Analyzing Requirements and Planning Your API
      • Designing Data Models
      • Designing Endpoints
      • Using Components and Reusability
      • Setting Up Authentication
      • API Design Guidelines
      • Chapter Summary
    • Developing APIs
      • Developing APIs: Overview
      • Setup: Install Your AI Coding Assistant
      • Quick Start: From Spec to Running API in 30 Minutes
      • Understanding the Generated Code
      • Testing Your API with Apidog
      • Deployment: Put Your API Online
      • Chapter Summary
    • Testing APIs
      • Testing APIs: Overview
      • Getting Started: Your First Test Scenario
      • Integration Testing and Data Passing
      • Dynamic Values
      • Assertions and Validations
      • Flow Control: If, For, ForEach
      • Data-Driven Testing
      • Performance Testing
      • Test Reports and Analysis
      • CI/CD Integration
      • Scheduled Tasks and Automation
      • Advanced Testing Strategies
      • Chapter Summary
    • API Documentations
      • API Documentations: Overview
      • Publishing Your First API Doc
      • Customizing Documentation Appearance
      • Interactive Features for Consumers
      • Advanced Publishing Settings
      • Managing API Versions
      • Chapter Summary
    • Advanced API Technologies
      • API Technologies: Overview
      • GraphQL
      • gRPC
      • WebSocket
      • Socket.IO
      • Server-Sent Events (SSE)
      • SOAP
      • Chapter Summary
    • API Lifecycle
      • API Lifecycle: Overview
      • Stages of the API Lifecycle
      • API Governance
      • API Security Best Practices
      • Monitoring and Analytics
      • API Versioning Strategies
      • The Future of APIs
      • Chapter Summary
    • API Security
      • API Security: Overview
      • API Security Fundamentals
      • Authentication vs Authorization
      • Understanding OAuth 2.0 and OpenID Connect
      • JSON Web Tokens (JWT)
      • OWASP API Security Top 10
      • Encryption and HTTPS
      • Chapter Summary
    • API Tools
      • API Tools: Overview
      • The Evolution of API Tools
      • API Clients
      • Command Line Tools (cURL, HTTPie)
      • API Design and Documentation Tools
      • API Mocking Tools
      • API Testing Tools
      • All-in-One API Platforms
      • Chapter Summary
    • API Gateway
      • API Gateway: Overview
      • What is an API Gateway?
      • Key Features of API Gateways
      • API Gateway vs Load Balancer vs Service Mesh
      • Popular API Gateway Solutions
      • The BFF (Backend for Frontend) Pattern
      • Chapter Summary
  • Modern Pet Store
    • Pet
      • Get Pet
      • Update Pet
      • Delete Pet
      • Create Pet
      • List Pets
      • Upload Pet Image
    • User
      • Update User
      • Get User
      • Delete User
      • Login
      • Logout
      • Create User
    • Store
      • List Inventory
      • Create Order
      • Get Order
      • Delete Order
      • Callback Example
      • Pay for an Order
    • Payments
      • Pay Order
    • Chat
      • Create Chat Completion
    • Webhooks
      • Pet Adopted Event
      • New Pet Available Event
  • Schemas
    • Pet
    • Category
    • User
    • ApiResponse
    • OrderPayment
    • Tag
    • Order
    • Links-Order
    • PetCollection
    • Bank Card
    • Bank Account
    • Links
    • Error
HomePetstore APIExplore more APIs
HomePetstore APIExplore more APIs
๐ŸŒ English
  • ๐ŸŒ English
  • ๐ŸŒ ็น้ซ”ไธญๆ–‡
๐ŸŒ English
  • ๐ŸŒ English
  • ๐ŸŒ ็น้ซ”ไธญๆ–‡
  1. Testing APIs

CI/CD Integration

In the modern DevOps world, if it's not automated, it doesn't exist. You don't want to manually click "Run" every time a developer pushes code. You want your tests to run automatically, blocking bad code from reaching production.
Apidog integrates seamlessly with Jenkins, GitHub Actions, GitLab CI, and others via the Apidog CLI.

The Core: Apidog CLI#

Apidog CLI is a command-line tool that allows you to run test scenarios exported from Apidog (or directly from the cloud) in any environmentโ€”Linux servers, Docker containers, or Jenkins agents.
See details: Apidog CLI

1. Install Apidog CLI#

It's an npm package, so it runs anywhere Node.js runs.

Basic Usage#

To run a test scenario, you just need its ID (found in the CI/CD tab of your Test content).

Integration with GitHub Actions#

This is the most common setup for open-source and modern teams.

Step 1: Get your Token and ID#

1.
In Apidog, go to Test Scenario -> CI/CD.
2.
Copy your APIDOG_ACCESS_TOKEN (keep this secret!).
3.
Copy the executed command which contains the SCENARIO_ID.

Step 2: Create Workflow File#

Create .github/workflows/api-test.yml in your repo:
Now, every time someone pushes code, GitHub allocates a server, installs Apidog CLI, runs your full regression suite, and reports pass/fail back to the Pull Request.

Integration with Jenkins / GitLab CI#

The principle remains identical for other CI providers. Whether you are using Jenkins (via a sh 'npm install ...' step in your Groovy pipeline) or GitLab CI (adding a job in .gitlab-ci.yml), the core requirement is the same:
As long as the runner machine has internet access and can reach your API, the Apidog CLI will work.

Running with Localhost#

A common challenge in CI is that the API isn't deployed yetโ€”it's running on the CI machine's localhost.
Apidog CLI handles this naturally because it runs directly on the CI machine. You simply structure your pipeline to first start your API (e.g., npm start &), wait for the port to open, and then execute the Apidog CLI command against http://localhost:8000.

Key Takeaways#

Integrate API tests into CI/CD pipelines
Use Apidog CLI for automation
Ensure continuous feedback loops

What's Next#

CI/CD handles code changes. But what if the API goes down while no one is changing code? We need Monitoring.
In the next chapter, we'll set up Scheduled Tasks to watch your API 24/7.
Continue with โ†’ Scheduled Tasks and Automation
Modified atย 2025-12-25 09:54:32
Previous
Test Reports and Analysis
Next
Scheduled Tasks and Automation
Built with