JetTest is a versatile command-line tool designed for effortless API testing using YAML-based configuration files.
- Simple YAML Configuration: Define API tests easily using YAML files.
- Flexible HTTP Methods: Supports GET, POST, and PUT requests.
- Customizable Parameters: Specify API host, client ID, authentication token, and request timeout.
- Debug Mode: Enable detailed logging for request and response information.
- Response Validation: Validate expected status codes, response latency, and specific response body segments.
Make sure you have Go installed and configured on your system. Use go install to install JetTest:
go install github.com/itpey/jettest@latest
Ensure that your GOBIN
directory is in your PATH
for the installed binary to be accessible globally.
jettest --host <API_HOST> --file <YAML_TEST_FILE> [OPTIONS]
--host <API_HOST>
: Specify the API host (required).--file, -f <YAML_TEST_FILE>
: Path to the YAML test file (required).--clientID, --cid <CLIENT_ID>
: Set the client ID for requests.--authToken, --at <AUTH_TOKEN>
: Provide an authentication token for requests.--timeout, -t <SECONDS>
: Set the request timeout duration in seconds (default: 30).--debug, -d
: Enable debug mode to print detailed request and response information.
Execute JetTest to run API tests against a target host using a specific YAML configuration file:
jettest --host https://api.example.com --file file.yaml --clientID myclient --authToken mytoken --timeout 60 --debug
Define API tests in a YAML configuration file file.yaml
with the following structure:
tests:
- name: Get user profile
description: Retrieve user profile information
request:
method: GET
path: /api/users/profile
params:
user_id: [12345]
with_token: true
expect:
status_code: 200
max_latency: 5000ms
body:
- path: data.username
value: "john_doe"
- path: data.email
value: "[email protected]"
name
: Name of the API test.request
: Details of the API request.method
: HTTP method (GET, POST, PUT).path
: Endpoint path.params
: Query parameters.headers
: Request headers.with_client_id
: Include client ID in headers (true/false).with_token
: Include authentication token in headers (true/false).body
: Request body (if applicable).expect
: Expected response conditions.status_code
: Expected HTTP status code.max_latency
: Maximum acceptable response latency.body
: List of expected response body conditions.
For more examples and detailed usage, refer to the examples provided in the repository.
If you encounter any issues or have suggestions for improvement, please open an issue on GitHub.
We welcome contributions! Fork the repository, make your changes, and submit a pull request.
JetTest is open-source software released under the Apache License, Version 2.0. You can find a copy of the license in the LICENSE file.
JetTest was created by itpey