Rusto - Testeranto Implementation for Rust
Rusto is a Rust implementation of the Testeranto testing framework.
Overview
This crate provides a Rust implementation of the Testeranto testing framework, following the same patterns as other language implementations (TypeScript, Python, Go, Ruby).
Status
- BDD Pattern (Given-When-Then): Fully implemented and production-ready (3 verbs)
- TDT Pattern (Value-Should-Expected): Core classes implemented (BaseValue, BaseShould, BaseExpected), integration in progress (3 verbs)
- Describe-It Pattern (AAA/Arrange-Act-Assert): Core classes implemented (BaseDescribe, BaseIt), integration in progress (2 verbs)
- BDD is recommended for production use; TDT and Describe-It patterns are available for experimentation
Structure
src/types.rs: Core type definitions and traitssrc/base_suite.rs: BaseSuite struct for test suitessrc/base_given.rs: BaseGiven struct for Given conditions (BDD)src/base_when.rs: BaseWhen struct for When actions (BDD)src/base_then.rs: BaseThen struct for Then assertions (BDD)src/base_value.rs: BaseValue struct for Value setup (TDT)src/base_should.rs: BaseShould struct for Should actions (TDT)src/base_expected.rs: BaseExpected struct for Expected checks (TDT)src/base_describe.rs: BaseDescribe struct for Describe setup (Describe-It/AAA)src/base_it.rs: BaseIt struct for It actions (Describe-It/AAA)src/simple_adapter.rs: SimpleTestAdapter default implementationsrc/rusto.rs: Main Rusto struct and entry pointsrc/reverse_integration.rs: Integration with native Rust test runnersrc/ast_transformer.rs: AST transformation for native Rust tests
Key Features
1. Artifactory System (Replaces PM)
- Context-aware file operations with structured paths
create_artifactory()method inRustostruct- Path format:
{basePath}/suite-{N}/given-{key}/when-{index} filename.txt - Supports
write_file_sync,screenshot,open_screencast,close_screencast
2. Multiple Testing Patterns
BDD Pattern (Given-When-Then) - Fully Implemented
use *;
use ;
// Traditional BDD pattern
TDT Pattern (Value-Should-Expected) - Core Classes Available
use *;
use ;
// Table-driven testing for data-driven tests
Describe-It Pattern (AAA/Arrange-Act-Assert) - Core Classes Available
use *;
use ;
// Describe-It pattern (AAA with 2 verbs)
Note: The AAA (Arrange-Act-Assert) pattern is implemented as the Describe-It pattern with 2 verbs: "Describe" for Arrange and "It" for combined Act and Assert phases.
3. AST Transformation
Rusto can transform native Rust tests (#[test] functions) to Testeranto-compatible tests.
4. Native Test Integration
Run Testeranto tests through cargo test.
Usage
Baseline Pattern (Standard API)
Add to your Cargo.toml:
[]
= { = "./src/lib/rusto" }
Example Usage
use *;
// Create test implementation
let ;
// Create Rusto instance
let rusto = rusto
Integration
Rusto follows the unified Testeranto architecture:
- Artifactory: Context-aware file operations replacing PM
- Test Resource Configuration: Passed as JSON string
- Results Output: Consistent format across all languages
- Async Support: Built on async/await with Tokio
- Cross-language compatibility: Matches TypeScript (tiposkripto) implementation
See Also
- Tiposkripto - TypeScript/JavaScript implementation
- Pitono - Python implementation
- Golingvu - Go implementation
- Rubeno - Ruby implementation
- Kafe - Java implementation
=======