tanu_core/lib.rs
1//! # Tanu Core
2//!
3//! Core functionality for the tanu WebAPI testing framework.
4//!
5//! This crate provides the fundamental building blocks for tanu, including:
6//! - Test runners and execution logic
7//! - HTTP client functionality
8//! - Assertion macros and utilities
9//! - Configuration management
10//! - Test reporting infrastructure
11//!
12//! ## Architecture (block diagram)
13//!
14//! ```text
15//! +---------------------+ +---------------------+ +---------------------+
16//! | test definitions | ---> | runner (execution) | ---> | reporter (output) |
17//! | #[tanu::test] | | + event channel | | List/Null/etc. |
18//! +---------------------+ +---------------------+ +---------------------+
19//! | ^ ^ ^
20//! v | | |
21//! +---------------------+ | | +---------------------+
22//! | assertion macros | ---publish---+ +---publish--- | HTTP client + logs |
23//! | check!, check_eq! | | | req/res capture |
24//! +---------------------+ | +---------------------+
25//! ^ |
26//! | v
27//! +---------------------+ +---------------------+
28//! | config + filters | <-------------------- | test selection |
29//! | projects/modules | | (project/module) |
30//! +---------------------+ +---------------------+
31//! ```
32//!
33//! Most users should use the main `tanu` crate rather than importing `tanu-core` directly.
34
35#[doc(hidden)]
36pub mod assertion;
37pub mod config;
38pub mod error;
39#[cfg(feature = "graphql")]
40pub mod graphql;
41#[cfg(feature = "grpc")]
42pub mod grpc;
43pub mod http;
44pub mod masking;
45pub mod reporter;
46#[doc(hidden)]
47pub mod runner;
48
49// Re-export procedural macros
50pub use tanu_derive::{main, test};
51
52// Re-export error handling crates
53pub use anyhow;
54pub use eyre;
55
56/// Type alias for project names in tanu configuration.
57///
58/// Project names are used to organize tests into different environments
59/// or configurations (e.g., "staging", "production", "development").
60/// Each project can have its own configuration settings including
61/// base URLs, timeouts, and retry policies.
62pub type ProjectName = String;
63
64/// Type alias for module names in test organization.
65///
66/// Module names correspond to Rust module paths and are used to
67/// group related tests together. For example, "api", "auth", "users".
68/// They're used for filtering and organizing test output.
69pub type ModuleName = String;
70
71/// Type alias for individual test names.
72///
73/// Test names identify specific test functions within a module.
74/// Combined with module and project names, they provide unique
75/// identification for each test case in the system.
76pub type TestName = String;
77
78// Re-export key functionality
79pub use config::{get_config, get_tanu_config, CaptureHttpMode, Config, ProjectConfig};
80pub use error::{Error, Result};
81pub use reporter::{ListReporter, NullReporter, Reporter};
82pub use runner::{
83 CallLog, Filter, ModuleFilter, ProjectFilter, Runner, TestIgnoreFilter, TestInfo,
84 TestNameFilter,
85};