1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
//! # Tanu - High-performance WebAPI Testing Framework
//!
//! Tanu is a high-performance, async-friendly, and ergonomic WebAPI testing framework for Rust.
//! It's designed to be fast, type-safe, and easily extensible with full support for concurrency
//! and async operations.
//!
//! ## Quick Start
//!
//! You can install `tanu` and `tokio` by running the following commands in your terminal:
//! ```bash
//! cargo add tanu
//! cargo add tokio --features full
//! ```
//!
//! Write your first test:
//!
//! ```rust,no_run
//! use tanu::{check, eyre, http::Client};
//!
//! #[tanu::test]
//! async fn get_users() -> eyre::Result<()> {
//! let client = Client::new();
//! let response = client
//! .get("https://api.example.com/users")
//! .send()
//! .await?;
//!
//! check!(response.status().is_success());
//! Ok(())
//! }
//!
//! #[tanu::main]
//! #[tokio::main]
//! async fn main() -> eyre::Result<()> {
//! let runner = run();
//! let app = tanu::App::new();
//! app.run(runner).await?;
//! Ok(())
//! }
//! ```
//!
//! ## Key Features
//!
//! - **Async/Await Native**: Full support for async operations without boilerplate
//! - **Type-Safe**: Leverage Rust's type system for robust API testing
//! - **Ergonomic Assertions**: Use `check!`, `check_eq!`, and other assertion macros
//! - **Parameterized Testing**: Test multiple scenarios with different inputs
//! - **Built-in HTTP Client**: High-performance HTTP client built on hyper
//! - **Flexible Error Handling**: Supports `eyre::Result`, `anyhow::Result`, and custom error types
//! - **TUI Support**: Interactive terminal interface for test execution
//! - **Concurrent Execution**: Run tests in parallel for better performance
//!
//! ## Error Types
//!
//! Tanu supports various Result types for flexible error handling:
//!
//! - `eyre::Result<()>` (recommended) - Provides colored backtraces and seamless integration
//! - `anyhow::Result<()>` - Compatible with existing anyhow-based code
//! - `std::result::Result<(), E>` - Standard Rust Result type with custom error types
//!
//! ## Examples
//!
//! ### Basic HTTP Test
//!
//! ```rust,no_run
//! use tanu::{check, check_eq, eyre, http::Client};
//!
//! #[tanu::test]
//! async fn test_api_endpoint() -> eyre::Result<()> {
//! let client = Client::new();
//! let response = client
//! .get("https://httpbin.org/json")
//! .header("accept", "application/json")
//! .send()
//! .await?;
//!
//! check_eq!(200, response.status().as_u16());
//!
//! let data: serde_json::Value = response.json().await?;
//! check!(data.is_object());
//!
//! Ok(())
//! }
//! ```
//!
//! ### Parameterized Tests
//!
//! ```rust,no_run
//! use tanu::{check_eq, eyre, http::Client};
//!
//! #[tanu::test(200)]
//! #[tanu::test(404)]
//! #[tanu::test(500)]
//! async fn test_status_codes(expected_status: u16) -> eyre::Result<()> {
//! let client = Client::new();
//! let response = client
//! .get(&format!("https://httpbin.org/status/{expected_status}"))
//! .send()
//! .await?;
//!
//! check_eq!(expected_status, response.status().as_u16());
//! Ok(())
//! }
//! ```
// Re-export procedural macros for test and main attributes
pub use ;
// Re-export error handling crates for user convenience
pub use anyhow;
pub use async_trait;
pub use eyre;
pub use inventory;
pub use pretty_assertions;
// Re-export main application struct
pub use App;
// Re-export core functionality
pub use ;
// Re-export gRPC module when feature is enabled
pub use grpc;
// Re-export GraphQL module when feature is enabled
pub use graphql;
// Type alias for the async test function
pub type AsyncTestFn =
fn ;
// Define the test registration structure for inventory
// Collect tests using inventory
collect!;