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