| Crates.io | rustapi-testing |
| lib.rs | rustapi-testing |
| version | 0.1.207 |
| created_at | 2026-01-14 03:45:53.58336+00 |
| updated_at | 2026-01-26 00:02:49.393074+00 |
| description | Testing utilities for RustAPI applications. Provides checking helpers, test servers, and fluid assertions. |
| homepage | https://github.com/Tuntii/RustAPI |
| repository | https://github.com/Tuntii/RustAPI |
| max_upload_size | |
| id | 2042104 |
| size | 121,721 |
A fluid, ergonomic test harness for RustAPI applications.
Don't just test your logic; test your endpoints.
TestClient: Spawns your application directly (no port binding needed) and sends requests.res.assert_status(200).assert_json(&expected).#[cfg(test)]
mod tests {
use rustapi_testing::TestClient;
use rustapi_rs::prelude::*;
#[tokio::test]
async fn test_create_user() {
// 1. Setup app
let app = RustApi::new().mount_route(create_user_route());
let client = TestClient::new(app);
// 2. Execute
let response = client.post("/users")
.json(&json!({ "name": "Alice" }))
.send()
.await;
// 3. Assert
response
.assert_status(StatusCode::OK)
.assert_json_path("$.id", 1);
}
}