Automating API Testing with EchoAPI and Jenkins CI
This guide walks you through creating test cases on EchoAPI, generating CI/CD commands, and configuring Jenkins to automate and visualize your API tests. Streamline your development pipeline and ensure robust, reliable APIs every step of the way.
Unlock the full potential of your API testing by integrating EchoAPI with Jenkins for seamless CI/CD.
Step 1: Create Test Cases on EchoAPI
First things first, let's create test cases on EchoAPI.
Add the APIs you want to test into the API Flows within the test case. This completes the creation of your test case.
Step 2: Generate CI/CD Command
Next, switch to the CI/CD tab to create a CI/CD command.
After clicking "Regenerate", we'll have the following script:
pipeline {
agent any
tools {nodejs "node16.14"} // Replace the node version supported by the replacement server. Node version>16
stages {
stage('Install EchoAPI CLI') {
steps {
sh 'npm install -g echoapi-cli'
}
}
stage('Running Test Scenario') {
steps {
sh 'echoapi run "https://open.echoapi.com/ci/automated_testing?ci_id=NzAxMTYwNzIyNTUwNDI5NjoxNTcxMDE4MjY5NTg1NDA4NDoxNTcxMDI1NjY5NTk1OTU2Nw==&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoyMTc3MjEzMTM2MTAzMTc4MjQsImlzcyI6ImFwaXBvc3QiLCJleHAiOjE3MjY5MDg5Nzl9.98gYwjWfRWfeGzKq28TNC9xktGsZaRLYFqpBI9gUMc8" -r html'
}
}
}
}
Step 3: Copy and Paste the Code into Your Jenkins Build Configuration
To get this running, you'll need to install the EchoAPI CLI. Run the following command:
npm install -g echoapi-cli
For more detailed steps, check out this guide.
Step 4: Execute and View the Test Report
Finally, execute your Jenkins job and the generated test report should look something like this: