This is a project to make it easier to test applications built using Axum. Using full E2E tests.
Some of the design decisions behind this are very opinionated, to encourage one to write good tests.
Features
This is for spinning up an Axum service, that you can then query directly. This is primarily for testing Axum services.
use Router;
use get;
use TestServer;
async
async
Runs on a random port, allowing multiple to run at once
When you start the server, you can spin it up on a random port. It allows multiple E2E tests to run in parallel, each on their own webserver.
This behaviour can be changed in the TestServerConfig
, by selecting a custom ip or port to always use.
Remembers cookies across requests
It is common in E2E tests that step 1 is to login, and step 2 is the main request. To make this easier cookies returned from the server will be preserved, and then included into the next request. Like a web browser.
Fails fast on unexpected requests
By default; all requests will panic if the server fails to return a 2xx status code. This can be switched to panic when the server doesn't return a 200.
This is a very opinionated design choice, and is done to help test writers fail fast when writing tests.