macro_rules! init_test_suite {
($test_suite:ident) => { ... };
($test_suite:ident, $($test_name:expr),*) => { ... };
}Expand description
The test suite initializer that constructs test suits based on the provided name (first
parameter) and the provided functions (the comma-delimited list afterwards). Every function
that is provided is expected only to return type ExtelResult, and
should have no parameters.
These tests are stateless in nature, relying on their environment and hard-coded CLI args to handle configuration and valid setup.
ยงExample
use std::process::Command;
use extel::prelude::*;
/// Run end-to-end test of application.
fn echo_no_arg_e2e() -> ExtelResult {
match Command::new("echo").status() {
Ok(exit_code) => {
let code: i32 = exit_code.code().unwrap_or(-1);
extel_assert!(code == 0, "failed with exit code: {}", code)
},
Err(msg) => {
fail!("failed to execute with error: {}", msg)
}
}
}
// Outputs:
// Test #1 (echo_no_arg_e2e) ... ok
init_test_suite!(EchoTestSuite, echo_no_arg_e2e);
EchoTestSuite::run(TestConfig::default());