Capti is a lightweight end-to-end testing framework for REST APIs. Define your requests and expected response values in an intuitive YAML format, and streamline your endpoint testing.
- test: Get recipe
description: "Should be able to get recipe information"
request:
method: GET
url: ${BASE_URL}/recipes/${RECIPE_ID}
expect:
status: 2xx
body:
id: ${RECIPE_ID}
name: Guacamole
ingredients: $exists
- Define test suites to model the behavior of your users.
- Write HTTP endpoint tests that make HTTP requests and assert expected responses.
- Use various matchers in your tests to make pattern-based assertions.
- Define and extract variables from responses to reuse repeated values and test authentication and stateful resource flows.
- Provide setup and teardown scripts for your tests and test suites, enabling CI workflows.
- View the installation guide to learn how to install Capti in your projects.
- Check out the 'Getting Started' guide to write your first Capti test.
- Consider contributing to the project with feature suggestions or bug reports.
Please visit the documentation to learn more about Capti and how you can use it in your projects.
Capti is under active development and is not production ready. If you want to contribute, feel free to reach out (or just start opening issues and PRs, whatever).
- More matchers - such as "$key_exists some_key" for objects, "$starts_with some_prefix", "$contains some_value", etc.
- Testing endpoints under load, testing endpoint throttling or API limits.
- Support for specifying a local
.env
file for loading variables. - Support for printing more detailed results of testing to local files, as well as setting verbose log levels for more information.
- Support for other frameworks?
- Coverage reports?
- Plugin API for custom matchers?
- Whatever you suggest or require for your project.
What would you find useful in a tool like this? Feel free to create an issue or just jump right in and fork/clone/code something up.
To run the app, ensure you already have Rust installed, and you have a REST API project you can test it on (or use the included test-app
, a simple Express Rest API). Clone the repo locally, and run cargo build
to create the project binary, located at ./target/debug/capti
.
Run this binary in a project containing some tests you've written (specify your test directory as an argument to running the binary) following the guidance above.
Note: If the above step is confusing, take a look at the "test" script in the test_app
package.json file.