Expand description
Testkit — Conformance adapter runner.
Provides a reusable framework for running conformance vectors against
any SDK implementation. New SDKs implement the AshAdapter trait
and get full conformance testing for free.
§Usage
- Implement
AshAdapterfor your SDK - Call
load_vectors()to parse vectors.json - Call
run_vectors()to execute all vectors - Inspect the
TestReportfor pass/fail + diffs
§Example
ⓘ
use ash_core::testkit::{load_vectors, run_vectors, AshAdapter, AdapterResult};
struct MyAdapter;
impl AshAdapter for MyAdapter {
fn canonicalize_json(&self, input: &str) -> AdapterResult {
match my_sdk::canonicalize(input) {
Ok(s) => AdapterResult::ok(s),
Err(e) => AdapterResult::error(e.code, e.status),
}
}
// ... implement other methods
}
let vectors = load_vectors(include_bytes!("../../tests/conformance/vectors.json")).unwrap();
let report = run_vectors(&vectors, &MyAdapter);
assert!(report.all_passed(), "Failures: {:?}", report.failures());Structs§
- Adapter
Result - Result from an adapter operation.
- Test
Report - Report from running all vectors.
- Vector
- A single conformance vector.
- Vector
File - Top-level vectors file.
- Vector
Result - Result of running a single vector.
Traits§
- AshAdapter
- Trait that SDK implementations must implement for conformance testing.
Functions§
- load_
vectors - Load vectors from raw JSON bytes (e.g.,
include_bytes!). - load_
vectors_ from_ file - Load vectors from a file path.
- run_
vectors - Run all vectors against an adapter.