Run webhook tests in CI/CD

Guides / Tests

hwcli test run sends each test's request to your app, has HookWatcher check the response, prints the results and exits with a code your CI system understands.

Regression tests in CIThe CI job starts your app, hwcli test run fetches each test's exact request from HookWatcher, sends it to your app, HookWatcher evaluates the response, and the exit code fails or passes the build.CI runner (GitHub Actions, GitLab, Jenkins, Bitbucket…)Your app:8080hwclitest runexit 0 pass · 1 fail · 2 config · 3 auth · 4 networktestsHookWatcherexact requests · server-side assertionsrun history in the dashboard
Regression tests in CI
Running 4 webhook tests against http://localhost:8080

✓ payment-success            200   41 ms
✓ subscription-cancelled     200   37 ms
✗ invoice-paid
  Expected status: 200
  Received status: 500
✓ reject-unsigned-payment    401    6 ms

3 passed, 1 failed

Exit codes

0 all tests passed · 1 a test failed · 2 configuration error (bad YAML, unknown test) · 3 authentication error · 4 HookWatcher couldn't be reached.

Authentication

Create an API key on the Developer page with the tests:read and tests:run scopes and store it as a CI secret named HWCLI_TOKEN. Add tests:write if the pipeline also runs hwcli test apply.

GitHub Actions

- name: Webhook regression tests
  env:
    HWCLI_TOKEN: ${{ secrets.HWCLI_TOKEN }}
  run: |
    npm start & npx wait-on http://localhost:8080/health
    hwcli test run --ci --target http://localhost:8080 --junit webhook-tests.xml

GitLab CI

webhook-tests:
  script:
    - npm start & npx wait-on http://localhost:8080/health
    - hwcli test run --ci --target http://localhost:8080 --junit webhook-tests.xml
  artifacts:
    reports:
      junit: webhook-tests.xml

Jenkins and Bitbucket

The same command works in a Jenkins sh step or a Bitbucket Pipelines script. --ci turns off colors and prompts, and attaches the provider, branch and commit to the run, so it appears with that context in the dashboard's run history. --junit writes a report that Jenkins, GitLab and Bitbucket display natively.

Choosing what runs

hwcli test run payment-success invoice-paid runs named tests. --suite payments runs one suite. Without arguments, every test in the workspace runs. Free includes 50 test runs a day and Pro 2000.

Create an endpoint and capture your first webhook. No signup needed.

Start Free