yapitest 1.1.0

A YAML-based API testing framework
Documentation

Crates.io Version Crates.io Downloads License: MIT Docs

yapitest

API testing without the boilerplate — define your tests in YAML, not code.

Yapitest runs HTTP test sequences from plain YAML files. No test runners, no assertion libraries, no expect(value).toBe(0). Declare what to call, what to send, and what to expect back — yapitest handles the rest.

Example

test-create-and-get-post:
  setup: create-user
  steps:
    - id: create-post
      path: /api/post/create
      method: POST
      headers:
        API-Token: $setup.token
      data:
        title: Some Title
        body: Some message
      assert:
        status-code: 201
        headers:
          content-type: "re/application/json.*"

    - path: /api/post/$create-post.response.post_id
      assert:
        headers:
          content-type: "re/application/json.*"
        body:
          title: Some Title
          body: Some message

setup runs a reusable step-set (defined in a config file) before the test begins. $setup.token and $create-post.response.post_id reference values from earlier steps — no glue code required.

Installation

Install with Cargo:

cargo install yapitest

Usage

Point yapitest at a directory or one or more YAML files:

yapitest ./tests
yapitest ./tests/test-users.yaml ./tests/test-posts.yaml

Filtering

yapitest ./tests -g auth        # only tests in the "auth" group
yapitest ./tests -i login       # only tests whose name contains "login"
yapitest ./tests -x slow        # exclude tests whose name contains "slow"
yapitest ./tests -k "login user"  # only the test named exactly "login user"

Flags can be repeated to filter by multiple values:

yapitest ./tests -g auth -g admin
yapitest ./tests -k "login user" -k "create post"

Parallelism

By default, yapitest picks an appropriate thread count automatically. Override with -t:

yapitest ./tests -t 4

Verbosity

yapitest ./tests -v 0   # silent
yapitest ./tests -v 1   # test names only
yapitest ./tests -v 2   # names + pass/fail (default)
yapitest ./tests -v 3   # full assertion detail

CTRF Report

Write a CTRF JSON report to a file:

yapitest ./tests --output results.json

Documentation

Full documentation is available at cd-4.github.io/yapitest.