Jesse Lawson


Tasty! A TOML-driven CLI for Testing APIs

rust

Crates.io

Documentation

Tasty is a command-line tool that runs API tests defined and grouped in TOML files.

I’m building it as I migrate my bash scripts for API testing over to this little binary.

Here’s an example of what it looks like:


Running tests from "user_signup.toml"
  accept_valid_signup ... failed
    Status code mismatch:
    Expected: 200
    Returned: 400
    Payload mismatch:
    Expected: 
      {
        "status": "ok"
      }
    Returned: 
      {
        "reason": "email_already_registered",
        "status": "failed"
      }
  reject_duplicate_email ... ok (313ms)
  reject_malformed_email ... ok (1ms)
  reject_missing_password ... ok (1ms)
  reject_password_minimum_requirements ... ok (1ms)

Test Summary:
  Total tests: 6
  Passed: 4
  Failed: 2
  Skipped: 0
  Total duration: 768ms

Some tests failed

# Writing Tests

Tests are defined in and grouped by TOML files. If you have a TOML file named user_signup.toml, all the tests in side that file can be invoked with Tasty by passing it as a command-line argument.

Each test file can contain multiple test cases. Here’s an example of a file with a single test case:

# user_signup.toml

[accept_valid_signup]
method = "POST"
route = "auth/signup"
payload = { email = "[email protected]", password = "This is a Valid Password!@t%" }
expect_http_status = 200
expect_response_includes = { status = "ok" }

# Test File Syntax

Test files have the following properties that MUST be present in each table:

# Participating & Contributing

Contributions are welcome and encouraged. Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

# Future Improvements

While tasty is already useful for my purposes in its current form, I am open to backwards-compatible enhancements that include (but are not limited to):