Skip to main content

Module testing

Module testing 

Source
Expand description

In-process test client (feature test-client).

TestClient talks to a Server without any I/O, but through the full serialization path: every request is encoded to bytes, parsed by the server exactly as a transport would, and the response is decoded from bytes. Tests therefore exercise the real wire format.

let client = TestClient::new(server);
let tools = client.list_tools().await?;
let result = client.call_tool("add", serde_json::json!({ "a": 1, "b": 2 })).await?;

Structs§

TestClient
A client that calls a Server in process.

Enums§

ClientError
An error returned by TestClient.