Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/schemathesis/action
GitHub Action that runs Schemathesis tests
https://github.com/schemathesis/action
actions api-testing github-actions testing
Last synced: 3 months ago
JSON representation
GitHub Action that runs Schemathesis tests
- Host: GitHub
- URL: https://github.com/schemathesis/action
- Owner: schemathesis
- Created: 2022-05-02T11:07:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-28T02:20:23.000Z (3 months ago)
- Last Synced: 2024-10-31T10:48:38.615Z (3 months ago)
- Topics: actions, api-testing, github-actions, testing
- Language: Python
- Homepage:
- Size: 28.3 KB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# Schemathesis GitHub Action
A GitHub Action for running [Schemathesis](https://github.com/schemathesis/schemathesis) API tests. Automate your API testing to catch crashes, validate specs, and save time.
```yaml
- uses: schemathesis/action@v1
with:
# API schema location
schema: 'https://example.schemathesis.io/openapi.json'
```## Get test results in your pull requests
Enable [Schemathesis GitHub app](https://github.com/apps/schemathesis) to receive test results as comments in your GitHub pull requests.
To use this feature, both the token and the GitHub app are required. Obtain your token by signing up on [Schemathesis.io](https://app.schemathesis.io/auth/sign-up/?utm_source=gh_action&utm_content=readme).![schemathesis-github-report](https://github.com/schemathesis/action/assets/1236561/9e5b8826-1a5e-418f-906a-10aaa51acb05)
## Configuration
```yaml
- uses: schemathesis/action@v1
with:
# API schema location
schema: 'https://example.schemathesis.io/openapi.json'
# OPTIONAL. URL that will be used as a prefix for all API operations.
# Useful when the API schema is maintained separately from the application.
base-url: 'https://example.schemathesis.io/v2/'
# OPTIONAL. Your Schemathesis.io token
token: ${{ secrets.SCHEMATHESIS_TOKEN }}
# OPTIONAL. API name from Schemathesis.io
api-name: 'payments-api'
# OPTIONAL. List of Schemathesis checks to run. Defaults to `all`
checks: 'not_a_server_error'
# OPTIONAL. Whether you'd like to see the results in a Web UI
# Defaults to `true`
report: 'true'
# OPTIONAL. Maximum time in seconds to wait on the API schema availability
wait-for-schema: '30'
# OPTIONAL. Maximum number of generated examples for each endpoint
max-examples: 50
# OPTIONAL. Specify which version of Schemathesis should be used.
# Defaults to `latest`
version: 'latest'
# OPTIONAL. Schemathesis hooks module. Available for Schemathesis >= 3.18.5 only
hooks: 'tests.hooks'
# OPTIONAL. Extra arguments to pass to Schemathesis
args: '-D negative'
```To add headers like `Authorization`:
```yaml
# Save access token to $GITHUB_ENV as ACCESS_TOKEN.
- name: Set access token
run: echo "ACCESS_TOKEN=super-secret" >> $GITHUB_ENV- uses: schemathesis/action@v1
with:
schema: 'http://example.com/api/openapi.json'
args: '-H "Authorization: Bearer ${{ env.ACCESS_TOKEN }}"'
```For more options and usage, check the [Schemathesis CLI documentation](https://schemathesis.readthedocs.io/en/stable/cli.html).
## Support
Having issues or questions? Check the [Schemathesis documentation](https://schemathesis.readthedocs.io/en/stable/), join the [Discord community](https://discord.gg/R9ASRAmHnA), or report problems on the [GitHub issue tracker](https://github.com/schemathesis/action/issues).