tanu-core
The core component of the tanu WebAPI testing framework for Rust.
Overview
tanu-core provides the foundational components for building high-performance, async-friendly WebAPI tests in Rust. It contains the essential building blocks that power the tanu testing framework:
- HTTP Client: Async HTTP client built on reqwest with ergonomic API
- Assertion System: Type-safe assertion macros for test validation
- Configuration Management: Flexible configuration system supporting multiple projects
- Test Runner: Async test execution engine with concurrency support
- Error Handling: Clean error propagation using eyre
Key Features
HTTP Client
- Built on reqwest with async/await support
- Automatic JSON serialization/deserialization
- Cookie support (with
cookiesfeature) - Multipart form data support (with
multipartfeature) - Gzip, deflate, brotli, and zstd compression support
Assertion System
The assertion system provides ergonomic macros for test validation:
use ;
// Basic assertions
check!;
check_eq!;
check_ne!;
check_str_eq!;
Configuration Management
Supports flexible configuration via tanu.toml files:
[[]]
= "api-tests"
= ["slow_test"]
[]
= 3
= 2.0
= true
= ["1s", "2s", "5s"]
Test Discovery
Compile-time test discovery using procedural macros:
async
async
Usage
Add tanu-core to your Cargo.toml:
[]
= "0.8.2"
Basic HTTP Test Example
use ;
async
Features
json- Enables JSON support for HTTP requests (via reqwest)multipart- Enables multipart form data supportcookies- Enables cookie jar support for maintaining session state
Architecture
tanu-core is designed with modularity and extensibility in mind:
http- HTTP client functionality and request/response handlingassertion- Test assertion macros and validation utilitiesconfig- Configuration parsing and managementrunner- Test execution engine with async supporterror- Error types and handling utilities
Integration
tanu-core is typically used through the main tanu crate, but can be used directly for custom testing scenarios or integration into other tools.
For complete examples and documentation, see the main tanu repository.