pub struct TestHarness { /* private fields */ }Expand description
Test harness that can run the full test suite against any connector.
Loads credentials from .env at construction time and provides helpers
to create public or authenticated connectors, query registry metadata,
and look up default test symbols.
§Example
let harness = TestHarness::new();
for id in harness.available_exchanges() {
let connector = harness.create_authenticated(id).await
.expect("creds found")
.expect("connector created");
// run suite...
}Implementations§
Source§impl TestHarness
impl TestHarness
Sourcepub fn available_exchanges(&self) -> Vec<ExchangeId>
pub fn available_exchanges(&self) -> Vec<ExchangeId>
Get the list of exchanges that have API keys available in .env.
Sourcepub fn all_exchanges() -> Vec<ExchangeId>
pub fn all_exchanges() -> Vec<ExchangeId>
Get the list of ALL registered exchanges (for public-only tests).
Uses the static ConnectorRegistry to enumerate every known connector.
Sourcepub async fn create_public(
&self,
id: ExchangeId,
testnet: bool,
) -> ExchangeResult<Arc<dyn CoreConnector>>
pub async fn create_public( &self, id: ExchangeId, testnet: bool, ) -> ExchangeResult<Arc<dyn CoreConnector>>
Create a public (unauthenticated) connector for id.
Pass testnet: true to use the exchange’s testnet/sandbox environment.
Sourcepub async fn create_authenticated(
&self,
id: ExchangeId,
) -> Option<ExchangeResult<Arc<dyn CoreConnector>>>
pub async fn create_authenticated( &self, id: ExchangeId, ) -> Option<ExchangeResult<Arc<dyn CoreConnector>>>
Create an authenticated connector for id, if credentials are available.
Returns None if no credentials are present for this exchange.
Returns Some(Err(_)) if credentials exist but connector creation fails.
Sourcepub fn test_symbol(id: ExchangeId) -> &'static str
pub fn test_symbol(id: ExchangeId) -> &'static str
Get a default, liquid test symbol for an exchange.
Returns a safe symbol appropriate for the exchange category:
- Crypto CEX/DEX derivatives →
"BTC/USDT"or perpetual equivalent - US stocks →
"AAPL" - Forex →
"EUR/USD" - Data aggregators →
"BTC/USD"