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.
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.xmlGitLab 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.xmlJenkins 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.