Skip to content
/ jettest Public

A command-line tool for running API tests using YAML configuration files.

License

Notifications You must be signed in to change notification settings

itpey/jettest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

itpey JetTest jettest

JetTest

JetTest is a versatile command-line tool designed for effortless API testing using YAML-based configuration files.

itpey JetTest Go Reference itpey JetTest license

Features

  • Simple YAML Configuration: Define API tests easily using YAML files.
  • Flexible HTTP Methods: Supports GET, POST, PUT, PATCH and DELETE 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.

Installation

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.

Usage

jettest --host <API_HOST> --file <YAML_TEST_FILE> [OPTIONS]

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.

Example

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

YAML Test Configuration

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]"

Explanation

  • 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.

Feedback and Contributions

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.

License

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.

Author

JetTest was created by itpey

About

A command-line tool for running API tests using YAML configuration files.

Resources

License

Stars

Watchers

Forks

Languages