|
| 1 | +--- |
| 2 | +id: api-testing-cicd |
| 3 | +title: API Test Setup for GitHub CI/CD |
| 4 | +sidebar_label: CI/CD Integration |
| 5 | +description: Learn how to seamlessly integrate Keploy's AI-powered API tests with GitHub Actions for continuous testing. |
| 6 | +tags: |
| 7 | + - API testing |
| 8 | + - test automation |
| 9 | + - AI testing |
| 10 | + - ci testing |
| 11 | + - plugin |
| 12 | + - ci pipeline |
| 13 | +keywords: |
| 14 | + - fix failing tests |
| 15 | + - ci testing |
| 16 | + - ci/cd |
| 17 | + - github |
| 18 | +--- |
| 19 | + |
| 20 | +Keploy makes it super simple to run API tests during your CI/CD pipeline on GitHub. Here’s a step-by-step guide to help you set it up in just a few minutes! |
| 21 | + |
| 22 | +## Step 1: Get the Test Command from Keploy Dashboard |
| 23 | + |
| 24 | +1. Go to [app.keploy.io](https://app.keploy.io) |
| 25 | +2. Click on **Test Suite** in the sidebar |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +3. You'll see an option to “Run test suites natively” |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +4. **Copy the command** |
| 34 | +  |
| 35 | + |
| 36 | +## Step 2: Set Up GitHub Actions Workflow |
| 37 | + |
| 38 | +Add the following steps to your `.github/workflows/ci.yml` file: |
| 39 | + |
| 40 | +### Install Keploy CLI |
| 41 | + |
| 42 | +```yaml |
| 43 | +- name: Install Keploy CLI |
| 44 | + run: | |
| 45 | + curl --silent -L https://keploy.io/ent/install.sh | bash |
| 46 | +``` |
| 47 | +
|
| 48 | +### Run Keploy API Tests |
| 49 | +
|
| 50 | +Paste the command copied from the dashboard here: |
| 51 | +
|
| 52 | +```yaml |
| 53 | +- name: Run Keploy Test Suite |
| 54 | + run: | |
| 55 | + export KEPLOY_API_KEY=${{ secrets.KEPLOY_API_KEY }} |
| 56 | + keploy test-suite --app=03d24177-315c-4ee1-a3ac-64ed0ab38567 --base-path http://localhost:8080/books --cloud |
| 57 | +``` |
| 58 | +
|
| 59 | +### ⚠️ **Note** |
| 60 | +
|
| 61 | +Don’t forget to add your `KEPLOY_API_KEY` as a GitHub secret! |
| 62 | +**Go to your repo → Settings → Security → Actions → _New Repository Secret_** |
| 63 | + |
| 64 | +Replace `--app` and `--base-path` with your actual values from the Keploy Dashboard. |
| 65 | + |
| 66 | +## Output Example: Real-time Test Execution Logs |
| 67 | + |
| 68 | +Once integrated, here’s what a successful run may look like in your GitHub Actions console: |
| 69 | + |
| 70 | +```sh |
| 71 | +🐰 Keploy: Running test suite {"name": "Create and update one book verify other is unaffected via list"} |
| 72 | +🐰 Keploy: Running test case {"name": "Create Book A"} |
| 73 | +🐰 Keploy: step passed {"step": "Create Book A"} |
| 74 | +... |
| 75 | +
|
| 76 | ++------------------------------------------+--------+-------+ |
| 77 | +| Test Case | Status | Runs | |
| 78 | ++------------------------------------------+--------+-------+ |
| 79 | +| Create book with only title | PASSED | 1 | |
| 80 | +| Create book with invalid progress | PASSED | 1 | |
| 81 | +| Delete book by very large ID | PASSED | 1 | |
| 82 | +| Update book by invalid ID format | PASSED | 1 | |
| 83 | +| ... | ... | ... | |
| 84 | ++------------------------------------------+--------+-------+ |
| 85 | +
|
| 86 | +Test suite execution summary |
| 87 | +Total suites: 122 |
| 88 | +Passed suites: 122 |
| 89 | +Failed suites: 0 |
| 90 | +``` |
| 91 | + |
| 92 | +## That's it! |
| 93 | + |
| 94 | +With just a few lines of YAML, you’ve added **AI-powered API test automation** into your GitHub CI pipeline. Now every PR or deployment will be automatically tested with Keploy’s smart test engine. |
| 95 | + |
| 96 | +import GetSupport from '../concepts/support.md' |
| 97 | + |
| 98 | +<GetSupport/> |
0 commit comments