Skip to main content

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;
39pub mod http;
40pub mod masking;
41pub mod reporter;
42#[doc(hidden)]
43pub mod runner;
44
45// Re-export procedural macros
46pub use tanu_derive::{main, test};
47
48// Re-export error handling crates
49pub use anyhow;
50pub use eyre;
51
52/// Type alias for project names in tanu configuration.
53///
54/// Project names are used to organize tests into different environments
55/// or configurations (e.g., "staging", "production", "development").
56/// Each project can have its own configuration settings including
57/// base URLs, timeouts, and retry policies.
58pub type ProjectName = String;
59
60/// Type alias for module names in test organization.
61///
62/// Module names correspond to Rust module paths and are used to
63/// group related tests together. For example, "api", "auth", "users".
64/// They're used for filtering and organizing test output.
65pub type ModuleName = String;
66
67/// Type alias for individual test names.
68///
69/// Test names identify specific test functions within a module.
70/// Combined with module and project names, they provide unique
71/// identification for each test case in the system.
72pub type TestName = String;
73
74// Re-export key functionality
75pub use config::{get_config, get_tanu_config, Config, ProjectConfig};
76pub use error::{Error, Result};
77pub use reporter::{ListReporter, NullReporter, Reporter};
78pub use runner::{
79    Filter, ModuleFilter, ProjectFilter, Runner, TestIgnoreFilter, TestInfo, TestNameFilter,
80};