An elegant and natural way to approach API testing in Rust

Hyper as default http client

Mantis

.

  • Extensible
  • Elegant and expressive API

Current state

Mantis is in active development and will be subject to a lot of changes before a first stable version. For this reason the crate isn't published yet.

Example

You can use Mantis in your tests as a dev dependency. Here an example with tokio_test.

use tokio_test::block_on;
use mantis::{
    header::{HeaderValue, CONTENT_TYPE},
    json, Error, Mantis, StatusCode
};

#[test]
fn should_create_a_new_post() -> Result<(), Error> {
    block_on(async {
        Mantis::new("http://jsonplaceholder.typicode.com")?
            .post("posts")
            .payload(json!({
                "title": "foo",
                "body": "bar",
                "userId": 1
            }))
            .assert()
            .await
            .status_success()
            .status(StatusCode::CREATED)
            .headers_eq(vec![(
                CONTENT_TYPE,
                HeaderValue::from_static("application/json; charset=utf-8"),
            )])
            .body(json!({
                "id": 101,
            }));

        Ok(())
    })
}
Issues

Collection of the latest Issues

theredfish

theredfish

0

Add an additional assertion for the response time.

Just like the body, we will need different predicates. Not all predicates are compatible with the functions. For example Predicate::Matches for the body assertion doesn't make sense to check the response time. We will need to apply different predicate scopes, for example a predicate module :

Connected to #17

theredfish

theredfish

0

For the moment we only support StatusCode which is a bit restrictive. Ideally we should support different types :

This will allow us to also convert int to StatusCode.

Now this could be a turning point for the library. Just like Tower, we could have a library that is

protocol agnostic, but is designed around a request / response pattern

theredfish

theredfish

1

For the moment we're only supporting a BodyExactMatcher which is not really convenient. Ideally we would like to match with different predicates :

  • is
  • is not
  • contains
  • does not contain
  • matches (Regex)
  • does not match (Regex)
  • jsonpath (json path expression)

Example of API usage :

  • body(Predicate::Is, json!({"id": 101})
  • body(Predicate::Is, r#"{"id": 101}"#)
  • body(Predicate::JsonPath, "$.store.book[0].title")
  • body(Predicate::Matches, Regex::new(r"[\pN\p{Greek}\p{Cherokee}]+"))
theredfish

theredfish

0

Just like for #10 add a built-in function for multipart response body in Response returning an Option<Multipart> struct.

theredfish

theredfish

0

For the moment grillon only supports json bodies, Extend the built-in functions with an html function in Response that returns an Option<String> (or a struct allowing to parse html content maybe).

theredfish

theredfish

0

By using an existing Rust library we can easily extend the built-ins assertion functions with one for validating the json schema.

Versions

Find the latest versions by id

v0.3.0 - Jan 25, 2022

What's Changed

Full Changelog: https://github.com/theredfish/grillon/compare/v0.2.0...v0.3.0

v0.2.0 - Jan 23, 2022

What's Changed

Full Changelog: https://github.com/theredfish/grillon/compare/v0.1.0...v0.2.0

v0.1.0 - Dec 10, 2021

What's Changed

New Contributors

Full Changelog: https://github.com/theredfish/grillon/commits/v0.1.0

Information - Updated Mar 26, 2022

Stars: 16
Forks: 2
Issues: 6

Repositories & Extras

Http

1.2K

Drill is a HTTP load testing application written in Rust

syntax because it is really easy to use and extend

Drill is a HTTP load testing application written in Rust

utest standard testing for Rust

Make sure your not using this for testing no_std code as it relies on the unstable branch

utest standard testing for Rust

Declarative Testing Framework

===========================

Declarative Testing Framework

K9 - Rust Testing Library

Snapshot testing + better assertions

K9 - Rust Testing Library

A contract testing tool built in Rust using the filmReel format

0 or greater for making gRPC requests

A contract testing tool built in Rust using the filmReel format
Cargo

1.3K

Loom is a testing tool for concurrent Rust code

times, permuting the possible concurrent executions of that test under

Loom is a testing tool for concurrent Rust code

A contract testing tool built in Rust using the filmReel format

0 or greater for making gRPC requests

A contract testing tool built in Rust using the filmReel format

A load testing tool for API's made in Rust for measuring Web API's performance

It provides a flexible facility for generating various HTTP workloads

A load testing tool for API's made in Rust for measuring Web API's performance

Simple golden file testing for Rust

Add the following to your Cargo manifest

Simple golden file testing for Rust

Testing to include rm2fb into libremarkable for musl builds

This repo may get removed if not of use for resolving

Testing to include rm2fb into libremarkable for musl builds

just testing rust

cli + advanced cli features

just testing rust
Facebook Instagram Twitter GitHub Dribbble
Privacy